From 87a8cdff9da146170699176dddceaa894c1adefc Mon Sep 17 00:00:00 2001 From: dooglus Date: Tue, 13 Jan 2009 15:44:10 +0000 Subject: [PATCH] Fix 2502818: Noise when refresh an imported image layer. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2329 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/layer_bitmap.cpp | 25 +++++++++++++------------ synfig-core/trunk/src/synfig/layer_bitmap.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/synfig-core/trunk/src/synfig/layer_bitmap.cpp b/synfig-core/trunk/src/synfig/layer_bitmap.cpp index fc395dc..cda5d09 100644 --- a/synfig-core/trunk/src/synfig/layer_bitmap.cpp +++ b/synfig-core/trunk/src/synfig/layer_bitmap.cpp @@ -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); diff --git a/synfig-core/trunk/src/synfig/layer_bitmap.h b/synfig-core/trunk/src/synfig/layer_bitmap.h index 4669092..b62a93e 100644 --- a/synfig-core/trunk/src/synfig/layer_bitmap.h +++ b/synfig-core/trunk/src/synfig/layer_bitmap.h @@ -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 Handle; -- 2.7.4