summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmapfilter.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-28 13:44:10 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-10-29 09:47:14 (GMT)
commit7d5b560f71e0f11c20b7ebef11f3095e760ca32c (patch)
treeac8397e1ff54344a5331da055c5707a90851ce68 /src/gui/image/qpixmapfilter.cpp
parentf5c553078b7381c3dff7d0bd6b9990a7acf86abb (diff)
downloadQt-7d5b560f71e0f11c20b7ebef11f3095e760ca32c.zip
Qt-7d5b560f71e0f11c20b7ebef11f3095e760ca32c.tar.gz
Qt-7d5b560f71e0f11c20b7ebef11f3095e760ca32c.tar.bz2
Added some optimizations to the blur and drop shadow GL filters.
* Use ExpandToTransparentBorderPadMode since we can use GL_CLAMP_TO_EDGE to clamp to the texture. * Shrink the bounding rects reported by the blur and drop shadow filters (expanding by 2 * radius isn't needed). * Use a single-pass blur for radii <= 3 to avoid the overhead of rendering to an FBO. * Made the fast blur setting generate filters for only a predefined set of radii, and then use the actual blur radius to spread the sample points outwards. * Optimized the generated program to rely less on temporary variables, as those seemed to not be handled very well by certain GLSL compilers. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/image/qpixmapfilter.cpp')
-rw-r--r--src/gui/image/qpixmapfilter.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index f9ac79f..d0de03e 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -584,7 +584,7 @@ Qt::RenderHint QPixmapBlurFilter::blurHint() const
QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const
{
Q_D(const QPixmapBlurFilter);
- const qreal delta = d->radius * 2;
+ const qreal delta = d->radius + 1;
return rect.adjusted(-delta, -delta, delta, delta);
}
@@ -1057,14 +1057,9 @@ void QPixmapDropShadowFilter::setOffset(const QPointF &offset)
QRectF QPixmapDropShadowFilter::boundingRectFor(const QRectF &rect) const
{
Q_D(const QPixmapDropShadowFilter);
-
- const qreal delta = qreal(d->radius * 2);
- qreal x1 = qMin(rect.left(), rect.left() + d->offset.x() - delta);
- qreal y1 = qMin(rect.top(), rect.top() + d->offset.y() - delta);
- qreal x2 = qMax(rect.right(), rect.right() + d->offset.x() + delta);
- qreal y2 = qMax(rect.bottom(), rect.bottom() + d->offset.y() + delta);
-
- return QRectF(x1, y1, x2 - x1, y2 - y1);
+ qreal delta = d->radius + 1;
+ return rect.adjusted(-2, -2, 2, 2).united(
+ rect.translated(d->offset).adjusted(-delta, -delta, delta, delta));
}
/*!