on xenial help sign in
Make the OpenEffect non-live by default to improve performance. Fixes: https://bugs.launchpad.net/bugs/1124584.

Approved by PS Jenkins bot, Nicolas d'Offay.

commit5993b186af3ff1dfd4f2969d8ee49c9deb2d9b3a authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 10 Jul 2013, 11:31 (13 years ago) parente646c822cb3f42
2 files changed+10−2
Components/OpenEffect.qml+9−1 tests/qmltests/Components/tst_OpenEffect.qml+1−1
Components/OpenEffect.qml+9−1
@@ -19,11 +19,13 @@ import QtQuick 2.0
1919Item {
2020 id: effect
2121 property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx
22+ property alias live: effectSource.live
2223 property Item sourceItem
2324 property ShaderEffectSource source: ShaderEffectSource {
25+ id: effectSource
2426 sourceItem: effect.enabled ? effect.sourceItem : null
2527 hideSource: effect.enabled
26− live: effect.enabled
28+ live: false
2729 sourceRect: {
2830 if (effect.enabled) {
2931 Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow)
@@ -33,6 +35,8 @@ Item {
3335 }
3436 }
3537
38+ onEnabledChanged: if (!live && enabled) scheduleUpdate()
39+
3640 /*!
3741 \qmlproperty real positionPx
3842 The y coordinate of where to perform the split.
@@ -60,6 +64,10 @@ Item {
6064
6165 property real __roundedPositionPx: Math.round(positionPx)
6266
67+ function scheduleUpdate() {
68+ source.scheduleUpdate();
69+ }
70+
6371 ShaderEffect {
6472 id: top
6573 visible: effect.enabled
tests/qmltests/Components/tst_OpenEffect.qml+1−1
@@ -28,7 +28,7 @@ TestCase {
2828 function test_openeffect_shadereffectsource() {
2929 compare(openEffect1.source.hideSource, true, "OpenEffect ShaderEffectSource is incorrect")
3030 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")
3232 compare(openEffect1.source.sourceRect.x, 0, "OpenEffect ShaderEffectSource is incorrect")
3333 compare(openEffect1.source.sourceRect.y, 0, "OpenEffect ShaderEffectSource is incorrect")
3434 compare(openEffect1.source.sourceRect.width, 50, "OpenEffect ShaderEffectSource is incorrect")