Proper geometry conversion for devicePixelRatio > 1

Rounding the bottom right corner position means that the size
can change when the window moves. For windows we need
to round the size up in order to have a stable geometry.

Task-number: QTBUG-45076
Change-Id: I9a85a5915bfec55b0a7295be137b6fbfd7b53095
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Paul Olav Tvete 2015-02-25 15:42:03 +01:00
parent 2e4a107e7e
commit 667f3abc50
1 changed files with 6 additions and 1 deletions

View File

@ -155,6 +155,11 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr)
return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr);
}
static inline QSize dpr_ceil(const QSize &s, int dpr)
{
return QSize((s.width() + dpr - 1) / dpr, (s.height() + dpr - 1) / dpr);
}
static inline QRect mapExposeFromNative(const QRect &xRect, int dpr)
{
return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr));
@ -162,7 +167,7 @@ static inline QRect mapExposeFromNative(const QRect &xRect, int dpr)
static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr)
{
return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr);
return QRect(xRect.topLeft() / dpr, dpr_ceil(xRect.size(), dpr));
}
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w