Author: Carlos Lopez <genet...@gmail.com>
Date:   Fri Apr 19 20:53:11 2013 +0200

Fix bug #384: Blur layer is broken in tile mode and Cairo.
the horizontal and vertical box blurs, used in Fast Gaussian, Box, and Cross 
blurs, didn't take in consideration to convert the value types to accumulator 
types when doing the operations for blur.

---

 ETL/ETL/_boxblur.h |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/ETL/ETL/_boxblur.h b/ETL/ETL/_boxblur.h
index c043dc3..7a713b4 100644
--- a/ETL/ETL/_boxblur.h
+++ b/ETL/ETL/_boxblur.h
@@ -51,17 +51,21 @@ hbox_blur(T1 pen,int w, int h, int length, T2 outpen)
                iter=pen.x();
                end=pen.end_x();
 
-               typename T1::accumulator_type tot(*iter*(length+1));
+               typename T1::accumulator_type tot((typename 
T1::accumulator_type)(*iter)*(length+1));
 
                for (x=0;x<length && iter!=end;x++,++iter) tot+=*iter;
                iter=pen.x();
 
                for (x=0;x<w && iter!=end;x++,++iter,outpen.inc_x())
                {
-                       tot -= (x>length) ? iter[-length-1] : *pen.x();
-                       tot += ((x+length)<w) ? iter[length] : end[-1];
-
-                       outpen.put_value(tot*divisor);
+                       tot -= (x>length) ?
+                               (typename 
T1::accumulator_type)(iter[-length-1]) :
+                               (typename T1::accumulator_type)(*pen.x());
+                       tot += ((x+length)<w) ?
+                               (typename T1::accumulator_type)(iter[length]) :
+                               (typename T1::accumulator_type)(end[-1]);
+                                                                         
+                       outpen.put_value((typename 
T2::value_type)(tot*divisor));
                }
                outpen.dec_x(x);
        }
@@ -82,17 +86,21 @@ vbox_blur(T1 pen,const int w, const int h, int length, T2 
outpen)
                iter=pen.y();
                end=pen.end_y();
 
-               typename T1::accumulator_type tot(*iter*(length+1));
+               typename T1::accumulator_type tot((typename 
T1::accumulator_type)(*iter)*(length+1));
 
                for (y=0;y<length && iter!=end;y++,++iter) tot+=*iter;
                iter=pen.y();
 
                for (y=0;y<h && iter!=end;y++,++iter,outpen.inc_y())
                {
-                       tot -= (y>length) ? iter[-length-1] : *pen.y();
-                       tot += ((y+length)<h) ? iter[length] : end[-1];
-
-                       outpen.put_value(tot*divisor);
+                       tot -= (y>length) ?
+                       (typename T1::accumulator_type)(iter[-length-1]) :
+                       (typename T1::accumulator_type)(*pen.y());
+                       tot += ((y+length)<h) ?
+                       (typename T1::accumulator_type)(iter[length]) :
+                       (typename T1::accumulator_type)(end[-1]);
+
+                       outpen.put_value((typename 
T2::value_type)(tot*divisor));
                }
                outpen.dec_y(y);
        }


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to