summaryrefslogtreecommitdiffstats
path: root/src/gui/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/effects')
-rw-r--r--src/gui/effects/qgraphicseffect.cpp16
-rw-r--r--src/gui/effects/qgraphicseffect_p.h8
2 files changed, 20 insertions, 4 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 9ed003c..3a6bab5 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -101,6 +101,7 @@
#include <QtGui/qimage.h>
#include <QtGui/qpainter.h>
+#include <QtGui/qpaintengine.h>
#include <QtCore/qrect.h>
#include <QtCore/qdebug.h>
#include <private/qdrawhelper_p.h>
@@ -260,12 +261,13 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
}
QPixmap pm;
- if (d->m_cachedSystem == system)
+ if (d->m_cachedSystem == system && d->m_cachedMode == mode)
QPixmapCache::find(d->m_cacheKey, &pm);
if (pm.isNull()) {
pm = d->pixmap(system, &d->m_cachedOffset, mode);
d->m_cachedSystem = system;
+ d->m_cachedMode = mode;
d->invalidateCache();
d->m_cacheKey = QPixmapCache::insert(pm);
@@ -708,9 +710,13 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
return;
}
+ QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToEffectRectPadMode;
+ if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
+ mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode;
+
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
- const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset);
+ const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset, mode);
QTransform restoreTransform = painter->worldTransform();
painter->setWorldTransform(QTransform());
d->filter->draw(painter, offset, pixmap);
@@ -893,9 +899,13 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s
return;
}
+ QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToEffectRectPadMode;
+ if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
+ mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode;
+
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
- const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset);
+ const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset, mode);
QTransform restoreTransform = painter->worldTransform();
painter->setWorldTransform(QTransform());
d->filter->draw(painter, offset, pixmap);
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index dff84a1..1ed7103 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -66,7 +66,12 @@ class QGraphicsEffectSourcePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsEffectSource)
public:
- QGraphicsEffectSourcePrivate() : QObjectPrivate() {}
+ QGraphicsEffectSourcePrivate()
+ : QObjectPrivate()
+ , m_cachedSystem(Qt::DeviceCoordinates)
+ , m_cachedMode(QGraphicsEffectSource::ExpandToTransparentBorderPadMode)
+ {}
+
virtual ~QGraphicsEffectSourcePrivate() { invalidateCache(); }
virtual void detach() = 0;
virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0;
@@ -88,6 +93,7 @@ public:
private:
mutable Qt::CoordinateSystem m_cachedSystem;
+ mutable QGraphicsEffectSource::PixmapPadMode m_cachedMode;
mutable QPoint m_cachedOffset;
mutable QPixmapCache::Key m_cacheKey;
};