Fix 2502818: Noise when refresh an imported image layer.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 13 Jan 2009 15:44:10 +0000 (15:44 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 13 Jan 2009 15:44:10 +0000 (15:44 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2329 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/layer_bitmap.cpp
synfig-core/trunk/src/synfig/layer_bitmap.h

index fc395dc..cda5d09 100644 (file)
@@ -165,16 +165,14 @@ Layer_Bitmap::hit_check(synfig::Context context, const synfig::Point &pos)const
 
 inline
 const Color&
-synfig::Layer_Bitmap::filter(const Color& c)const
+synfig::Layer_Bitmap::filter(Color& x)const
 {
-       if(gamma_adjust==1.0)
-               return c;
-       static Color x;
-       x=c;
-
-       x.set_r(powf((float)x.get_r(),gamma_adjust));
-       x.set_g(powf((float)x.get_g(),gamma_adjust));
-       x.set_b(powf((float)x.get_b(),gamma_adjust));
+       if(gamma_adjust!=1.0)
+       {
+               x.set_r(powf((float)x.get_r(),gamma_adjust));
+               x.set_g(powf((float)x.get_g(),gamma_adjust));
+               x.set_b(powf((float)x.get_b(),gamma_adjust));
+       }
        return x;
 }
 
@@ -458,7 +456,8 @@ Layer_Bitmap::accelerated_render(Context context,Surface *out_surface,int qualit
                        inx = inx_start;
                        for(x = x_start; x < x_end; x++, pen.inc_x(), inx += indx)
                        {
-                               pen.put_value(filter(surface.linear_sample(inx,iny)));
+                               Color col(surface.linear_sample(inx,iny));
+                               pen.put_value(filter(col));
                        }
                        pen.dec_x(x_end-x_start);
 
@@ -483,7 +482,8 @@ Layer_Bitmap::accelerated_render(Context context,Surface *out_surface,int qualit
                        inx = inx_start;
                        for(x = x_start; x < x_end; x++, pen.inc_x(), inx += indx)
                        {
-                               pen.put_value(filter(surface.cosine_sample(inx,iny)));
+                               Color col(surface.cosine_sample(inx,iny));
+                               pen.put_value(filter(col));
                        }
                        pen.dec_x(x_end-x_start);
 
@@ -507,7 +507,8 @@ Layer_Bitmap::accelerated_render(Context context,Surface *out_surface,int qualit
                        inx = inx_start;
                        for(x = x_start; x < x_end; x++, pen.inc_x(), inx += indx)
                        {
-                               pen.put_value(filter(surface.cubic_sample(inx,iny)));
+                               Color col(surface.cubic_sample(inx,iny));
+                               pen.put_value(filter(col));
                        }
                        pen.dec_x(x_end-x_start);
 
index 4669092..b62a93e 100644 (file)
@@ -43,7 +43,7 @@ namespace synfig {
 */
 class Layer_Bitmap : public Layer_Composite, public Layer_NoDeform
 {
-       const Color& filter(const Color& c)const;
+       const Color& filter(Color& c)const;
 public:
        typedef etl::handle<Layer_Bitmap> Handle;