lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

Sharp SVG icons with scale factors > 1 #203

Closed tsujan closed 4 years ago

tsujan commented 4 years ago

Fixes https://github.com/lxqt/libqtxdg/issues/178

The SVG icon engine gives a too big pixmap with scale factors > 1, so that the final drawing will not be sharp if the real size is used. This patch scales down the pixmap to the actual size in order to get a sharp SVG icon, especially with non-integer scale factors.

Now, for the first time in LXQt, I get sharp SVG icons with QT_SCALE_FACTOR=1.5:) Before the patch:

before

After the patch:

after

NOTE: There's a comment in the patch that says, "The cause of this old behavior is unknown to me (@tsujan)." If you know the cause, please replace the comment!

tsujan commented 4 years ago

Got rid of qApp and devicePixelRatio altogether by scaling the pixmap that the SVG icon engine gives. The final result is the same: sharp SVG icons with non-integer and integer scale factors alike.

tsujan commented 4 years ago

This has fixed the old issue of unsharp SVG icons with scale factors here. Any objection to merging?

luis-pereira commented 4 years ago

ship it