Browse Source

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

tags/2021-05-28
ed 4 years ago
parent
commit
d3f91fd76c
1 changed files with 13 additions and 8 deletions
  1. +13
    -8
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 13
- 8
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm 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)


Loading…
Cancel
Save