| @@ -69,7 +69,6 @@ public: | |||||
| view (nil), | view (nil), | ||||
| isSharedWindow (viewToAttachTo != nil), | isSharedWindow (viewToAttachTo != nil), | ||||
| fullScreen (false), | fullScreen (false), | ||||
| insideDrawRect (false), | |||||
| #if USE_COREGRAPHICS_RENDERING | #if USE_COREGRAPHICS_RENDERING | ||||
| usingCoreGraphics (true), | usingCoreGraphics (true), | ||||
| #else | #else | ||||
| @@ -793,6 +792,37 @@ public: | |||||
| displayScale = (float) screen.backingScaleFactor; | displayScale = (float) screen.backingScaleFactor; | ||||
| #endif | #endif | ||||
| #if USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS | |||||
| // This option invokes a separate paint call for each rectangle of the clip region. | |||||
| // It's a long story, but this is a basically a workaround for a CGContext not having | |||||
| // a way of finding whether a rectangle falls within its clip region | |||||
| if (usingCoreGraphics) | |||||
| { | |||||
| const NSRect* rects = nullptr; | |||||
| NSInteger numRects = 0; | |||||
| [view getRectsBeingDrawn: &rects count: &numRects]; | |||||
| if (numRects > 1) | |||||
| { | |||||
| for (int i = 0; i < numRects; ++i) | |||||
| { | |||||
| NSRect rect = rects[i]; | |||||
| CGContextSaveGState (cg); | |||||
| CGContextClipToRect (cg, CGRectMake (rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)); | |||||
| drawRect (cg, rect, displayScale); | |||||
| CGContextRestoreGState (cg); | |||||
| } | |||||
| return; | |||||
| } | |||||
| } | |||||
| #endif | |||||
| drawRect (cg, r, displayScale); | |||||
| } | |||||
| void drawRect (CGContextRef cg, NSRect r, float displayScale) | |||||
| { | |||||
| #if USE_COREGRAPHICS_RENDERING | #if USE_COREGRAPHICS_RENDERING | ||||
| if (usingCoreGraphics) | if (usingCoreGraphics) | ||||
| { | { | ||||
| @@ -872,9 +902,7 @@ public: | |||||
| void invokePaint (LowLevelGraphicsContext& context) | void invokePaint (LowLevelGraphicsContext& context) | ||||
| { | { | ||||
| lastRepaintTime = Time::getCurrentTime(); | lastRepaintTime = Time::getCurrentTime(); | ||||
| insideDrawRect = true; | |||||
| handlePaint (context); | handlePaint (context); | ||||
| insideDrawRect = false; | |||||
| } | } | ||||
| void performAnyPendingRepaintsNow() override | void performAnyPendingRepaintsNow() override | ||||
| @@ -1283,7 +1311,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| NSWindow* window; | NSWindow* window; | ||||
| NSView* view; | NSView* view; | ||||
| bool isSharedWindow, fullScreen, insideDrawRect; | |||||
| bool isSharedWindow, fullScreen; | |||||
| bool usingCoreGraphics, isZooming, textWasInserted; | bool usingCoreGraphics, isZooming, textWasInserted; | ||||
| String stringBeingComposed; | String stringBeingComposed; | ||||
| NSNotificationCenter* notificationCenter; | NSNotificationCenter* notificationCenter; | ||||