on xenial help sign in
Make the OpenEffect non-live by default to improve performance. Fixes: https://bugs.launchpad.net/bugs/1124584.
5993b18Michał Sawicz
Components/OpenEffect.qml+9−1
@@ -19,11 +19,13 @@ import QtQuick 2.0
19Item {
19Item {
20 id: effect
20 id: effect
21 property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx
21 property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx
22+ property alias live: effectSource.live
22 property Item sourceItem
23 property Item sourceItem
23 property ShaderEffectSource source: ShaderEffectSource {
24 property ShaderEffectSource source: ShaderEffectSource {
25+ id: effectSource
24 sourceItem: effect.enabled ? effect.sourceItem : null
26 sourceItem: effect.enabled ? effect.sourceItem : null
25 hideSource: effect.enabled
27 hideSource: effect.enabled
26− live: effect.enabled
28+ live: false
27 sourceRect: {
29 sourceRect: {
28 if (effect.enabled) {
30 if (effect.enabled) {
29 Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow)
31 Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow)
@@ -33,6 +35,8 @@ Item {
33 }
35 }
34 }
36 }
35
37
38+ onEnabledChanged: if (!live && enabled) scheduleUpdate()
39+
36 /*!
40 /*!
37 \qmlproperty real positionPx
41 \qmlproperty real positionPx
38 The y coordinate of where to perform the split.
42 The y coordinate of where to perform the split.
@@ -60,6 +64,10 @@ Item {
60
64
61 property real __roundedPositionPx: Math.round(positionPx)
65 property real __roundedPositionPx: Math.round(positionPx)
62
66
67+ function scheduleUpdate() {
68+ source.scheduleUpdate();
69+ }
70+
63 ShaderEffect {
71 ShaderEffect {
64 id: top
72 id: top
65 visible: effect.enabled
73 visible: effect.enabled
tests/qmltests/Components/tst_OpenEffect.qml+1−1
@@ -28,7 +28,7 @@ TestCase {
28 function test_openeffect_shadereffectsource() {
28 function test_openeffect_shadereffectsource() {
29 compare(openEffect1.source.hideSource, true, "OpenEffect ShaderEffectSource is incorrect")
29 compare(openEffect1.source.hideSource, true, "OpenEffect ShaderEffectSource is incorrect")
30 compare(openEffect1.source.sourceItem, rectangle2, "OpenEffect ShaderEffectSource is incorrect")
30 compare(openEffect1.source.sourceItem, rectangle2, "OpenEffect ShaderEffectSource is incorrect")
31− compare(openEffect1.source.live, true, "OpenEffect ShaderEffectSource is incorrect")
31+ compare(openEffect1.source.live, false, "OpenEffect ShaderEffectSource is incorrect")
32 compare(openEffect1.source.sourceRect.x, 0, "OpenEffect ShaderEffectSource is incorrect")
32 compare(openEffect1.source.sourceRect.x, 0, "OpenEffect ShaderEffectSource is incorrect")
33 compare(openEffect1.source.sourceRect.y, 0, "OpenEffect ShaderEffectSource is incorrect")
33 compare(openEffect1.source.sourceRect.y, 0, "OpenEffect ShaderEffectSource is incorrect")
34 compare(openEffect1.source.sourceRect.width, 50, "OpenEffect ShaderEffectSource is incorrect")
34 compare(openEffect1.source.sourceRect.width, 50, "OpenEffect ShaderEffectSource is incorrect")