summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2023-04-18 12:57:03 +0200
committerDavid Schulz <david.schulz@qt.io>2023-04-25 09:00:24 +0000
commitc818acda97a7dc9f184e96fac4a0adbc56e1359e (patch)
tree1a6c6987a1bc7e7279158e713c510235b0f234f0 /src/widgets
parent0d26db57375d0f2819a4999890f61d66d733b879 (diff)
downloadqtbase-c818acda97a7dc9f184e96fac4a0adbc56e1359e.tar.gz
Improve style drawing under DPR scaling further
Rounding distances up can result in coordinates outside of the clip rect. So stick to always round distances down when we multiply a scaling. Fixes: QTBUG-109640 Pick-to: 6.5 Change-Id: I784b7c90da9b6e7f5a925d4275eb67497616001d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qdrawutil.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index bfffeecb6b..d04ed74dd0 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -230,8 +230,8 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
midLineWidth = qRound(devicePixelRatio * midLineWidth);
p->translate(0.5, 0.5);
@@ -346,8 +346,8 @@ void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
p->translate(0.5, 0.5);
isTranslated = true;
@@ -443,8 +443,8 @@ static void qDrawWinShades(QPainter *p,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
p->translate(0.5, 0.5);
isTranslated = true;
}
@@ -590,8 +590,8 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
p->translate(0.5, 0.5);
}