Bug with Component in getDesktopScaleFactor();


#1

The Component function getDesktopScaleFactor() is not returning the correct scale on Retina displays. It returns 1 instead of 2. 

The reason I stumbled upon this is I'm using proxy components with the ComponentAnimator. I was trying to figure out why all of my animations were blurry when using a Retina display. Turns out Juce was taking half-sized component screenshots, then scaling them to fill the space :). 

-n

 

 


#2

It's a scale-factor, not a DPI - since OSX already hides the physical scale from the app, it presents itself as a 1:1 scale, which is what this is reporting. Bit tricky to pick out the real number, but you could use the DPI from Desktop::Displays


#3

Elsewhere I'm successfully scaling things by looking at Desktop::getInstance().getDisplays().getMainDisplay().scale, which returns 2 for an iPad. Which is what I just hacked in here to make it work.

Anyway, what I'm saying is, perhaps component animations that use a proxy should be looking at the current display's scale instead of the desktop's scale. (line 152 of juce_ComponentAnimator.cpp).

 I understand this might be trickier for multiple monitor setups, where I guess it's possible to have more than one scale factor? It might be better to just choose the largest display scale available, because scaling the image down looks fine, it's scaling it up that looks awful. At least that's the case here.

 


#4

Oh, I see. Sorry, misunderstood the question. I'll take a look at ComponentAnimator, I guess it should be a bit smarter about it.