summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorLouai Al-Khanji <louai.al-khanji@digia.com>2014-04-15 09:57:58 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-16 15:21:50 +0200
commit7d0f4dde0688ec65c34e7a5309257c840409a607 (patch)
tree504c8d2856956ba0c34033734c86a6120fbe4c91 /src/plugins/platforms
parentf961425256f2be8034029912239b331b25dca1c5 (diff)
Direct2D QPA: Optimize rectangle fills.
Detect rectangle hints in the QVectorPath and react accordingly. Change-Id: Ic72ce0c46d10e995c0824972854e2d88162eae45 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 1f2321e885..cabcda70ee 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -897,13 +897,25 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
if (!d->brush.brush)
return;
- ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
- if (!geometry) {
- qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
- return;
- }
+ if (path.hints() & QVectorPath::RectangleShapeMask) {
+ const qreal * const points = path.points();
+ D2D_RECT_F rect = {
+ points[0], // left
+ points[1], // top
+ points[2], // right,
+ points[5] // bottom
+ };
+
+ d->dc()->FillRectangle(rect, d->brush.brush.Get());
+ } else {
+ ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
+ if (!geometry) {
+ qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
+ return;
+ }
- d->dc()->FillGeometry(geometry.Get(), d->brush.brush.Get());
+ d->dc()->FillGeometry(geometry.Get(), d->brush.brush.Get());
+ }
}
// For clipping we convert everything to painter paths since it allows