From 7b4254caccd3eee19d8116545d7022d1817e21fc Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Mar 2018 15:46:37 +0200 Subject: 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 --- src/compositor/compositor_api/qwaylandquickitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 752e4a423..d4cc94e4b 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); } -- cgit v1.2.3