aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaView.mm
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2014-03-27 16:15:21 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2014-03-27 16:15:21 +1100
commitc986369e3282e167711fba21f6ebe25e519b82dc (patch)
tree020923e5cb6ca1802880202d31742d4112f5bd41 /cocoa/ScintillaView.mm
parent8d1efd730218d8a434447c7e73ac03720825fb84 (diff)
downloadscintilla-mirror-c986369e3282e167711fba21f6ebe25e519b82dc.tar.gz
Improve scrolling by performing styling in methods called before drawing instead of inside drawing
which then caused the drawing to be abandoned, and black blocks to appear on-screen. Discard responsive scrolling overdraw when that overdrawn content is invalid. Style just the visible area instead of the whole document when styling changes run beyond painting area.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r--cocoa/ScintillaView.mm31
1 files changed, 31 insertions, 0 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 7769d87ef..222fcdc8f 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -228,6 +228,37 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
//--------------------------------------------------------------------------------------------------
/**
+ * Called before repainting.
+ */
+- (void) viewWillDraw
+{
+ const NSRect *rects;
+ NSInteger nRects = 0;
+ [self getRectsBeingDrawn:&rects count:&nRects];
+ if (nRects > 0) {
+ NSRect rectUnion = rects[0];
+ for (int i=0;i<nRects;i++) {
+ rectUnion = NSUnionRect(rectUnion, rects[i]);
+ }
+ mOwner.backend->WillDraw(rectUnion);
+ }
+ [super viewWillDraw];
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
+ * Called before responsive scrolling overdraw.
+ */
+- (void) prepareContentInRect: (NSRect) rect
+{
+ mOwner.backend->WillDraw(rect);
+ [super prepareContentInRect: rect];
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
* Gets called by the runtime when the view needs repainting.
*/
- (void) drawRect: (NSRect) rect