summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2017-11-05 16:18:54 +0100
committerBłażej Szczygieł <spaz16@wp.pl>2017-11-08 15:45:40 +0000
commit7d10936443750b8b0c90bf1c979ad6ab51eb92a7 (patch)
tree750ae6130ab679d33656b324ce390ce48851787e /src
parentdfdd99fc123ee80e162f0c14b4687fa00a328215 (diff)
Fix QHighDpi::fromNativeLocalExposedRegion rounding errors
Ceiling width/height fails to take into account rects that do no have their top left position on an exact point boundary. Example: QRect(0,0 20x20) and QRect(1,1 20x20) with scale 2.0 would give the same result of QRect(0,0 10x10). The correct rects are QRect(0,0 10x10) and QRect(0,0 11x11), so that we are sure to repaint all pixels within the exposed region. Before 5138fada0b9c, rects were also rounded incorrectly. The old method would give the result of QRect(0,0 11x11) in both cases, causing the exposed region to be larger than a window. Amends 5138fada0b9ce3968b23ec11df5f0d4e67544c43 Task-number: QTBUG-63943 Change-Id: I9f3dddf649bdc506c23bce1b6704860d61481459 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 0a060a2d2c..83fc9452c5 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -402,7 +402,8 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const QPointF topLeftP = rect.topLeft() / scaleFactor;
const QSizeF sizeP = rect.size() / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
- QSize(qCeil(sizeP.width()), qCeil(sizeP.height())));
+ QPoint(qCeil(topLeftP.x() + sizeP.width() - 1.0),
+ qCeil(topLeftP.y() + sizeP.height() - 1.0)));
}
return pointRegion;
}