From c7062988fae7ef98dc94b4b4956d01cbd4c6226c Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Thu, 27 Mar 2014 16:15:21 +1100 Subject: 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. --- cocoa/ScintillaView.mm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'cocoa/ScintillaView.mm') diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 7769d87ef..222fcdc8f 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -227,6 +227,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;iWillDraw(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. */ -- cgit v1.2.3