Browse Source

Workaround for some OSX10.11 repaint region coalescing problems

tags/2021-05-28
jules 9 years ago
parent
commit
5d23645ca2
2 changed files with 9 additions and 13 deletions
  1. +1
    -1
      modules/juce_graphics/geometry/juce_RectangleList.h
  2. +8
    -12
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 1
- 1
modules/juce_graphics/geometry/juce_RectangleList.h View File

@@ -524,7 +524,7 @@ public:
*/ */
void consolidate() void consolidate()
{ {
for (int i = 0; i < getNumRectangles() - 1; ++i)
for (int i = 0; i < rects.size() - 1; ++i)
{ {
RectangleType& r = rects.getReference (i); RectangleType& r = rects.getReference (i);
const ValueType rx1 = r.getX(); const ValueType rx1 = r.getX();


+ 8
- 12
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -859,18 +859,14 @@ public:
void repaint (const Rectangle<int>& area) override void repaint (const Rectangle<int>& area) override
{ {
Rectangle<float> r ((float) area.getX(), [view frame].size.height - (float) area.getBottom(),
(float) area.getWidth(), (float) area.getHeight());
if (insideDrawRect || areAnyWindowsInLiveResize())
{
deferredRepaints.add (r);
triggerAsyncUpdate();
}
else
{
[view setNeedsDisplayInRect: makeNSRect (r)];
}
// In 10.11 changes were made to the way the OS handles repaint regions, and it seems that it can
// no longer be trusted to coalesce all the regions, or to even remember them all without losing
// a few when there's a lot of activity.
// As a work around for this, we use a RectangleList to do our own coalescing of regions before
// asynchronously asking the OS to repaint them.
deferredRepaints.add ((float) area.getX(), (float) ([view frame].size.height - area.getBottom()),
(float) area.getWidth(), (float) area.getHeight());
triggerAsyncUpdate();
} }
void invokePaint (LowLevelGraphicsContext& context) void invokePaint (LowLevelGraphicsContext& context)


Loading…
Cancel
Save