From 80a230e221402e77c1ece2f1d37e4fe5755d26db Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 6 May 2011 10:25:20 +0200 Subject: [PATCH] Fix QPainter::drawGlyphs() with non-affine transformation When the matrix has an non-affine transformation, the text will have to be rendered using the default path-renderer. This means going through the drawTextItem() path (since drawStaticText() has no support for those transformations) and it also means not pre-transforming the coordinates, since the default implementation of drawTextItem() supports transformations. Task-number: QTBUG-18214 Reviewed-by: Jiang Jiang (cherry picked from commit 55446d104db77fc7994ab12352b1c08bb7b63346) --- src/gui/painting/qpainter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b7686fa7feb..016d4805268 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5811,6 +5811,13 @@ void QPainter::drawGlyphs(const QPointF &position, const QGlyphs &glyphs) d->extended != 0 ? qt_paintengine_supports_transformations(d->extended->type()) : qt_paintengine_supports_transformations(d->engine->type()); + + // If the matrix is not affine, the paint engine will fall back to + // drawing the glyphs as paths, which in turn means we should not + // preprocess the glyph positions + if (!d->state->matrix.isAffine()) + paintEngineSupportsTransformations = true; + for (int i=0; imatrix.isAffine()) { QStaticTextItem staticTextItem; staticTextItem.color = state->pen.color(); staticTextItem.font = state->font;