Skip to content

Commit 1961d05

Browse files
authored
Merge pull request #858 from s4y/stateful-render
Stateful, fast renderer for MMCoreTextView
2 parents 14d9157 + dba6293 commit 1961d05

14 files changed

+430
-1218
lines changed

src/MacVim/MMAppController.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ + (void)initialize
248248
[NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey,
249249
[NSNumber numberWithBool:YES], MMNativeFullScreenKey,
250250
[NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey,
251-
[NSNumber numberWithBool:NO], MMUseCGLayerAlwaysKey,
252-
@(shouldUseBufferedDrawing()), MMBufferedDrawingKey,
253251
[NSNumber numberWithBool:YES], MMShareFindPboardKey,
254252
nil];
255253

src/MacVim/MMCoreTextView.h

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,13 @@
3131
BOOL antialias;
3232
BOOL ligatures;
3333
BOOL thinStrokes;
34-
BOOL drawPending;
35-
NSMutableArray *drawData;
3634

3735
MMTextViewHelper *helper;
3836

39-
unsigned maxlen;
40-
CGGlyph *glyphs;
41-
CGPoint *positions;
42-
NSMutableArray *fontCache;
43-
44-
// Issue draws onto an CGImage that caches the drawn results instead of
45-
// directly in drawRect:. This is the default behavior in cases where simply
46-
// drawing incrementally in drawRect: doesn't work. Those cases are:
47-
// 1. Non-native fullscreen
48-
// 2. 10.14+ (views are always layer-backed which means the view buffer will
49-
// be cleared and we can't incrementally draw in drawRect:)
50-
//
51-
// This can be configured by setting MMBufferedDrawingKey in user defaults.
52-
BOOL cgBufferDrawEnabled;
53-
BOOL cgBufferDrawNeedsUpdateContext;
54-
CGContextRef cgContext;
37+
NSMutableDictionary<NSNumber *, NSFont *> *fontVariants;
38+
NSMutableSet<NSString *> *characterStrings;
39+
NSMutableDictionary<NSNumber *,NSCache<NSString *,id> *> *characterLines;
5540

56-
// *Deprecated*
57-
// Draw onto a CGLayer instead of lazily updating the view's buffer in
58-
// drawRect: which is error-prone and relying on undocumented behaviors
59-
// (that the OS will preserve the old buffer).
60-
//
61-
// This is deprecated. Use cgBufferDrawEnabled instead which is more
62-
// efficient.
63-
//
64-
// This can be configured by setting MMUseCGLayerAlwaysKey in user defaults.
65-
BOOL cgLayerEnabled;
66-
CGLayerRef cgLayer;
67-
CGContextRef cgLayerContext;
68-
NSLock *cgLayerLock;
69-
7041
// These are used in MMCoreTextView+ToolTip.m
7142
id trackingRectOwner_; // (not retained)
7243
void *trackingRectUserData_;
@@ -113,13 +84,10 @@
11384
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
11485
- (NSRect)rectForRow:(int)row column:(int)column numRows:(int)nr
11586
numColumns:(int)nc;
116-
- (void)setCGLayerEnabled:(BOOL)enabled;
117-
- (BOOL)getCGLayerEnabled;
11887

11988
//
12089
// NSTextView methods
12190
//
122-
- (void)setFrameSize:(NSSize)newSize;
12391
- (void)keyDown:(NSEvent *)event;
12492
- (void)insertText:(id)string;
12593
- (void)doCommandBySelector:(SEL)selector;

0 commit comments

Comments
 (0)