Skip to content

Commit 4f653a1

Browse files
committed
Add setNeedsDisplayCGLayerInRect and setNeedsDisplayCGLayer
1 parent 2fb08d3 commit 4f653a1

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/MacVim/MMCoreTextView.m

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,18 @@ - (CGContextRef)getCGContext
686686
}
687687
}
688688

689+
- (void)setNeedsDisplayCGLayerInRect:(CGRect)rect
690+
{
691+
if (cgLayerEnabled)
692+
[self setNeedsDisplayInRect:rect];
693+
}
694+
695+
- (void)setNeedsDisplayCGLayer:(BOOL)flag
696+
{
697+
if (cgLayerEnabled)
698+
[self setNeedsDisplay:flag];
699+
}
700+
689701

690702
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size
691703
{
@@ -1002,7 +1014,7 @@ - (void)batchDrawData:(NSData *)data
10021014
operation:NSCompositingOperationSourceOver
10031015
fraction:1.0];
10041016
}
1005-
[self setNeedsDisplayInRect:r];
1017+
[self setNeedsDisplayCGLayerInRect:r];
10061018
} else if (DrawStringDrawType == type) {
10071019
int bg = *((int*)bytes); bytes += sizeof(int);
10081020
int fg = *((int*)bytes); bytes += sizeof(int);
@@ -1500,7 +1512,7 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length
15001512
CGContextSetFontSmoothingStyle(context, originalFontSmoothingStyle);
15011513
CGContextRestoreGState(context);
15021514

1503-
[self setNeedsDisplayInRect:clipRect];
1515+
[self setNeedsDisplayCGLayerInRect:clipRect];
15041516
}
15051517

15061518
- (void)scrollRect:(NSRect)rect lineCount:(int)count
@@ -1518,7 +1530,7 @@ - (void)scrollRect:(NSRect)rect lineCount:(int)count
15181530
CGContextDrawLayerAtPoint(
15191531
context, CGPointMake(0, -yOffset), [self getCGLayer]);
15201532
CGContextRestoreGState(context);
1521-
[self setNeedsDisplayInRect:clipRect];
1533+
[self setNeedsDisplayCGLayerInRect:clipRect];
15221534
} else {
15231535
NSSize delta={0, -count * cellSize.height};
15241536
[self scrollRect:rect by:delta];
@@ -1573,7 +1585,7 @@ - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2
15731585
CGContextSetBlendMode(context, kCGBlendModeCopy);
15741586
CGContextFillRect(context, *(CGRect*)&rect);
15751587
CGContextSetBlendMode(context, kCGBlendModeNormal);
1576-
[self setNeedsDisplayInRect:rect];
1588+
[self setNeedsDisplayCGLayerInRect:rect];
15771589
}
15781590

15791591
- (void)clearAll
@@ -1591,7 +1603,7 @@ - (void)clearAll
15911603
CGContextFillRect(context, *(CGRect*)&rect);
15921604
CGContextSetBlendMode(context, kCGBlendModeNormal);
15931605

1594-
[self setNeedsDisplay:YES];
1606+
[self setNeedsDisplayCGLayer:YES];
15951607
}
15961608

15971609
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
@@ -1639,7 +1651,7 @@ - (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
16391651
CGContextFillRect(context, *(CGRect*)&rect);
16401652
}
16411653

1642-
[self setNeedsDisplayInRect:rect];
1654+
[self setNeedsDisplayCGLayerInRect:rect];
16431655
CGContextRestoreGState(context);
16441656
}
16451657

@@ -1656,7 +1668,7 @@ - (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
16561668
numColumns:ncols];
16571669
CGContextFillRect(cgctx, *(CGRect*)&rect);
16581670

1659-
[self setNeedsDisplayInRect:rect];
1671+
[self setNeedsDisplayCGLayerInRect:rect];
16601672
CGContextRestoreGState(cgctx);
16611673
}
16621674

0 commit comments

Comments
 (0)