# Apparent serious JUCE painting issue in Big Sur

**URL:** <https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430>\
**Category:** MacOSX and iOS\
**Created:** [December 23, 2020, 8:04pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430 "2020-12-23T20:04:40Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 5, 2021, 8:30am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/21 "2021-01-05T08:30:15Z")

</div>

> [@lorcan](#):
>
> Still in case when there’s a bit of automation going on and/or a few meters being updated,  
> it seems like a totally unecessary waste of resources to redraw the static parts too.

It indeed would be a waste if that would be the case, but JUCE does not redraw the static parts too.

---

<div class="post-metadata">

**Author:** ![synthdan](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@synthdan](https://forum.juce.com/u/synthdan)\
**Post date:** [January 11, 2021, 8:25pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/22 "2021-01-11T20:25:12Z")

</div>

Now that we’re deep into January, does the JUCE team intend to address this issue? Currently the only way to get around the Big Sur drawing inefficiency is with the hack posted above, and even then drawing is not efficient on macOS if there are multiple rectangles being invalidated.

It would be nice to know that the JUCE team is working on fixing these issues for their next release. We’d be happy to help test any beta improvements.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 12, 2021, 10:30am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/23 "2021-01-12T10:30:09Z")

</div>

Yes, we’re looking at this, but we have not found a better solution than setting `contentsFormat`. We’ll very likely be committing that change shortly.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 14, 2021, 2:48pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/24 "2021-01-14T14:48:42Z")

</div>

> <https://github.com/juce-framework/JUCE/commit/a6217ae9fb3c2ce27a0a552552173e8892b1ae80>

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 14, 2021, 3:07pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/25 "2021-01-14T15:07:26Z")

</div>

Can you expand on this?

You’ve previously wrote

> if it does work it might hurt performance on anything other than Big Sur.

Some questions:

- Does this hurt performance on other systems?
- Is the problem on Big Sur a different problem than [the one on Mojave](https://forum.juce.com/t/juce-coregraphics-render-with-multiple-paint-calls-not-working-on-new-mac-mojave/30905)

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 14, 2021, 3:44pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/26 "2021-01-14T15:44:52Z")

</div>

I’ve tested on a few different machines and have not seen any evidence of a performance hit. Some Catalina and earlier machines even rendered very slightly quicker after this change, but benchmarking GUI performance rigorously is notoriously difficult. We’ll keep our eyes on the forum.

This fixes an issue where the clipping region returned is always the whole window (despite what `JUCE_ENABLE_REPAINT_DEBUGGING` would suggest). It does not restore the the usefulness of `JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS` as `getRectsBeingDrawn` will still return 1 in all cases.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 14, 2021, 3:46pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/27 "2021-01-14T15:46:14Z")

</div>

This fix does, however, suggest that it might be possible to fix an iOS issue that sounds very similar, but I’ve been unable to reproduce the problem on iOS.

> [@JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS not working on new Mac/Mojave?](https://forum.juce.com/t/juce-coregraphics-render-with-multiple-paint-calls-not-working-on-new-mac-mojave/30905/5):
>
> We noticed that this method does not work in ios, so for our apps the entire view is being repainted over and over when moving any widget. What is the ios equivalent to this?

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 20, 2021, 10:08am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/28 "2021-01-20T10:08:11Z")

</div>

@midiculous @PixelPacker Can either of you provide an example of similar behaviour on iOS?

---

<div class="post-metadata">

**Author:** ![midiculous](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/midiculous/32/582_2.png) [@midiculous](https://forum.juce.com/u/midiculous)\
**Post date:** [January 20, 2021, 12:27pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/29 "2021-01-20T12:27:57Z")

</div>

@t0m Please refer back to our long PM exchange with code snippets and examples.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 20, 2021, 12:50pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/30 "2021-01-20T12:50:55Z")

</div>

That exchange was about a macOS rendering issue with different characteristics, but in the thread I linked a couple of posts ago you mention an iOS problem:

> We noticed that this method does not work in ios, so for our apps the entire view is being repainted over and over when moving any widget.

---

<div class="post-metadata">

