aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarko Niemelä <marko.a.niemela@nokia.com>2012-03-20 11:19:26 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-23 08:51:26 +0100
commitae548b56c0e940c2ed0b165c3d92304a3078eabf (patch)
tree1f0277f72d376a38030347cf3453ec9dabbbd967
parent8bc1961765f0c3361a97cdb7209a888181930caa (diff)
ConicalGradient modified to produce sharp gradient edge.
Previously ConicalGradient produced smooth antialiased transition between gradient position 1.0 and 0.0. However this suffered from accuracy problem and transition was spreading more at pixels that were far away from the gradient center. Thus is is better to produce sharp consistent transition. Anti-aliased look can still be achieved by defining the gradient steps and colors in suitable way near the 1.0 position. Change-Id: I67040c5c56fdf855fe68d9b3f0d9fde0cc37b59f Reviewed-by: Kim Gronholm <kim.1.gronholm@nokia.com>
-rw-r--r--src/effects/ConicalGradient.qml5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/effects/ConicalGradient.qml b/src/effects/ConicalGradient.qml
index f0b2f6b..d1cfa6b 100644
--- a/src/effects/ConicalGradient.qml
+++ b/src/effects/ConicalGradient.qml
@@ -84,7 +84,6 @@ Item {
sourceItem: gradientRect
smooth: true
hideSource: true
- wrapMode: ShaderEffectSource.Repeat
visible: false
}
property variant maskSource: maskSourceProxy.output
@@ -108,7 +107,7 @@ Item {
const highp float PI = 3.14159265;
const highp float PIx2inv = 0.1591549;
highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- gl_FragColor = texture2D(gradientSource, vec2(0.0, a)) * qt_Opacity;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity;
}
"
@@ -125,7 +124,7 @@ Item {
const highp float PI = 3.14159265;
const highp float PIx2inv = 0.1591549;
highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv;
- gl_FragColor = texture2D(gradientSource, vec2(0.0, a)) * maskAlpha * qt_Opacity;
+ gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity;
}
"
}