summaryrefslogtreecommitdiffstats
path: root/src/openvg/qpaintengine_vg.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-19 23:00:02 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-19 23:00:02 (GMT)
commitbbbb62552b1c0f68b960c1412c66b6381e7dd4d1 (patch)
tree96d670a612de86e854480d403474238fe3e940c1 /src/openvg/qpaintengine_vg.cpp
parent02c15e6a8cdb0f8a0bb6ee36880877fe90334d69 (diff)
downloadQt-bbbb62552b1c0f68b960c1412c66b6381e7dd4d1.zip
Qt-bbbb62552b1c0f68b960c1412c66b6381e7dd4d1.tar.gz
Qt-bbbb62552b1c0f68b960c1412c66b6381e7dd4d1.tar.bz2
Optimize QVGPixmapDropShadowFilter by removing colorize step
Previously, the drop shadow was colorizing the incoming image and then blurring the colorized version. This change first blurs the image to an alpha-only VGImage and then uses that VGImage as a stencil to draw the drop shadow color. This way, there is only 1 filter step and a draw instead of 2 filter steps and a draw. The result is to make the performance of the drop shadow filter almost identical to the blur filter. Reviewed-by: trustme
Diffstat (limited to 'src/openvg/qpaintengine_vg.cpp')
-rw-r--r--src/openvg/qpaintengine_vg.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index fdd61ea..da07c1d 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -2872,6 +2872,24 @@ void qt_vg_drawVGImage(QPainter *painter, const QPointF& pos, VGImage vgImg)
drawVGImage(engine->vgPrivate(), pos, vgImg);
}
+// Used by qpixmapfilter_vg.cpp to draw filtered VGImage's as a stencil.
+void qt_vg_drawVGImageStencil
+ (QPainter *painter, const QPointF& pos, VGImage vgImg, const QBrush& brush)
+{
+ QVGPaintEngine *engine =
+ static_cast<QVGPaintEngine *>(painter->paintEngine());
+
+ QVGPaintEnginePrivate *d = engine->vgPrivate();
+
+ QTransform transform(d->imageTransform);
+ transform.translate(pos.x(), pos.y());
+ d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
+
+ d->ensureBrush(brush);
+ d->setImageMode(VG_DRAW_IMAGE_STENCIL);
+ vgDrawImage(vgImg);
+}
+
void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
QPixmapData *pd = pm.pixmapData();