**Author:** ![synthdan](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@synthdan](https://forum.juce.com/u/synthdan)\
**Post date:** [February 2, 2021, 7:07pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/31 "2021-02-02T19:07:05Z")

</div>

t0m, it appears the viewWillDraw() fix causes a crash in macOS 10.9 and possibly other early OSes. We’re going to try to work around this, but you may want to make sure the production JUCE code accounts for this.

Dan

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [February 2, 2021, 7:32pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/32 "2021-02-02T19:32:17Z")

</div>

Do you see crashes on the current tip of the develop branch?

> <https://github.com/juce-framework/JUCE/commit/473fc357bb29388b09ef9a7a5d6872cffed19eb3>

---

<div class="post-metadata">

**Author:** ![synthdan](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@synthdan](https://forum.juce.com/u/synthdan)\
**Post date:** [February 2, 2021, 7:49pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/33 "2021-02-02T19:49:55Z")

</div>

The version of viewWillDraw() in the development branch looks promising. We’ll test it and report back.

Is the JUCE team still working on a fix for the dirty rectangle problem? We can make our GUI pretty efficient with a combination of this fix and the JUCE\_COREGRAPHICS\_DRAW\_ASYNC flag, but it would still be considerably more efficient if the macOS versions weren’t repainting so much extra all the time.

Thanks!  
Dan

---

<div class="post-metadata">

**Author:** ![synthdan](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@synthdan](https://forum.juce.com/u/synthdan)\
**Post date:** [February 2, 2021, 9:51pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/34 "2021-02-02T21:51:05Z")

</div>

I can confirm that the dev branch code, which checks for Big Sur before modifying anything, solves the problem.

Dan

---

<div class="post-metadata">

**Author:** ![rebbur](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rebbur](https://forum.juce.com/u/rebbur)\
**Post date:** [February 3, 2021, 8:35am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/35 "2021-02-03T08:35:27Z")

</div>

Ouch these fixes were definitely needed. Such a big difference on performance now on Big Sur. Massive drop in CPU usage, we have quite some animating sliders in our ui and they were causing full repaints. Very important to keep track of this behaviour. Probably hard to build a unit test for this but these are those hidden issues where you could spend days and days figuring out what you did wrong. Happy to see this fix.

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [February 3, 2021, 8:39am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/36 "2021-02-03T08:39:11Z")

</div>

> [@t0m](#):
>
> Do you see crashes on the current tip of the develop branch?

Why not enabling the fix also for older OSX \> 10.9?

---

<div class="post-metadata">

**Author:** ![synthdan](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@synthdan](https://forum.juce.com/u/synthdan)\
**Post date:** [February 11, 2021, 2:18am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/37 "2021-02-11T02:18:16Z")

</div>

t0m,

At this point, with the Big Sur workaround, buffering of our controls, and use of the undocumented JUCE\_COREGRAPHICS\_DRAW\_ASYNC flag, we have GUI performance on the macOS roughly equivalent to the performance on Windows, which is a huge relief. However, I still have to believe that performance would benefit greatly from fixing the ability to paint only the dirty rects, as more than one dirty rect appears to cause the entire application to redraw. Are there plans for this to be improved in the next release of JUCE?

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [February 12, 2021, 3:45pm UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/38 "2021-02-12T15:45:15Z")

</div>

I’ve not found a way to get the CoreGraphics backend to stop consolidating regions. We are currently looking at different rendering approaches, but it’s unlikely that anything will be ready by JUCE 6.1.

---

<div class="post-metadata">

**Author:** ![djb-2](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@djb-2](https://forum.juce.com/u/djb-2)\
**Post date:** [February 16, 2021, 8:09am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/39 "2021-02-16T08:09:47Z")

</div>

Apologies for asking a question that might be answered already; we’ve seen the complete UI redraw issue on both macOS and iOS. Does it help to go back and use an older iOS or macOS SDK to resolve this temporarily, or is this issue caused by the OS itself and rolling back Xcode or SDKs won’t help? Anyone tried this?

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [February 16, 2021, 8:43am UTC](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430/40 "2021-02-16T08:43:20Z")

</div>

> [@djb-2](#):
>
> Does it help to go back and use an older iOS or macOS SDK to resolve this temporarily

No.  
unlike Microsoft, with Apple most SDK is dynamically linked to the current macOS  
(there are ways to set different frameworks/dyld mostly during development due to secuirty limitation)

Only workaround for getting responsive UI is caching ( setBufferedToImage) and using OpenGL renderer.

[Previous page](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430.md?page=1)

[Next page](https://forum.juce.com/t/apparent-serious-juce-painting-issue-in-big-sur/43430.md?page=3)
