diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-01 11:31:18 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-01 12:03:17 (GMT) |
commit | ff57057bc6844eb3c10ab0eadff292a10ef493f8 (patch) | |
tree | 638f0272653e58cf0b29e510f40272fa7e797ede /tests/auto/qstatictext | |
parent | 6750d0dcbf5a2e88fab2e127dc3e057f0d68bf71 (diff) | |
download | Qt-ff57057bc6844eb3c10ab0eadff292a10ef493f8.zip Qt-ff57057bc6844eb3c10ab0eadff292a10ef493f8.tar.gz Qt-ff57057bc6844eb3c10ab0eadff292a10ef493f8.tar.bz2 |
Speed up QStaticText with affine transformation on GL2 engine
Since the OpenGL2 paint engine supports transforming the prerendered
glyphs rather than rasterizing the glyphs with the transformation
applied, we don't need to recalculate the QStaticText layout whenever
the transformation changes. This means that we can do fast animated
transforms for QStaticText on this paint engine. A quick test yields
something like 100x speed-up on Windows. This also give visually
better results, as we previously would animate the hinting of the
glyphs, thus causing jittering.
The autotest has been updated to reflect the fact that drawText() and
drawStaticText() now go through identical paths on GL, also when
transforms are set on the painter. However, the scale was changed in
one test, because it was so great that drawText() would fall back to
paths. With QStaticText the idea is speed, so you'll get a poor, but
fast result instead, which is better than tricking people.
Reviewed-by: Samuel
Diffstat (limited to 'tests/auto/qstatictext')
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index c7801ac..1d166f4 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -324,8 +324,7 @@ bool tst_QStaticText::supportsTransformations() const QPaintEngine::Type type = engine->type(); - if (type == QPaintEngine::OpenGL2 - || type == QPaintEngine::OpenGL + if (type == QPaintEngine::OpenGL #if !defined Q_WS_WIN || type == QPaintEngine::Raster #endif @@ -471,7 +470,7 @@ void tst_QStaticText::transformationChanged() p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - p.scale(7.0, 5.0); + p.scale(2.0, 2.5); p.drawText(QRectF(0, 0, 1000, 1000), 0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); } @@ -487,7 +486,7 @@ void tst_QStaticText::transformationChanged() p.drawStaticText(QPointF(0, 0), text); - p.scale(7.0, 5.0); + p.scale(2.0, 2.5); p.drawStaticText(QPointF(0, 0), text); } |