@@ -26,6 +26,7 @@ Item {
2626 property bool itemFocused: false
2727 property real maxAngle: 0
2828 property bool inverted: false
29+ property bool clipCorner: false
2930
3031 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
3132 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
@@ -143,6 +144,24 @@ Item {
143144 }
144145 }
145146
147+ Item {
148+ id: clipper
149+ anchors.centerIn: parent
150+ width: iconItem.width
151+ height: iconItem.height
152+ Rectangle {
153+ anchors {
154+ fill: parent
155+ topMargin: -units.gu(2)
156+ leftMargin: -units.gu(2)
157+ rightMargin: -units.gu(2)
158+ bottomMargin: units.gu(1.2)
159+ }
160+ color: "red"
161+ rotation: root.rotation + 45
162+ }
163+ }
164+
146165 ShaderEffect {
147166 id: transformEffect
148167 anchors.centerIn: parent
@@ -152,6 +171,7 @@ Item {
152171 property real itemOpacity: root.itemOpacity
153172 property real brightness: Math.max(-1, root.brightness)
154173 property real angle: root.angle
174+ property bool clipCorner: root.clipCorner
155175 rotation: root.inverted ? 180 : 0
156176
157177 property variant source: ShaderEffectSource {
@@ -160,6 +180,11 @@ Item {
160180 hideSource: true
161181 }
162182
183+ property var mask: ShaderEffectSource {
184+ sourceItem: clipper
185+ hideSource: true
186+ }
187+
163188 transform: [
164189 // Rotating 3 times at top/bottom because that increases the perspective.
165190 // This is a hack, but as QML does not support real 3D coordinates
@@ -194,13 +219,19 @@ Item {
194219 fragmentShader: "
195220 varying highp vec2 qt_TexCoord0;
196221 uniform sampler2D source;
222+ uniform sampler2D mask;
197223 uniform lowp float brightness;
198224 uniform lowp float itemOpacity;
225+ uniform bool clipCorner;
199226 void main(void)
200227 {
201228 highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
229+ highp vec4 maskColor = texture2D(mask, qt_TexCoord0);
202230 sourceColor.rgb = mix(sourceColor.rgb, vec3(step(0.0, brightness)), abs(brightness));
203231 sourceColor *= itemOpacity;
232+ if (clipCorner) {
233+ sourceColor *= maskColor.a;
234+ }
204235 gl_FragColor = sourceColor;
205236 }"
206237 }