[Development] [HiDPI] Rethinking the scaling algorithm
Niccolò Belli
darkbasic at linuxsystems.it
Wed Nov 16 17:22:41 CET 2016
Hi Morten,
I'm sorry, I missed your reply.
> RoundPreferFloor Round up for .75 and higher
> RoundPreferFloor is the new default. Do you think this is
> sufficient?
qFloor would help for my monitor, of course.
Unfortunately the default (RoundPreferFloor) wouldn't be enough, because my
monitor is 282.42 PPI and 282.42/96=2.94
Also RoundPreferFloor would break the 4K 27" monitor previously mentioned,
because 161.18/96=1.6998
I thought about a better default: round up for ratios lesser than 2 but
always round down for ratios higher than 2.
Such a way the new formula will work for both categories of monitors: it
will basically keep the current algorithm but it will be a bit more
conservative when handling extreme scalings (>=3x).
The 4K 27" will get 2x scaling, the 13" 3200x1800 will get 2x scaling and
both a 13" and a 15" 4K monitors will get 3x scaling. It seems perfect to
me, especially if you plan to change the base DPI on a per-OS basis.
Niccolò Belli
On giovedì 10 novembre 2016 10:43:06 CET, Morten Sorvig wrote:
>> On 8 Nov 2016, at 15:57, Niccolò Belli <darkbasic at linuxsystems.it> wrote:
>>
>> Hi,
>> My laptop's monitor is a 13" with a 16:9 aspect ratio and a
>> 3200x1800 resolution. As you can see[1] the EDID[2] is
>> perfectly correct.
>> QT computes the scaling factor using a formula like this:
>> scaling_factor=qRound(yourDpi/96)
>> This is far from ideal in my opinion, because if we want to
>> scale to 96 logical PPI it means that on a 13" 16:9 screen we
>> want to target a 1088x612 logical resolution. In fact
>> qRound(282.42/96) computes a 3x scaling factor for my laptop,
>> which is not a scaling factor that *anybody* would like to have
>> (except maybe my old grandfather with poor eyesight). In fact a
>> logical resolution of *less* than 1088x612 (it's lesser because
>> qRound actually rounded up the value) is too tiny even for a
>> 13" scree ...
>
>
> Hi, thanks for bringing this up. I agree with this point;
> mathematically correct rounding
> may not be the best kind of correct in this case.
>
> In fact a change is already in review:
>
> https://codereview.qt-project.org/#/c/157174/
>
> This introduces QT_SCALE_FACTOR_ROUNDING_POLICY with the following options:
>
> Round qRound(), as today
> Ceil qCeil()
> Floor qFloor()
> RoundPreferFloor Round up for .75 and higher
> PassThrough Do not round and allow fractional scale factors
>
> RoundPreferFloor is the new default. Do you think this is
> sufficient? Adding more options is
> possible, as is adding a C++ API if needed.
>
> Morten
>
More information about the Development
mailing list