Fixing warnings from doxygen:
[synfig.git] / synfig-core / trunk / src / modules / lyr_std / warp.cpp
index cf80c7b..8cb5cd9 100644 (file)
@@ -1,18 +1,20 @@
-/*! ========================================================================
-** Synfig
-** Template File
-** $Id: warp.cpp,v 1.2 2005/01/24 05:00:18 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*!    \file warp.cpp
+**     \brief Template File
 **
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     \legal
+**     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
 **
 ** === N O T E S ===========================================================
 **
@@ -184,13 +186,13 @@ Warp::sync()
        cache_e=(-dest_tl[1]+dest_tr[1])/(src_br[0]-src_tl[0]);
        cache_f=(-dest_tl[1]+dest_bl[1])/(src_br[1]-src_tl[1]);
        cache_i=(dest_tl[1]-dest_tr[1]+dest_br[1]-dest_bl[1])/((src_br[1]-src_tl[1])*(src_br[0]-src_tl[0]));
-       cache_j=dest_tl[1];     
+       cache_j=dest_tl[1];
 */
-       
+
 /*     matrix[2][0]=(dest_tl[0]-dest_tr[0]+dest_br[0]-dest_bl[0])/((src_br[1]-src_tl[1])*(src_br[0]-src_tl[0]));
        matrix[2][1]=(dest_tl[1]-dest_tr[1]+dest_br[1]-dest_bl[1])/((src_br[1]-src_tl[1])*(src_br[0]-src_tl[0]));
        matrix[2][2]=quad_area(dest_tl,dest_tr,dest_br,dest_bl)/((src_br[1]-src_tl[1])*(src_br[0]-src_tl[0]));
-       
+
        matrix[0][0]=-(-dest_tl[1]+dest_tr[1])/(src_br[0]-src_tl[0]);
        matrix[0][1]=-(-dest_tl[1]+dest_bl[1])/(src_br[1]-src_tl[1]);
 
@@ -208,7 +210,7 @@ Warp::sync()
        const Real& y1(min(src_br[1],src_tl[1]));
        const Real& x2(max(src_br[0],src_tl[0]));
        const Real& y2(max(src_br[1],src_tl[1]));
-       
+
        Real tx1(dest_bl[0]);
        Real ty1(dest_bl[1]);
        Real tx2(dest_br[0]);
@@ -292,7 +294,7 @@ Warp::sync()
     matrix[2][2] = 1.0;
   }
 #undef matrix
-  
+
        Real scaletrans[3][3]={
                        { scalex, 0, -x1*scalex },
                        { 0, scaley, -y1*scaley },
@@ -335,7 +337,7 @@ Warp::set_param(const String & param, const ValueBase &value)
        IMPORT_PLUS(dest_br,sync());
        IMPORT(clip);
        IMPORT(horizon);
-       
+
        return false;
 }
 
@@ -350,18 +352,18 @@ Warp::get_param(const String &param)const
        EXPORT(dest_br);
        EXPORT(clip);
        EXPORT(horizon);
-       
+
        EXPORT_NAME();
        EXPORT_VERSION();
-               
-       return ValueBase();     
+
+       return ValueBase();
 }
 
 Layer::Vocab
 Warp::get_param_vocab()const
 {
        Layer::Vocab ret;
-       
+
        ret.push_back(ParamDesc("src_tl")
                .set_local_name(_("Source TL"))
                .set_box("src_br")
@@ -408,14 +410,14 @@ class Warp_Trans : public Transform
        etl::handle<const Warp> layer;
 public:
        Warp_Trans(const Warp* x):Transform(x->get_guid()),layer(x) { }
-       
+
        synfig::Vector perform(const synfig::Vector& x)const
        {
                return layer->transform_backward(x);
                //Point pos(x-layer->origin);
                //return Point(layer->cos_val*pos[0]-layer->sin_val*pos[1],layer->sin_val*pos[0]+layer->cos_val*pos[1])+layer->origin;
        }
-       
+
        synfig::Vector unperform(const synfig::Vector& x)const
        {
 
@@ -441,7 +443,7 @@ Warp::hit_check(synfig::Context context, const synfig::Point &p)const
                if(!rect.is_inside(newpos))
                        return 0;
        }
-       
+
        return context.hit_check(newpos);
 }
 
@@ -474,15 +476,15 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
 
        Real pw=(renddesc.get_w())/(renddesc.get_br()[0]-renddesc.get_tl()[0]);
        Real ph=(renddesc.get_h())/(renddesc.get_br()[1]-renddesc.get_tl()[1]);
-       
+
        if(cb && !cb->amount_complete(0,10000))
                return false;
-       
+
        Point tl(renddesc.get_tl());
        Point br(renddesc.get_br());
 
        Rect bounding_rect;
-       
+
        Rect render_rect(tl,br);
        Rect clip_rect(Rect::full_plane());
        Rect dest_rect(dest_tl,dest_br); dest_rect.expand(dest_tr).expand(dest_bl);
@@ -496,23 +498,23 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                surface->clear();
                return true;
        }
-       
+
        {
                Rect other(render_rect);
                if(clip)
                        other&=dest_rect;
-               
+
                Point min(other.get_min());
                Point max(other.get_max());
-               
+
                bool init_point_set=false;
-               
-               Point trans_point[4];
+
+               // Point trans_point[4];
                Point p;
-               Real trans_z[4];
+               // Real trans_z[4];
                Real z,minz(10000000000000.0f),maxz(0);
-               
-               
+
+
                p=transform_forward(min);
                z=transform_backward_z(p);
                if(z>0 && z<horizon*2)
@@ -523,9 +525,9 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                bounding_rect=Rect(p);
                        init_point_set=true;
                        maxz=std::max(maxz,z);
-                       minz=std::min(minz,z);                  
+                       minz=std::min(minz,z);
                }
-               
+
                p=transform_forward(max);
                z=transform_backward_z(p);
                if(z>0 && z<horizon*2)
@@ -536,7 +538,7 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                bounding_rect=Rect(p);
                        init_point_set=true;
                        maxz=std::max(maxz,z);
-                       minz=std::min(minz,z);                  
+                       minz=std::min(minz,z);
                }
 
                swap(min[1],max[1]);
@@ -551,9 +553,9 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                bounding_rect=Rect(p);
                        init_point_set=true;
                        maxz=std::max(maxz,z);
-                       minz=std::min(minz,z);                  
+                       minz=std::min(minz,z);
                }
-               
+
                p=transform_forward(max);
                z=transform_backward_z(p);
                if(z>0 && z<horizon*2)
@@ -564,9 +566,9 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                bounding_rect=Rect(p);
                        init_point_set=true;
                        maxz=std::max(maxz,z);
-                       minz=std::min(minz,z);                  
+                       minz=std::min(minz,z);
                }
-               
+
                if(!init_point_set)
                {
                        surface->set_wh(renddesc.get_w(),renddesc.get_h());
@@ -574,20 +576,20 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                        return true;
                }
                zoom_factor=(1+(maxz-minz));
-               
+
        }
 
 #ifdef ACCEL_WARP_IS_BROKEN
        return Layer::accelerated_render(context,surface,quality,renddesc, cb);
 #else
-       
+
        /*swap(tl[1],br[1]);
        bounding_rect
                .expand(transform_forward(tl))
                .expand(transform_forward(br))
        ;
        swap(tl[1],br[1]);*/
