From 9d2b27aebb862ed6ad3fa88760efd49369a4e4ae Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 24 Oct 2020 16:23:21 +0000 Subject: [PATCH] scenes/opengl: Properly render cursors with hidpi GLTexture::width() and GLTexture::height() return the size of the cursor texture in native pixels, but we need a size in device independent pixels. CCBUG: 424589 (cherry picked from commit 6b940c128019823034d872cc7ae717330d92d43f) --- plugins/scenes/opengl/scene_opengl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 79f3445784..7916a42e34 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -585,8 +585,9 @@ void SceneOpenGL2::paintCursor() } // get cursor position in projection coordinates + const qreal scale = cursor->image().devicePixelRatio(); const QPoint cursorPos = cursor->pos() - cursor->hotspot(); - const QRect cursorRect(0, 0, m_cursorTexture->width(), m_cursorTexture->height()); + const QRect cursorRect(QPoint(0, 0), m_cursorTexture->size() / scale); QMatrix4x4 mvp = m_projectionMatrix; mvp.translate(cursorPos.x(), cursorPos.y());