Ok, enabling the Juce feature Component::setBufferedToImage(true); works very well most of the time to accelerate the performance of otherwise slow to paint components.
However, due to the bogusness of iOS retina x2 UI scaling, enabling this feature makes it all “big and chunky”.
Unfortunately, i don’t see how Juce can magically fix this. So here’s some hacks that get around this by building a special CachedComponentImage called, `ScalingCachedComponentImage’.
Here’s what i do,
The ScalingCachedComponentImage, is a copy of the Juce version except it multiples the `bounds’ its using by the UI scale factor (normally 1).
Then it does the same as before, except it finally renders using:
int w = image.getWidth();
int h = image.getHeight();
normally, no scale will apply. but for retina, it will describe a halving transform, which is then conveniently ignored.
ok, if this is all that’s needed then Juce could do it. but there’s more. my component that uses this must lie to itself about its bounds.
first it must assign the CachedComponentImage,
setCachedComponentImage(new ScalingCachedComponentImage(*this, scale));
Then it must lie about its dimensions. i achieve this by consistently, throughout all methods, using a private version of `getLocalBounds’ that scales the bounding rectangle by the UI scale factor.
As a result of these nasties, everything works. and there’s no penalty for x1 scale.
i’m wondering if anyone else has any better ideas. retina x2 scaling really sucks