[Bf-committers] DPI scaling question...

Ton Roosendaal ton at blender.org
Sat Jun 29 13:34:56 CEST 2013


Hi,

This line:

> y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) :
> 29.0f * UI_DPI_FAC;

Is really an exception. It was code using hardcode pixel values before.
So it was this:

y = (ypixels <= 39.0f) ? (ypixels - 10.0f) : 29.0f;

In order to make it respect DPI scaling, the multiplier was added.

Best would be to have this multiplication as litte as possible. Most of UI widget code is doing without already. It's just still there for code that was using hardcoded pixels for drawing.

The error for node placement on 'add node' is because it's python code trying to do patch DPI stuff, which it shouldn't do there. The API call there (v2d.region_to_view) should have been fixed for it.

I'll discuss it with Lukas or Campbell how to solve this best.

-Ton-

--------------------------------------------------------
Ton Roosendaal  -  ton at blender.org   -   www.blender.org
Chairman Blender Foundation - Producer Blender Institute
Entrepotdok 57A  -  1018AD Amsterdam  -  The Netherlands



On 27 Jun, 2013, at 6:56, David Jeske wrote:

> I'm trying to fix some Macbook Retina DPI scaling bugs, and I need some
> background on the UI_DPI_FAC.
> 
> The first bug is that new compositor nodes are placed wrong on retina. I
> can see where they are created and placed in scripts/startup/bl_operators.
> However, I don't understand where DPI scaling is supposed to happen.
> 
> It surprises me to see code all over which deals with DPI factor like
> this...
> 
> y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) :
> 29.0f * UI_DPI_FAC;
> 
> I expected it to be more centralized, where the whole UI would run in a
> virtualized coordinate-space automatically adjusted for DPI, and DPI
> scaling would be handled in the core mouse-event delivery and drawing code.
> Only a few places that care about raw pixels or should not respond to dpi
> changes would need to interact with DPI.
> 
> I suspect there is a reason it wasn't done this way, but I don't know what
> it is, so it's hard for me to understand where DPI scaling should be done
> to fix these bugs.
> 
> Can anyone enlighten me?
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



More information about the Bf-committers mailing list