diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 9376a4c..3a375b9 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -756,15 +756,14 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) path.setFillRule(Qt::WindingFill); #endif if (ti.glyphs.numGlyphs) - ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); + ti.fontEngine->addOutlineToPath(p.x(), p.y(), ti.glyphs, &path, ti.flags); if (!path.isEmpty()) { - painter()->save(); + bool oldAA = painter()->renderHints() & QPainter::Antialiasing; 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()->restore(); + painter()->setRenderHint(QPainter::Antialiasing, oldAA); } } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index fe17ace..e0fe599 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3095,7 +3095,37 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte #if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA)) - if (!supportsTransformations(ti.fontEngine)) { + bool drawCached = true; + + if (s->matrix.type() >= QTransform::TxProject) + drawCached = false; + + // don't try to cache huge fonts + const qreal pixelSize = ti.fontEngine->fontDef.pixelSize; + if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64) + drawCached = false; + + // ### Remove the TestFontEngine and Box engine crap, in these + // ### cases we should delegate painting to the font engine + // ### directly... + +#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) + QFontEngine::Type fontEngineType = ti.fontEngine->type(); + // qDebug() << "type" << fontEngineType << s->matrix.type(); + if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && s->matrix.type() > QTransform::TxTranslate) + || (s->matrix.type() <= QTransform::TxTranslate + && (fontEngineType == QFontEngine::TestFontEngine + || fontEngineType == QFontEngine::Box))) { + drawCached = false; + } +#else + if (s->matrix.type() > QTransform::TxTranslate) + drawCached = false; +#endif + + // if (!supportsTransformations(ti.fontEngine)) { + if (drawCached) { + QRasterPaintEngineState *s = state(); QVarLengthArray positions; QVarLengthArray glyphs;