Convert to device pixels when rendering an offscreen quick view

Rendering a texture needs to be done in device pixels, not logical
pixels.
This commit is contained in:
Arjen Hiemstra 2022-08-04 14:11:53 +02:00
parent 8a69432d76
commit 5a85ecd8c4

View file

@ -128,7 +128,7 @@ void SceneOpenGL::paintOffscreenQuickView(OffscreenQuickView *w)
} }
GLShader *shader = ShaderManager::instance()->pushShader(traits); GLShader *shader = ShaderManager::instance()->pushShader(traits);
const QRect rect = w->geometry(); const QRectF rect = scaledRect(w->geometry(), renderTargetScale());
QMatrix4x4 mvp(renderTargetProjectionMatrix()); QMatrix4x4 mvp(renderTargetProjectionMatrix());
mvp.translate(rect.x(), rect.y()); mvp.translate(rect.x(), rect.y());
@ -141,7 +141,7 @@ void SceneOpenGL::paintOffscreenQuickView(OffscreenQuickView *w)
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
t->bind(); t->bind();
t->render(w->geometry()); t->render(rect.toRect());
t->unbind(); t->unbind();
glDisable(GL_BLEND); glDisable(GL_BLEND);