Commit 6b940c12 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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
parent 64b7cc3c
...@@ -585,8 +585,9 @@ void SceneOpenGL2::paintCursor() ...@@ -585,8 +585,9 @@ void SceneOpenGL2::paintCursor()
} }
// get cursor position in projection coordinates // get cursor position in projection coordinates
const qreal scale = cursor->image().devicePixelRatio();
const QPoint cursorPos = cursor->pos() - cursor->hotspot(); 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; QMatrix4x4 mvp = m_projectionMatrix;
mvp.translate(cursorPos.x(), cursorPos.y()); mvp.translate(cursorPos.x(), cursorPos.y());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment