Pre-rendering to Image and retina displays


I’m using ImageCache to save some complex widgets as images to improve rendering time.

I do …

image = ImageCache::get...
if (!image.isValid())
... render
... save to cache
    g.drawImageAt(newImage, 0, 0);
  g.drawImageAt(image, 0, 0);

But this isn’t good if you have a retina display. What’s the right approach to cope with non-unity values from getPhysicalPixelScaleFactor()?


If you create a component and use its setBufferedToImage, then it’ll take care of getting the resolution right.


Mmm, it’s not quite as simple as that, I’ve got a zillion of these little components many of which are showing the same image. Caching just the one component isn’t getting the speed up! I’ll look at what that function does tho maybe…


Yeah - cheers Jules, StandardCachedComponentImage looks like it has the magic spell needed…


Whahaha - this is harder than it ought to be without buying a retina display … just discovered it down renders with tiny images … maybe I need to apply another transform here somewhere :slight_smile:


What happens if a component is displayed across two displays?


IME on mac it will switch at some point while you are dragging, you can see it on the other display with an alpha applied either up or down scaled accordingly then it will switch the display resolution and switch which side of the window has no alpha and which side has an alpha applied - in other words the OS handles this for you and you will only ever have one display resolution at a time (I believe). Unless there is some way to enable it there is no way to actually display the plug-in across two monitors, once you release from dragging the window, it will only show the part of the window that is displayed on the screen the resolution is applicable to. If you are not already use Quartz Debug to simulate a retina display.


That’s a great plan. I forgot that even existed.


IIRC on Mac you can also simulate a retina monitor using the regular System Preferences: just open the Monitor settings and choose whatever HiDPI resolution appears in the list that shows when you don’t choose to use the default resolution for the monitor.


I think I had to use Quartz Debug in order to add that mode initially.


For me, it worked out of the box, never used Quartz Debug (did not even know of its existence, honestly :grin: )