summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-12-17 14:30:44 +0100
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-12-17 16:54:19 +0100
commit0e1016ef37b349b789014501b6640e959dfa0574 (patch)
treed53d2b48e82a57e23b28432f76564d6f8351abfb
parent89667cb4c330d97e73166dc71963cd08c8abde85 (diff)
Added grab() function in ShaderEffectSource.
Calling grab() on a ShaderEffectSource will force it to update its texture.
-rw-r--r--src/effects/shadereffectitem.cpp6
-rw-r--r--src/effects/shadereffectitem.h2
-rw-r--r--tests/effects.qml45
3 files changed, 53 insertions, 0 deletions
diff --git a/src/effects/shadereffectitem.cpp b/src/effects/shadereffectitem.cpp
index e19602e..de5bd83 100644
--- a/src/effects/shadereffectitem.cpp
+++ b/src/effects/shadereffectitem.cpp
@@ -501,6 +501,12 @@ void ShaderEffectSource::update()
m_dirtyTexture = false;
}
+void ShaderEffectSource::grab()
+{
+ m_dirtyTexture = true;
+ emit repaintRequired();
+}
+
void ShaderEffectSource::markSceneGraphDirty()
{
m_dirtySceneGraph = true;
diff --git a/src/effects/shadereffectitem.h b/src/effects/shadereffectitem.h
index 7667f65..15cfb54 100644
--- a/src/effects/shadereffectitem.h
+++ b/src/effects/shadereffectitem.h
@@ -136,6 +136,8 @@ public:
void derefFromEffectItem();
void update();
+ Q_INVOKABLE void grab();
+
Q_SIGNALS:
void sourceItemChanged();
void sourceImageChanged();
diff --git a/tests/effects.qml b/tests/effects.qml
index b6389bc..41d01d0 100644
--- a/tests/effects.qml
+++ b/tests/effects.qml
@@ -166,6 +166,7 @@ Rectangle {
drag.target.y = y
drag.target.z = 0
}
+ onClicked: { effectSource2.grab(); grabbedAnim2.restart() }
}
Item {
@@ -229,6 +230,20 @@ Rectangle {
text: effectSource2.hideOriginal ? "Hidden" : "Shown"
MouseArea { anchors.fill: parent; onClicked: { effectSource2.hideOriginal = !effectSource2.hideOriginal } }
}
+ Text {
+ anchors.centerIn: parent
+ color: "red"
+ font.pixelSize: 12
+ text: "Grabbed"
+ opacity: 0
+ SequentialAnimation on opacity {
+ id: grabbedAnim2
+ running: false
+ PropertyAction { value: 1 }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 1000 }
+ }
+ }
}
MouseArea {
@@ -264,6 +279,7 @@ Rectangle {
drag.target.y = y
drag.target.z = 0
}
+ onClicked: { effectSource3.grab(); grabbedAnim3.restart() }
}
Item {
@@ -326,6 +342,20 @@ Rectangle {
text: effectSource3.hideOriginal ? "Hidden" : "Shown"
MouseArea { anchors.fill: parent; onClicked: { effectSource3.hideOriginal = !effectSource3.hideOriginal } }
}
+ Text {
+ anchors.centerIn: parent
+ color: "red"
+ font.pixelSize: 12
+ text: "Grabbed"
+ opacity: 0
+ SequentialAnimation on opacity {
+ id: grabbedAnim3
+ running: false
+ PropertyAction { value: 1 }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 1000 }
+ }
+ }
}
MouseArea {
@@ -418,6 +448,7 @@ Rectangle {
drag.target.y = y
drag.target.z = 0
}
+ onClicked: { effectSource5.grab(); grabbedAnim5.restart() }
}
Item {
@@ -479,6 +510,20 @@ Rectangle {
text: effectSource5.hideOriginal ? "Hidden" : "Shown"
MouseArea { anchors.fill: parent; onClicked: { effectSource5.hideOriginal = !effectSource5.hideOriginal } }
}
+ Text {
+ anchors.centerIn: parent
+ color: "red"
+ font.pixelSize: 12
+ text: "Grabbed"
+ opacity: 0
+ SequentialAnimation on opacity {
+ id: grabbedAnim5
+ running: false
+ PropertyAction { value: 1 }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 1000 }
+ }
+ }
}
MouseArea {