-       
+
        //synfig::warning("given window: [%f,%f]-[%f,%f] %dx%d",tl[0],tl[1],br[0],br[1],renddesc.get_w(),renddesc.get_h());
        //synfig::warning("Projected: [%f,%f]-[%f,%f]",bounding_rect.get_min()[0],bounding_rect.get_min()[1],bounding_rect.get_max()[0],bounding_rect.get_max()[1]);
 
@@ -595,17 +597,17 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
        // source rectangle
        if(clip)
                clip_rect&=Rect(src_tl,src_br);
-               
+
        // Bound ourselves to the bounding rectangle of
        // what is under us
        clip_rect&=context.get_full_bounding_rect();//.expand_x(abs(zoom_factor/pw)).expand_y(abs(zoom_factor/ph));
 
        bounding_rect&=clip_rect;
-       
+
        Point min_point(bounding_rect.get_min());
        Point max_point(bounding_rect.get_max());
-       
-       
+
+
        if(tl[0]>br[0])
        {
                tl[0]=max_point[0];
@@ -626,14 +628,14 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                br[1]=max_point[1];
                tl[1]=min_point[1];
        }
-       
-       
+
+
 
        const int tmp_d(max(renddesc.get_w(),renddesc.get_h()));
        Real src_pw=(tmp_d*zoom_factor)/(br[0]-tl[0]);
        Real src_ph=(tmp_d*zoom_factor)/(br[1]-tl[1]);
 
