From f3811d84dcb407eb7c6915d524b3902b9535fb3e Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 22 Mar 2007 18:28:52 +0000 Subject: [PATCH] Fix 1684240 (as it applies to radial gradients): Radial Gradient layers suffer from the same problem as linear gradients. git-svn-id: http://svn.voria.com/code@366 1f10aa63-cdf2-0310-b900-c93c546f37ac --- .../trunk/src/modules/mod_gradient/radialgradient.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/synfig-core/trunk/src/modules/mod_gradient/radialgradient.cpp b/synfig-core/trunk/src/modules/mod_gradient/radialgradient.cpp index fe5738e..b3e892e 100644 --- a/synfig-core/trunk/src/modules/mod_gradient/radialgradient.cpp +++ b/synfig-core/trunk/src/modules/mod_gradient/radialgradient.cpp @@ -149,14 +149,20 @@ RadialGradient::color_func(const Point &point, float supersample)const if(dist+supersample*0.5>1.0) { - Color pool(gradient(dist,supersample*0.5).premult_alpha()*(1.0-(dist-supersample*0.5))); - pool+=gradient((dist+supersample*0.5)-1.0,supersample*0.5).premult_alpha()*((dist+supersample*0.5)-1.0); + float left(supersample*0.5-(dist-1.0)); + float right(supersample*0.5+(dist-1.0)); + Color pool(gradient(1.0-(left*0.5),left).premult_alpha()*left/supersample); + if (zigzag) pool+=gradient(1.0-right*0.5,right).premult_alpha()*right/supersample; + else pool+=gradient(right*0.5,right).premult_alpha()*right/supersample; return pool.demult_alpha(); } if(dist-supersample*0.5<0.0) { - Color pool(gradient(dist,supersample*0.5).premult_alpha()*(dist+supersample*0.5)); - pool+=gradient(1.0-(dist-supersample*0.5),supersample*0.5).premult_alpha()*(-(dist-supersample*0.5)); + float left(supersample*0.5-dist); + float right(supersample*0.5+dist); + Color pool(gradient(right*0.5,right).premult_alpha()*right/supersample); + if (zigzag) pool+=gradient(left*0.5,left).premult_alpha()*left/supersample; + else pool+=gradient(1.0-left*0.5,left).premult_alpha()*left/supersample; return pool.demult_alpha(); } } -- 2.7.4