From ae548b56c0e940c2ed0b165c3d92304a3078eabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Niemel=C3=A4?= Date: Tue, 20 Mar 2012 11:19:26 +0200 Subject: 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 --- src/effects/ConicalGradient.qml | 5 ++--- 1 file 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; } " } -- cgit v1.2.3