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>
This commit is contained in:
parent
f961425256
commit
7d0f4dde06
@ -897,6 +897,17 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
|
|||||||
if (!d->brush.brush)
|
if (!d->brush.brush)
|
||||||
return;
|
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);
|
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
|
||||||
if (!geometry) {
|
if (!geometry) {
|
||||||
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
|
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
|
||||||
@ -904,6 +915,7 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
// For clipping we convert everything to painter paths since it allows
|
||||||
|
Loading…
Reference in New Issue
Block a user