Generate glyphs in un-transformed coordinate system.
authorSamuel Rødal <samuel.rodal@nokia.com>
Fri, 2 Sep 2011 11:48:26 +0000 (13:48 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 20 Sep 2011 10:00:33 +0000 (12:00 +0200)
Avoids rounding issues with very large coordinates.

Task-number: QTBUG-21262 - QRasterPaintEngine & QFontEngineFT - fonts corrupted when scrolling to the bottom of long texts
Reviewed-by: Eskil
Signed-off-by: Aleksandar Stojiljkovic <aleksandar.stojiljkovic@nokia.com>
(cherry picked from commit 43e013e2048e8193e2d31276cac6348a9f6ce340)

Change-Id: I5810a1a60f2bbdba4889a6b5e493b183018f3976
Reviewed-on: http://codereview.qt-project.org/5202
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
src/gui/painting/qpaintengine.cpp

index f64bd52..2545cc7 100644 (file)
@@ -756,14 +756,15 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
     path.setFillRule(Qt::WindingFill);
 #endif
     if (ti.glyphs.numGlyphs)
-        ti.fontEngine->addOutlineToPath(p.x(), p.y(), ti.glyphs, &path, ti.flags);
+        ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags);
     if (!path.isEmpty()) {
-        bool oldAA = painter()->renderHints() & QPainter::Antialiasing;
+        painter()->save();
         painter()->setRenderHint(QPainter::Antialiasing,
                                  bool((painter()->renderHints() & QPainter::TextAntialiasing)
                                       && !(painter()->font().styleStrategy() & QFont::NoAntialias)));
+        painter()->translate(p.x(), p.y());
         painter()->fillPath(path, state->pen().brush());
-        painter()->setRenderHint(QPainter::Antialiasing, oldAA);
+        painter()->restore();
     }
 }