-       
+
        RendDesc desc(renddesc);
        desc.clear_flags();
        //desc.set_flags(RendDesc::PX_ASPECT);
@@ -653,16 +655,16 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
        src_pw=(desc.get_w())/(desc.get_br()[0]-desc.get_tl()[0]);
        src_ph=(desc.get_h())/(desc.get_br()[1]-desc.get_tl()[1]);
 
-       
+
        Surface source;
        source.set_wh(desc.get_w(),desc.get_h());
 
        if(!context.accelerated_render(&source,quality,desc,&stageone))
                return false;
-       
+
        surface->set_wh(renddesc.get_w(),renddesc.get_h());
        surface->clear();
-       
+
        Surface::pen pen(surface->begin());
 
        if(quality<=4)
@@ -682,15 +684,15 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                        (*surface)[y][x]=Color::alpha();
                                        continue;
                                }
-                               
+
                                u=(tmp[0]-tl[0])*src_pw;
                                v=(tmp[1]-tl[1])*src_ph;
-                               
+
                                if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v))
                                {
                                        (*surface)[y][x]=context.get_color(tmp);
                                }
-                               else                            
+                               else
                                        (*surface)[y][x]=source.cubic_sample(u,v);
                        }
                        if(y&31==0 && cb)
@@ -718,10 +720,10 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                        (*surface)[y][x]=Color::alpha();
                                        continue;
                                }
-                               
+
                                u=(tmp[0]-tl[0])*src_pw;
                                v=(tmp[1]-tl[1])*src_ph;
-                               
+
                                if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v))
                                {
                                        if(clip)
@@ -756,10 +758,10 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
                                        (*surface)[y][x]=Color::alpha();
                                        continue;
                                }
-                               
+
                                u=(tmp[0]-tl[0])*src_pw;
                                v=(tmp[1]-tl[1])*src_ph;
-                               
+
                                if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v))
                                {
                                        if(clip)
@@ -788,7 +790,7 @@ Warp::accelerated_render(Context context,Surface *surface,int quality, const Ren
 
 synfig::Rect
 Warp::get_bounding_rect()const
-{      
+{
        return Rect::full_plane();
 }
 
@@ -796,23 +798,23 @@ synfig::Rect
 Warp::get_full_bounding_rect(Context context)const
 {
 //     return Rect::full_plane();
-       
+
        Rect under(context.get_full_bounding_rect());
 
        if(clip)
        {
                under&=Rect(src_tl,src_br);
        }
-       
+
        return get_transform()->perform(under);
-       
+
        /*
        Rect under(context.get_full_bounding_rect());
        Rect ret(Rect::zero());
-       
+
        if(under.area()==HUGE_VAL)
                return Rect::full_plane();
-       
+
        ret.expand(
                transform_backward(
                        under.get_min()