Partially fix 1678141: value.h wasn't including OpenEXR/half.h although it uses symbo...
[synfig.git] / synfig-core / trunk / src / synfig / layer_pastecanvas.cpp
index e3a71f0..3f83cab 100644 (file)
@@ -1,20 +1,21 @@
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
 /*!    \file layer_pastecanvas.h
 **     \brief Template Header
 **
 **     $Id: layer_pastecanvas.cpp,v 1.3 2005/01/24 03:08:18 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
 */
 /* ========================================================================= */
 
 using namespace etl;
 using namespace std;
-using namespace sinfg;
+using namespace synfig;
 
 /* === M A C R O S ========================================================= */
 
 #define MAX_DEPTH 10
 
 //#ifdef __APPLE__
-//#define SINFG_NO_CLIP
+//#define SYNFIG_NO_CLIP
 //#endif
 
 /* === C L A S S E S ======================================================= */
@@ -67,17 +68,18 @@ public:
 
 /* === G L O B A L S ======================================================= */
 
-SINFG_LAYER_INIT(Layer_PasteCanvas);
-SINFG_LAYER_SET_NAME(Layer_PasteCanvas,"PasteCanvas");
-SINFG_LAYER_SET_LOCAL_NAME(Layer_PasteCanvas,_("Paste Canvas"));
-SINFG_LAYER_SET_CATEGORY(Layer_PasteCanvas,_("Default"));
-SINFG_LAYER_SET_VERSION(Layer_PasteCanvas,"0.1");
-SINFG_LAYER_SET_CVS_ID(Layer_PasteCanvas,"$Id: layer_pastecanvas.cpp,v 1.3 2005/01/24 03:08:18 darco Exp $");
+SYNFIG_LAYER_INIT(Layer_PasteCanvas);
+SYNFIG_LAYER_SET_NAME(Layer_PasteCanvas,"PasteCanvas");
+SYNFIG_LAYER_SET_LOCAL_NAME(Layer_PasteCanvas,_("Paste Canvas"));
+SYNFIG_LAYER_SET_CATEGORY(Layer_PasteCanvas,_("Default"));
+SYNFIG_LAYER_SET_VERSION(Layer_PasteCanvas,"0.1");
+SYNFIG_LAYER_SET_CVS_ID(Layer_PasteCanvas,"$Id: layer_pastecanvas.cpp,v 1.3 2005/01/24 03:08:18 darco Exp $");
 
 /* === M E T H O D S ======================================================= */
 
 Layer_PasteCanvas::Layer_PasteCanvas():
        origin(0,0),
+       depth(0),
        zoom(0),
        time_offset(0)
 {
@@ -159,7 +161,7 @@ Layer_PasteCanvas::set_param(const String & param, const ValueBase &value)
 }
 
 void
-Layer_PasteCanvas::set_sub_canvas(etl::handle<sinfg::Canvas> x)
+Layer_PasteCanvas::set_sub_canvas(etl::handle<synfig::Canvas> x)
 {
        if(canvas && !do_not_muck_with_time_)
                remove_child(canvas.get());
@@ -196,13 +198,13 @@ Layer_PasteCanvas::set_sub_canvas(etl::handle<sinfg::Canvas> x)
 void
 Layer_PasteCanvas::on_canvas_set()
 {
-       //sinfg::info("before count()=%d",count());
+       //synfig::info("before count()=%d",count());
        if(get_canvas() && canvas && canvas->is_inline() && canvas->parent()!=get_canvas())
        {
-               //sinfg::info("during count()=%d",count());
+               //synfig::info("during count()=%d",count());
                canvas->set_inline(get_canvas());
        }
-       //sinfg::info("after count()=%d",count());
+       //synfig::info("after count()=%d",count());
 }
 
 ValueBase
@@ -237,8 +239,8 @@ Layer_PasteCanvas::set_time(Context context, Time time)const
                bounds=Rect::zero();
 }
 
-sinfg::Layer::Handle
-Layer_PasteCanvas::hit_check(sinfg::Context context, const sinfg::Point &pos)const
+synfig::Layer::Handle
+Layer_PasteCanvas::hit_check(synfig::Context context, const synfig::Point &pos)const
 {
        if(depth==MAX_DEPTH)return 0;depth_counter counter(depth);
 
@@ -323,7 +325,7 @@ Layer_PasteCanvas::accelerated_render(Context context,Surface *surface,int quali
                        blend_method=Color::BLEND_STRAIGHT;
        }
        else
-       if(!etl::intersect(context.get_full_bounding_rect(),full_bounding_rect))
+       if(!etl::intersect(context.get_full_bounding_rect(),full_bounding_rect+origin))
        {
                if(Color::is_onto(blend_method))
                        return true;
@@ -332,9 +334,9 @@ Layer_PasteCanvas::accelerated_render(Context context,Surface *surface,int quali
                        blend_method=Color::BLEND_STRAIGHT;
        }
        
-#ifndef SINFG_NO_CLIP
+#ifndef SYNFIG_NO_CLIP
        {
-               //sinfg::info("PasteCanv Clip");
+               //synfig::info("PasteCanv Clip");
                Rect area(desc.get_rect()&full_bounding_rect);
                                
                Point min(area.get_min());