Don't assume m11/m22 represents the scale of a QTransform
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ø <tor.arne.vestbo@digia.com>bb10
parent
d0c360fd88
commit
a71c7fce8a
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,8 @@ bool QGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGlyphC
|
|||
{
|
||||
Q_Q(QGL2PaintEngineEx);
|
||||
|
||||
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);
|
||||
|
|
@ -1594,7 +1596,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
|
|||
|
||||
// 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());
|
||||
|
||||
QFontEngine *fe = staticTextItem->fontEngine();
|
||||
QGLTextureGlyphCache *cache =
|
||||
|
|
|
|||
Loading…
Reference in New Issue