From a71c7fce8ac536212d78b525a8a76e5c130362ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 22 Jan 2013 17:05:09 +0100 Subject: Don't assume m11/m22 represents the scale of a QTransform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can still assume it when pulling out the scale of the glyph cache, since we limit it to scaling, but when computing the scale from the current matrix we have to decompose it. We always use a positive scale in the glyph-cache, and let the drawing code take care of any flipping of the coordinates. Change-Id: Ie3c4f2d91008a9be8f89bef29c15d80b23fb8a82 Reviewed-by: Tor Arne Vestbø --- src/gui/opengl/qopenglpaintengine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 875fe4b4fb..68d9ad0a24 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1073,6 +1073,8 @@ bool QOpenGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGl { Q_Q(QOpenGL2PaintEngineEx); + Q_ASSERT(cache.transform().type() <= QTransform::TxScale); + QTransform &transform = q->state()->matrix; transform.scale(1.0 / cache.transform().m11(), 1.0 / cache.transform().m22()); bool ret = prepareForDraw(false); @@ -1557,7 +1559,11 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type // We allow scaling, so that the glyph-cache will contain glyphs with the // appropriate resolution in the case of displays with a device-pixel-ratio != 1. - QTransform transform = QTransform::fromScale(s->matrix.m11(), s->matrix.m22()); + QTransform transform = s->matrix.type() < QTransform::TxRotate ? + QTransform::fromScale(qAbs(s->matrix.m11()), qAbs(s->matrix.m22())) : + QTransform::fromScale( + QVector2D(s->matrix.m11(), s->matrix.m12()).length(), + QVector2D(s->matrix.m21(), s->matrix.m22()).length()); QOpenGLTextureGlyphCache *cache = (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, transform); -- cgit v1.2.3