@@ -27,6 +27,7 @@ Item {
2727 property bool itemFocused: false
2828 property real maxAngle: 0
2929 property bool inverted: false
30+ property bool clipCorner: false
3031
3132 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
3233 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
@@ -150,6 +151,22 @@ Item {
150151 }
151152 }
152153
154+ Item {
155+ id: clipper
156+ anchors.fill: parent
157+ Rectangle {
158+ anchors {
159+ fill: parent
160+ topMargin: -units.gu(2)
161+ leftMargin: -units.gu(2)
162+ rightMargin: -units.gu(2)
163+ bottomMargin: units.gu(1)
164+ }
165+ color: "red"
166+ rotation: root.rotation + 45
167+ }
168+ }
169+
153170 ShaderEffect {
154171 id: transformEffect
155172 anchors.centerIn: parent
@@ -159,6 +176,7 @@ Item {
159176 property real itemOpacity: root.itemOpacity
160177 property real brightness: Math.max(-1, root.brightness)
161178 property real angle: root.angle
179+ property bool clipCorner: root.clipCorner
162180 rotation: root.inverted ? 180 : 0
163181
164182 property variant source: ShaderEffectSource {
@@ -168,6 +186,11 @@ Item {
168186 live: false
169187 }
170188
189+ property var mask: ShaderEffectSource {
190+ sourceItem: clipper
191+ hideSource: true
192+ }
193+
171194 transform: [
172195 // Rotating 3 times at top/bottom because that increases the perspective.
173196 // This is a hack, but as QML does not support real 3D coordinates
@@ -202,13 +225,19 @@ Item {
202225 fragmentShader: "
203226 varying highp vec2 qt_TexCoord0;
204227 uniform sampler2D source;
228+ uniform sampler2D mask;
205229 uniform lowp float brightness;
206230 uniform lowp float itemOpacity;
231+ uniform bool clipCorner;
207232 void main(void)
208233 {
209234 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
235+ highp vec4 maskColor = texture2D(mask, qt_TexCoord0);
210236 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
211237 sourceColor *= itemOpacity;
238+ if (clipCorner) {
239+ sourceColor *= maskColor.a;
240+ }
212241 gl_FragColor = sourceColor;
213242 }"
214243 }