Skip to content

Stateful, fast renderer for MMCoreTextView #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/MacVim/MMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ + (void)initialize
[NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey,
[NSNumber numberWithBool:YES], MMNativeFullScreenKey,
[NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey,
[NSNumber numberWithBool:NO], MMUseCGLayerAlwaysKey,
@(shouldUseBufferedDrawing()), MMBufferedDrawingKey,
[NSNumber numberWithBool:YES], MMShareFindPboardKey,
nil];

Expand Down
38 changes: 3 additions & 35 deletions src/MacVim/MMCoreTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,13 @@
BOOL antialias;
BOOL ligatures;
BOOL thinStrokes;
BOOL drawPending;
NSMutableArray *drawData;

MMTextViewHelper *helper;

unsigned maxlen;
CGGlyph *glyphs;
CGPoint *positions;
NSMutableArray *fontCache;

// Issue draws onto an CGImage that caches the drawn results instead of
// directly in drawRect:. This is the default behavior in cases where simply
// drawing incrementally in drawRect: doesn't work. Those cases are:
// 1. Non-native fullscreen
// 2. 10.14+ (views are always layer-backed which means the view buffer will
// be cleared and we can't incrementally draw in drawRect:)
//
// This can be configured by setting MMBufferedDrawingKey in user defaults.
BOOL cgBufferDrawEnabled;
BOOL cgBufferDrawNeedsUpdateContext;
CGContextRef cgContext;
NSMutableDictionary<NSNumber *, NSFont *> *fontVariants;
NSMutableSet<NSString *> *characterStrings;
NSMutableDictionary<NSNumber *,NSCache<NSString *,id> *> *characterLines;

// *Deprecated*
// Draw onto a CGLayer instead of lazily updating the view's buffer in
// drawRect: which is error-prone and relying on undocumented behaviors
// (that the OS will preserve the old buffer).
//
// This is deprecated. Use cgBufferDrawEnabled instead which is more
// efficient.
//
// This can be configured by setting MMUseCGLayerAlwaysKey in user defaults.
BOOL cgLayerEnabled;
CGLayerRef cgLayer;
CGContextRef cgLayerContext;
NSLock *cgLayerLock;

// These are used in MMCoreTextView+ToolTip.m
id trackingRectOwner_; // (not retained)
void *trackingRectUserData_;
Expand Down Expand Up @@ -113,13 +84,10 @@
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (NSRect)rectForRow:(int)row column:(int)column numRows:(int)nr
numColumns:(int)nc;
- (void)setCGLayerEnabled:(BOOL)enabled;
- (BOOL)getCGLayerEnabled;

//
// NSTextView methods
//
- (void)setFrameSize:(NSSize)newSize;
- (void)keyDown:(NSEvent *)event;
- (void)insertText:(id)string;
- (void)doCommandBySelector:(SEL)selector;
Expand Down
Loading