Properly scale cursordelegate_opengl to device geometry
Rather than converting to logical to then later on convert back to device.
This commit is contained in:
parent
642bd06cef
commit
ada87dbc60
1 changed files with 4 additions and 3 deletions
|
@ -59,10 +59,11 @@ void CursorDelegateOpenGL::paint(RenderTarget *renderTarget, const QRegion ®i
|
|||
}
|
||||
|
||||
const QRect cursorRect = layer()->mapToGlobal(layer()->rect());
|
||||
const qreal scale = renderTarget->devicePixelRatio();
|
||||
|
||||
QMatrix4x4 mvp;
|
||||
mvp.ortho(QRect(QPoint(0, 0), renderTarget->size() / renderTarget->devicePixelRatio()));
|
||||
mvp.translate(cursorRect.x(), cursorRect.y());
|
||||
mvp.ortho(QRect(QPoint(0, 0), renderTarget->size()));
|
||||
mvp.translate(cursorRect.x() * scale, cursorRect.y() * scale);
|
||||
|
||||
// Don't need to call GLVertexBuffer::beginFrame() and GLVertexBuffer::endOfFrame() because
|
||||
// the GLVertexBuffer::streamingBuffer() is not being used when painting cursor.
|
||||
|
@ -72,7 +73,7 @@ void CursorDelegateOpenGL::paint(RenderTarget *renderTarget, const QRegion ®i
|
|||
m_cursorTexture->bind();
|
||||
ShaderBinder binder(ShaderTrait::MapTexture);
|
||||
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
m_cursorTexture->render(region, QRect(0, 0, cursorRect.width(), cursorRect.height()), renderTarget->devicePixelRatio());
|
||||
m_cursorTexture->render(region, QRect(0, 0, cursorRect.width(), cursorRect.height()), scale);
|
||||
m_cursorTexture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue