diff options
author | Gunnar Sletta <gunnar@sletta.org> | 2014-09-08 12:38:02 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar@sletta.org> | 2014-09-11 10:34:55 +0200 |
commit | 63e6c9ada82dc8f16e705cef5f89292784b7ace4 (patch) | |
tree | 044713caa88606fd41ca0f599ac857255b87ea1f /src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | |
parent | 046cce32d9f818809382fcbbff0cfa4adfe8d3f7 (diff) |
Snap native glyphs to pixel grid in vertex shader.
The implementation relied on the full matrix, but did not
set the RequiresFullMatrix flag. Setting the flag would
have serious negative performance impact as it prevents
batching, so we solve it in the vertex shader instead.
Task-number: QTBUG-38702
Change-Id: I0c245ea9e18b0b29dd9e3073a2648a7f4e061685
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 16feafe02f..802c92be9f 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -128,28 +128,8 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf } } - if (state.isMatrixDirty()) { - QMatrix4x4 transform = state.modelViewMatrix(); - qreal xTranslation = transform(0, 3); - qreal yTranslation = transform(1, 3); - - // Remove translation and check identity to see if matrix is only translating. - // If it is, we can round the translation to make sure the text is pixel aligned, - // which is the only thing that works with GL_NEAREST filtering. Adding rotations - // and scales to native rendered text is not a prioritized use case, since the - // default rendering type is designed for that. - transform(0, 3) = 0.0; - transform(1, 3) = 0.0; - if (transform.isIdentity()) { - transform(0, 3) = qRound(xTranslation); - transform(1, 3) = qRound(yTranslation); - - transform = state.projectionMatrix() * transform; - program()->setUniformValue(m_matrix_id, transform); - } else { - program()->setUniformValue(m_matrix_id, state.combinedMatrix()); - } - } + if (state.isMatrixDirty()) + program()->setUniformValue(m_matrix_id, state.combinedMatrix()); } class QSG8BitTextMaskShader : public QSGTextMaskShader |