aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2012-08-24 18:56:54 +1000
committernyamatongwe <nyamatongwe@gmail.com>2012-08-24 18:56:54 +1000
commit0ebd7cda67d99bb3027212a06360a215ac5e7551 (patch)
tree2c94df5c84883fefcf4cedb4d1adef9410b0bf24
parentad7a82dd1ce1e3cc6c5fefc5fb68d18d38b5163b (diff)
downloadscintilla-mirror-0ebd7cda67d99bb3027212a06360a215ac5e7551.tar.gz
Ensure abandoned paints cover full area by using NSView display instead of trying
to draw more within initial drawing context.
-rw-r--r--cocoa/ScintillaCocoa.h4
-rw-r--r--cocoa/ScintillaCocoa.mm17
-rw-r--r--cocoa/ScintillaView.mm4
3 files changed, 11 insertions, 14 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h
index e4179b1bb..1a7852bce 100644
--- a/cocoa/ScintillaCocoa.h
+++ b/cocoa/ScintillaCocoa.h
@@ -143,8 +143,8 @@ public:
ScintillaView* TopContainer();
- void SyncPaint(void* gc, PRectangle rc);
- void Draw(NSRect rect, CGContextRef gc);
+ bool SyncPaint(void* gc, PRectangle rc);
+ bool Draw(NSRect rect, CGContextRef gc);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void SetTicking(bool on);
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index 7fc07c7c1..a19b62216 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1439,29 +1439,24 @@ bool ScintillaCocoa::HaveMouseCapture()
/**
* Synchronously paint a rectangle of the window.
*/
-void ScintillaCocoa::SyncPaint(void* gc, PRectangle rc)
+bool ScintillaCocoa::SyncPaint(void* gc, PRectangle rc)
{
paintState = painting;
rcPaint = rc;
PRectangle rcText = GetTextRectangle();
paintingAllText = rcPaint.Contains(rcText);
+ bool succeeded = true;
Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (sw)
{
sw->Init(gc, wMain.GetID());
Paint(sw, rc);
- if (paintState == paintAbandoned)
- {
- // Do a full paint.
- rcPaint = GetClientRectangle();
- paintState = painting;
- paintingAllText = true;
- Paint(sw, rcPaint);
- }
+ succeeded = paintState != paintAbandoned;
sw->Release();
delete sw;
}
paintState = notPainting;
+ return succeeded;
}
//--------------------------------------------------------------------------------------------------
@@ -1769,9 +1764,9 @@ void ScintillaCocoa::IdleTimerFired()
* @param rect The area to paint, given in the sender's coordinate system.
* @param gc The context we can use to paint.
*/
-void ScintillaCocoa::Draw(NSRect rect, CGContextRef gc)
+bool ScintillaCocoa::Draw(NSRect rect, CGContextRef gc)
{
- SyncPaint(gc, NSRectToPRectangle(rect));
+ return SyncPaint(gc, NSRectToPRectangle(rect));
}
//--------------------------------------------------------------------------------------------------
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index ba363ef14..178762d68 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -127,7 +127,9 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
{
CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
- mOwner.backend->Draw(rect, context);
+ if (!mOwner.backend->Draw(rect, context)) {
+ [self display];
+ }
}
//--------------------------------------------------------------------------------------------------