tibirna / qgit

Official git repository for QGit.
Other
175 stars 68 forks source link

Support for fractional device pixel ratio #87

Closed muffato closed 4 years ago

muffato commented 4 years ago

Platform information

Operating System: Kubuntu 19.10 KDE Plasma Version: 5.17.5 KDE Frameworks Version: 5.66.0 Qt Version: 5.12.4 Kernel Version: 5.3.0-29-generic OS Type: 64-bit Processors: 4 × Intel® Core™ i7-7500U CPU @ 2.70GHz Memory: 15.5 GiB of RAM

It's a Dell XPS laptop running the stock Kubuntu with the KDE backports. My laptop screen is 3200x1800 which I scale 1.5x in the System Settings.

Problem

Follow-up of #86, but I now understand what is going on :)

On the master branch, the tag / branch labels are truncated: Screenshot_20200207_002728

Solution

This is due to the fact dpr is systematically cast into an integer prior to the multiplication / division. This essentially rounds down / up fractional pixel ratios. On my device, the scaling factor is set to 1.5, so dpr was rounded up to 2.

I have moved the casts outside of the multiplications / divisions and it works: Screenshot_20200207_014259 (unlike my attempt in #86 the labels are drawn at the full resolution this time)

The problem was essentially caused by this commit: 65b369a94efc3d4a055a1635651426c9dbc1f86b. Do you remember what sort of warnings you had ? I tried compiling in debug mode but I don't see any warnings on those lines.

Regards, Matthieu

tibirna commented 4 years ago

Hello

Thanks for the corrections. They are appropriate. I don't own a hires screen, this is why I wouldn't see the issue.

Merged. Thanks again Cristian

muffato commented 4 years ago

Marvellous, thanks a lot !

Matthieu