Initialise depth before using it.
[synfig.git] / synfig-core / trunk / src / synfig / blur.cpp
index 0602622..2b481f0 100644 (file)
@@ -5,16 +5,17 @@
 **     $Id: blur.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -616,24 +617,24 @@ bool Blur::operator ()(const Surface &surface,
                        //horizontal part
                        if(size[0])
                        {
-                               int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1
-                               etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=worksurface;
                        
                        //vertical part
                        if(size[1])
                        {
-                               int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1 on the horizontal 1 2 1
-                               etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=temp_surface2;
        
@@ -992,24 +993,24 @@ bool Blur::operator ()(const surface<float> &surface,
                        //horizontal part
                        if(size[0])
                        {
-                               int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1
-                               etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=worksurface;
                        
                        //vertical part
                        if(size[1])
                        {
-                               int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1 on the horizontal 1 2 1
-                               etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=temp_surface2;