diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-19 23:00:02 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-19 23:00:02 (GMT) |
commit | bbbb62552b1c0f68b960c1412c66b6381e7dd4d1 (patch) | |
tree | 96d670a612de86e854480d403474238fe3e940c1 /src/openvg/qpaintengine_vg.cpp | |
parent | 02c15e6a8cdb0f8a0bb6ee36880877fe90334d69 (diff) | |
download | Qt-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.cpp | 18 |
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(); |