flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
23.92k stars 1.52k forks source link

Set device pixel ratio for grim screenshot #3604

Open tobiolo opened 1 month ago

tobiolo commented 1 month ago

Grim returns a bitmap with the physical size of the screen. This needs to be scaled back to be displayed as underlay for Flameshot on screens where logical size differs from the physical size (i.e. scale is active).

In order to do this, set the device pixel ratio, see https://doc.qt.io/qt-5/qpixmap.html#setDevicePixelRatio.

Please note that this works only properly with integer scale. QScreen::devicePixelRatio rounds when fractional scale is active on Wayland.

tobiolo commented 1 month ago

Note: It should be this or #3606, but not both.