Skip to content

Commit 9b209ce

Browse files
soswowlgritz
authored andcommitted
iv: Use screen pixel ratio to render sharp text in pixel view tool (AcademySoftwareFoundation#4768)
Improve sharpness of text in pixel view tool for HiDPI screen Before: ![Screenshot 2025-05-17 at 4 45 50 pm](https://github.com/user-attachments/assets/f2b14aa6-dcbe-46a7-a2d5-a83097baa94d) After: ![Screenshot 2025-05-17 at 4 47 11 pm](https://github.com/user-attachments/assets/be42f794-d6e0-4b9f-8847-da733b3a3872) Signed-off-by: Aleksandr Motsjonov <[email protected]>
1 parent df84f27 commit 9b209ce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/iv/ivgl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ IvGL::shadowed_text(float x, float y, float /*z*/, const std::string& s,
690690
* Paint on intermediate QImage, AA text on QOpenGLWidget based
691691
* QPaintDevice requires MSAA
692692
*/
693-
QImage t(size(), QImage::Format_ARGB32_Premultiplied);
693+
qreal dpr = devicePixelRatio();
694+
QImage t(size() * dpr, QImage::Format_ARGB32_Premultiplied);
695+
t.setDevicePixelRatio(dpr);
694696
t.fill(qRgba(0, 0, 0, 0));
695697
{
696698
QPainter painter(&t);

0 commit comments

Comments
 (0)