aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-12-04 17:31:45 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-01-31 05:55:08 +0000
commit367c82b541ccb433a8b5ac3b26ad95b6d50769d2 (patch)
treeb9b7d843ef076a4d9d86f68cb8bd81978577a61f /src/imports
parentf42f1366dcd4b070c69c9e7fe42a704ef23da14d (diff)
Fix Shapes not playing well with QtGraphicalEffects
This patch allow shapes to skip the sync optimization in situations where the shape is added to a shader effect either directly or as nested inside another item, and is set to be invisible. Task-number: QTBUG-63105 Change-Id: I595fbc052032f420982be1267d22a24bcffb7212 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/shapes/qquickshape.cpp7
-rw-r--r--src/imports/shapes/qquickshape_p_p.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/imports/shapes/qquickshape.cpp b/src/imports/shapes/qquickshape.cpp
index c749357cc5..de49baed48 100644
--- a/src/imports/shapes/qquickshape.cpp
+++ b/src/imports/shapes/qquickshape.cpp
@@ -632,6 +632,7 @@ void QQuickShapePath::resetFillGradient()
QQuickShapePrivate::QQuickShapePrivate()
: spChanged(false),
+ effectRefCount(0),
rendererType(QQuickShape::UnknownRenderer),
async(false),
status(QQuickShape::Null),
@@ -857,10 +858,12 @@ void QQuickShape::updatePolish()
{
Q_D(QQuickShape);
- if (!d->spChanged)
+ const int currentEffectRefCount = d->extra.isAllocated() ? d->extra->recursiveEffectRefCount : 0;
+ if (!d->spChanged && currentEffectRefCount <= d->effectRefCount)
return;
d->spChanged = false;
+ d->effectRefCount = currentEffectRefCount;
if (!d->renderer) {
d->createRenderer();
@@ -872,7 +875,7 @@ void QQuickShape::updatePolish()
// endSync() is where expensive calculations may happen (or get kicked off
// on worker threads), depending on the backend. Therefore do this only
// when the item is visible.
- if (isVisible())
+ if (isVisible() || d->effectRefCount > 0)
d->sync();
update();
diff --git a/src/imports/shapes/qquickshape_p_p.h b/src/imports/shapes/qquickshape_p_p.h
index f43831516a..350c2756bb 100644
--- a/src/imports/shapes/qquickshape_p_p.h
+++ b/src/imports/shapes/qquickshape_p_p.h
@@ -171,6 +171,7 @@ public:
static void asyncShapeReady(void *data);
bool spChanged;
+ int effectRefCount;
QQuickShape::RendererType rendererType;
bool async;
QQuickShape::Status status;