summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
diff options
context:
space:
mode:
authorLouai Al-Khanji <louai.al-khanji@digia.com>2014-05-05 16:36:37 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-07 18:01:37 +0200
commitbfa0d149f68eadf5cb1cd6eab8327850dc0bbbf9 (patch)
tree74df71f084f375e95ddc9b99c3e5fa6f8b42acbd /src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
parentfdcf66f10fd4f50f99c3a124626f6f4e6033a575 (diff)
Direct2D QPA: Speed up text rendering
After analysing text drawing performance two things seem to take up most of the time. The first is font lookup, the second is QVector initialization. To address the first point a per paint engine instance font cache is introduced. At the moment no mechanism exists to clear this cache and it is unbounded. To address the second point, we simply switch to using QVarLengthArray instead of QVector. In an artificial benchmark that draws text in a tight loop, the first change raised fps from ~70 to ~100. The second change further raised this number to ~115 fps. Change-Id: Iafa25c3e35bc42bd7c1582b0636e721c5193b494 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h')
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
index badd7a7688..fb9b7acec3 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
@@ -47,6 +47,7 @@
#include <d2d1_1.h>
#include <dwrite_1.h>
+#include <wrl.h>
QT_BEGIN_NAMESPACE
@@ -114,6 +115,8 @@ private:
bool antiAliasingEnabled() const;
void adjustForAliasing(QRectF *rect);
void adjustForAliasing(QPointF *point);
+
+ Microsoft::WRL::ComPtr<IDWriteFontFace> fontFaceFromFontEngine(const QFont &font, QFontEngine *fe);
};
QT_END_NAMESPACE