From 76fbb4379829e4ef9857be986587d10c1273bed6 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 9 Sep 2020 03:48:01 +0200 Subject: [PATCH] Reduce repeated Screens::scale(int) --- plugins/scenes/opengl/scene_opengl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 7dd1e36ce4..42d852d968 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -627,14 +627,15 @@ qint64 SceneOpenGL::paint(const QRegion &damage, const QList &toplev m_backend->prepareRenderingFrame(); for (int i = 0; i < screens()->count(); ++i) { const QRect &geo = screens()->geometry(i); + const qreal scaling = screens()->scale(i); QRegion update; QRegion valid; // prepare rendering makes context current on the output QRegion repaint = m_backend->prepareRenderingForScreen(i); GLVertexBuffer::setVirtualScreenGeometry(geo); GLRenderTarget::setVirtualScreenGeometry(geo); - GLVertexBuffer::setVirtualScreenScale(screens()->scale(i)); - GLRenderTarget::setVirtualScreenScale(screens()->scale(i)); + GLVertexBuffer::setVirtualScreenScale(scaling); + GLRenderTarget::setVirtualScreenScale(scaling); const GLenum status = glGetGraphicsResetStatus(); if (status != GL_NO_ERROR) { @@ -644,7 +645,8 @@ qint64 SceneOpenGL::paint(const QRegion &damage, const QList &toplev int mask = 0; updateProjectionMatrix(); - paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix(), geo, screens()->scale(i)); // call generic implementation + + paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix(), geo, scaling); // call generic implementation paintCursor(); GLVertexBuffer::streamingBuffer()->endOfFrame();