diff options
author | Phan Quang Minh <phanquangminh217@gmail.com> | 2023-05-28 22:07:47 +0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-29 00:34:43 +0000 |
commit | b78a04de386b3a14c8973073f2cd3a3d695114b2 (patch) | |
tree | d403864657b49a5170e1b362b3fd43e3f306a9e4 | |
parent | 4ad977719e10d04645d7d01bbfb28d0c17dca200 (diff) |
Don't floor device scale in `QWaylandShmBuffer::imageInsideMargins`
The offset of the drawing target returned from
QWaylandShmBackingStore::contentSurface() is incorrectly calculated due
to `mImage.devicePixelRatio()` being casted to `int` inside
`imageInsideMargins`, which causes the scale to be rounded down in case
of fractional scaled displays. This causes the window contents to be
incorrectly positioned on CSD-requiring compositors (e.g. GNOME),
eventually resulting in graphics corruption due to mismatched damage and
opaque regions.
Fix this by removing the incorrect `int` cast.
Change-Id: I436d24522d23888b641cb21403f773e8ea113b8d
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit becc8fdaaeb5cd715a6ac84d007198de877e256e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/client/qwaylandshmbackingstore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index b9bfc9c81..d38d8f049 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -106,7 +106,7 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn) { - QMargins margins = marginsIn * int(mImage.devicePixelRatio()); + QMargins margins = marginsIn * mImage.devicePixelRatio(); if (!margins.isNull() && margins != mMargins) { if (mMarginsImage) { |