aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index ffee43852d..102985f2c7 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -92,6 +92,7 @@ protected:
int m_matrix_id;
int m_color_id;
int m_textureScale_id;
+ float m_devicePixelRatio;
QFontEngine::GlyphFormat m_glyphFormat;
};
@@ -121,7 +122,8 @@ void QSGTextMaskShader::initialize()
m_matrix_id = program()->uniformLocation("matrix");
m_color_id = program()->uniformLocation("color");
m_textureScale_id = program()->uniformLocation("textureScale");
- program()->setUniformValue("dpr", (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext()));
+ m_devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ program()->setUniformValue("dpr", m_devicePixelRatio);
}
void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
@@ -149,6 +151,12 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf
}
}
+ float devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ if (m_devicePixelRatio != devicePixelRatio) {
+ m_devicePixelRatio = devicePixelRatio;
+ program()->setUniformValue("dpr", m_devicePixelRatio);
+ }
+
if (state.isMatrixDirty())
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
}