From: dooglus Date: Wed, 21 Mar 2007 01:54:19 +0000 (+0000) Subject: Partially fix 1684240: gets rid of most of the artifacts X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f92064888e35fb63bfb049c2c4ac2e165de78ea8;p=synfig.git Partially fix 1684240: gets rid of most of the artifacts git-svn-id: http://svn.voria.com/code@361 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp b/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp index 27364d7..8ee8920 100644 --- a/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp +++ b/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp @@ -95,14 +95,20 @@ LinearGradient::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(); } }