summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/effects/qgraphicseffect.cpp8
-rw-r--r--src/gui/effects/qgraphicseffect_p.h5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 62ad44d..50644ff 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -1008,6 +1008,10 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
return;
d->opacity = opacity;
+ if ((d->isFullyTransparent = qFuzzyIsNull(d->opacity)))
+ d->isFullyOpaque = 0;
+ else
+ d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
emit opacityChanged(opacity);
}
@@ -1065,11 +1069,11 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
Q_D(QGraphicsOpacityEffect);
// Transparent; nothing to draw.
- if (qFuzzyIsNull(d->opacity))
+ if (d->isFullyTransparent)
return;
// Opaque; draw directly without going through a pixmap.
- if (qFuzzyIsNull(d->opacity - 1)) {
+ if (d->isFullyOpaque && !d->hasOpacityMask) {
source->draw(painter);
return;
}
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index e0a77e7..c902b67 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -164,11 +164,14 @@ class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsOpacityEffect)
public:
- QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)), hasOpacityMask(0) {}
+ QGraphicsOpacityEffectPrivate()
+ : opacity(qreal(0.7)), isFullyTransparent(0), isFullyOpaque(0), hasOpacityMask(0) {}
~QGraphicsOpacityEffectPrivate() {}
qreal opacity;
QBrush opacityMask;
+ uint isFullyTransparent : 1;
+ uint isFullyOpaque : 1;
uint hasOpacityMask : 1;
};