diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-03-28 15:46:37 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2018-04-21 08:55:15 +0000 |
commit | 7b4254caccd3eee19d8116545d7022d1817e21fc (patch) | |
tree | abda458313d51330edd10687f54dcfba1b85ab94 /src | |
parent | 434f3e9a952b5858abc1f0ed1179ea5d2fca6a19 (diff) | |
download | qtwayland-7b4254caccd3eee19d8116545d7022d1817e21fc.tar.gz |
Compositor: Fix mapToSurface for surfaces with bufferScale != 1
Since QWaylandSurface::size (public API) returns the buffer size in pixels and
not the size in surface local coordinates, we need to also account for the
surface buffer_scale in order to get surface local coordinates.
Change-Id: I79a396c55b674b1ac42ca17e1e88e50c1506ce83
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 752e4a42..d4cc94e4 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -1013,8 +1013,8 @@ QPointF QWaylandQuickItem::mapToSurface(const QPointF &point) const if (!surface() || surface()->size().isEmpty()) return point / d->scaleFactor(); - qreal xScale = width() / surface()->size().width(); - qreal yScale = height() / surface()->size().height(); + qreal xScale = width() / surface()->size().width() * surface()->bufferScale(); + qreal yScale = height() / surface()->size().height() * surface()->bufferScale(); return QPointF(point.x() / xScale, point.y() / yScale); } |