Retina and Drawable objects


#1

Hi everyone, I currently handle the multi-resolution issue by using drawable objects made form SVG files. As the complexity of the GUI has increased, this approach has made the responsiveness of the app feel sluggish. The responsiveness can be regained with a liberal use of Component::setBufferedToImage(true), but this trashes the resolution of the vector graphics on a retina display. Is there any quick fix?


#2

How does storing the Image corresponding to a Drawable “trash” the resolution? Just render the SVG at the display resolution once and then use that to draw. The resolution on a device is constant…once you render the SVG at display resolution there is no need to render it again.

Pre-rendering will always make sense when the cost of drawing the object is greater than the combined cost of drawing the corresponding images plus the increase in memory.


#3

Thanks for the response. Perhaps I am misunderstanding something. In my components paint method, I draw stuff like this.

        Rectangle<float> rect(0,0,getWidth(),getHeight());
        myDrawable->drawWithin(g, rect,RectanglePlacement::centred, 1.f);

…with this on its own, the graphics render just fine on regular and double resolution displays. If I add the following to the ctor of the component . . .

      this->setBufferedToImage(true);

Then the cached drawable renders all fuzzy on a double resolution display, like it has been cached at single resolution and then blown up. I’m guessing/hoping that I might have missed something simple.


#4

Maybe JUCE just doesn’t know the resolution until draw time, or the code to determine the resolution when a Component is set to cache is not resolution-aware.


#5

Didn’t Hugh or somebody post recently about bitmaps being pixel doubled on retina displays? Sounds like it might be something like that…