From 5eae605a475db96ed16d81101e00e736efe9f202 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 20 Mar 2013 15:40:49 +0100 Subject: Fix distance field antialiasing for retina displays. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I01d7d41a4e70822555bae453978dbe92fbb5c98d Reviewed-by: Morten Johan Sørvig Reviewed-by: Yoann Lopes --- src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp') diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index d3a8614b11..d409cea81a 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include QT_BEGIN_NAMESPACE @@ -115,7 +117,6 @@ void QSGDistanceFieldTextMaterialShader::updateAlphaRange(ThresholdFunc threshol float combinedScale = m_fontScale * m_matrixScale; float base = thresholdFunc(combinedScale); float range = spreadFunc(combinedScale); - float alphaMin = qMax(0.0f, base - range); float alphaMax = qMin(base + range, 1.0f); program()->setUniformValue(m_alphaMin_id, GLfloat(alphaMin)); @@ -157,7 +158,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q } if (state.isMatrixDirty()) { program()->setUniformValue(m_matrix_id, state.combinedMatrix()); - m_matrixScale = qSqrt(qAbs(state.determinant())); + m_matrixScale = qSqrt(qAbs(state.determinant())) * state.devicePixelRatio(); updateRange = true; } if (updateRange) { -- cgit v1.2.3