1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

macOS: Fixed repaint issue with JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS enabled that was introduced in 8d3fd927

This commit is contained in:
ed 2021-01-14 15:54:47 +00:00
parent a6217ae9fb
commit d3f91fd76c

View file

@ -856,6 +856,14 @@ public:
if ([screen respondsToSelector: @selector (backingScaleFactor)])
displayScale = (float) screen.backingScaleFactor;
auto invalidateTransparentWindowShadow = [this]
{
// transparent NSWindows with a drop-shadow need to redraw their shadow when the content
// changes to avoid stale shadows being drawn behind the window
if (! isSharedWindow && ! [window isOpaque] && [window hasShadow])
[window invalidateShadow];
};
#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
@ -876,18 +884,15 @@ public:
drawRect (cg, rect, displayScale);
CGContextRestoreGState (cg);
}
invalidateTransparentWindowShadow();
return;
}
}
else
#endif
{
drawRect (cg, r, displayScale);
}
// transparent NSWindows with a drop-shadow need to redraw their shadow when the content
// changes to avoid stale shadows being drawn behind the window
if (! isSharedWindow && ! [window isOpaque] && [window hasShadow])
[window invalidateShadow];
drawRect (cg, r, displayScale);
invalidateTransparentWindowShadow();
}
void drawRect (CGContextRef cg, NSRect r, float displayScale)