diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-03-27 15:32:16 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-03-27 15:28:23 +0000 |
commit | ddc43cdffaffe8e78b9bb9d8620dafdbe39971ae (patch) | |
tree | aeeea37861a5561c072053dc5513b8e2237e69b6 /src | |
parent | a833e6444eba97d3c762ce39aaaba5e9d57e3568 (diff) |
Update the shader when devicePixelRatio changes
Task-number: QTBUG-45076
Change-Id: I03de20da2e3f436339dcf48fc7d7d3d11a509577
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 10 |
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()); } |