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 6b940c1280)
icc-effect-5.20.5
Vlad Zahorodnii 2020-10-24 16:23:21 +00:00
parent f123990930
commit 9d2b27aebb
1 changed files with 2 additions and 1 deletions

View File

@ -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());