Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed some Item.layer bugs and added auto-tests.
Change-Id: I3f66f911d1c499c37a66904f8ddab6951ba85e60 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
- Loading branch information
Kim Motoyoshi Kalland
authored and
Qt by Nokia
committed
Feb 7, 2012
1 parent
54a2a4e
commit a6eb091
Showing
9 changed files
with
362 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
width: 200 | ||
height: 200 | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
color: "red" | ||
layer.enabled: true | ||
Component.onCompleted: { | ||
layer.enabled = false | ||
visible = false | ||
width = 120 | ||
x = 10 | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/auto/qtquick2/qquickitemlayer/data/SamplerNameChange.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import QtQuick 2.0 | ||
|
||
Rectangle { | ||
width: 200 | ||
height: 200 | ||
color: "blue" | ||
layer.enabled: true | ||
layer.effect: ShaderEffect { | ||
fragmentShader: " | ||
uniform sampler2D foo; | ||
uniform lowp float qt_Opacity; | ||
varying highp vec2 qt_TexCoord0; | ||
void main() { | ||
gl_FragColor = texture2D(foo, qt_TexCoord0) * qt_Opacity; | ||
}" | ||
} | ||
Component.onCompleted: layer.samplerName = "foo" | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/auto/qtquick2/qquickitemlayer/data/ToggleLayerAndEffect.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
width: 200 | ||
height: 200 | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
color: "red" | ||
Component.onCompleted: { | ||
layer.enabled = true | ||
layer.effect = effectComponent | ||
layer.enabled = false | ||
visible = false | ||
width = 120 | ||
x = 10 | ||
} | ||
} | ||
Component { | ||
id: effectComponent | ||
ShaderEffect { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
width: 200 | ||
height: 200 | ||
property bool layerEffect: false | ||
property bool layerEnabled: false | ||
property real layerZ: 0 | ||
Rectangle { | ||
anchors.fill: parent | ||
color: "#00ffff" | ||
} | ||
Rectangle { | ||
id: foo | ||
anchors.fill: parent | ||
color: "#ffff00" | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
color: "#00ffff" | ||
} | ||
layer.enabled: parent.layerEnabled | ||
layer.effect: parent.layerEffect ? effectComponent : null | ||
opacity: 0.5 | ||
z: layerZ | ||
} | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
x: 100 | ||
color: "#ff0000" | ||
} | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
y: 100 | ||
color: "#0000ff" | ||
z: 1 | ||
} | ||
Component { | ||
id: effectComponent | ||
ShaderEffect { | ||
fragmentShader: " | ||
uniform sampler2D source; | ||
uniform lowp float qt_Opacity; | ||
varying highp vec2 qt_TexCoord0; | ||
void main() { gl_FragColor = texture2D(source, qt_TexCoord0).xzyw * qt_Opacity; }" | ||
} | ||
} | ||
} |
Oops, something went wrong.