Repaint performance / OSX painting



We are building a plugin with an editor which contains continuously updated components (a VU meter, ...).  The repaint() function of this components are called from the timerCallback function (each 50 ms).

Issue #1: We have discovered that all the components (and the background) that are positioned within the bounding rect of our continiously updated components are continiously redrawn, even those for which we don't explicitly call repaint. While searching for an explanation, we found the following:

Apple describes that a bounding rect will be used if different components are invalidated (repaint() was called).  This means, as a consequence that all the components (and background) within this bounding rect will be redrawn. 

We also discovered that, as a developer, you can ask for the different clip rects

getClipRects() (line 1216) in

We tried to disable USE_COREGRAPHICS_RENDERING, in order for the rendering to use the getClipRects function.  Still, we notice that the background is redrawn. We compare the rects we get from getClipRects, with the rects used when calling repaint(), and notice that there are clip rects which we don't know.

Notice that we defined all components as opaqe.

Issue #2: There is a second issue that there are paint calls coming from the idle callback of the Juce VST wrapper. We are getting to the point where performAnyPendingRepaintsNow repaints a rect which doesn't correspond to any of the clip rects (rects we used to calling repaint from the timer callback).


Have you tried setOpaque(true) on your VUMeter ?


Yes, all our components are opaque -> setOpaque(true)


What does the profiler say are the hot spots?