diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-12-13 06:16:28 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-12-13 09:04:03 (GMT) |
commit | 18dfe6da07eb9ea7beb3cf2b0ea8291d62832efb (patch) | |
tree | 4e89c4f09bf6beca4b0b71f080c4d4e4315ba8d1 /src/gui/painting | |
parent | 954cbb597f322acbc5f023f22503311ce2fc791a (diff) | |
download | Qt-18dfe6da07eb9ea7beb3cf2b0ea8291d62832efb.zip Qt-18dfe6da07eb9ea7beb3cf2b0ea8291d62832efb.tar.gz Qt-18dfe6da07eb9ea7beb3cf2b0ea8291d62832efb.tar.bz2 |
Fix transformed QPainter::drawGlyphs() for certain paint engines
Support pretransforming glyph coordinates for paint engines that don't
expect untransformed coordinates.
Task-number: QTBUG-15605
Reviewed-by: Samuel
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 546861a..e8db049 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -151,6 +151,13 @@ static inline uint line_emulation(uint emulation) | QPaintEngine_OpaqueBackground); } +static bool qt_paintengine_supports_transformations(QPaintEngine::Type type) +{ + return type == QPaintEngine::OpenGL2 + || type == QPaintEngine::OpenVG + || type == QPaintEngine::OpenGL; +} + #ifndef QT_NO_DEBUG static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false) { @@ -5795,8 +5802,17 @@ void QPainter::drawGlyphs(const QPointF &position, const QGlyphs &glyphs) int count = qMin(glyphIndexes.size(), glyphPositions.size()); QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count); - for (int i=0; i<count; ++i) - fixedPointPositions[i] = QFixedPoint::fromPointF(position + glyphPositions.at(i)); + + bool paintEngineSupportsTransformations = + d->extended != 0 + ? qt_paintengine_supports_transformations(d->extended->type()) + : false; + for (int i=0; i<count; ++i) { + QPointF processedPosition = position + glyphPositions.at(i); + if (!paintEngineSupportsTransformations) + processedPosition = d->state->transform().map(processedPosition); + fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); + } d->drawGlyphs(glyphIndexes.data(), fixedPointPositions.data(), count); @@ -5988,10 +6004,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText return; } - bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2 - || d->extended->type() == QPaintEngine::OpenVG - || d->extended->type() == QPaintEngine::OpenGL; - + bool paintEngineSupportsTransformations = qt_paintengine_supports_transformations(d->extended->type()); if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; staticText_d->needsRelayout = true; |