{
//if(is_inline() && parent_) assert(0);
_CanvasCounter::counter--;
- //DEBUGPOINT();
clear();
begin_delete();
}
return parent_->add_value_node(x,id);
// throw runtime_error("You cannot add a ValueNode to an inline Canvas");
- //DEBUGPOINT();
if(x->is_exported())
throw runtime_error("ValueNode is already exported");
try
{
- //DEBUGPOINT();
if(PlaceholderValueNode::Handle::cast_dynamic(value_node_list_.find(id)))
throw Exception::IDNotFound("add_value_node()");
- //DEBUGPOINT();
throw Exception::IDAlreadyExists(id);
}
catch(Exception::IDNotFound)
{
- //DEBUGPOINT();
x->set_id(id);
x->set_parent_canvas(this);
synfig::error("Unable to add ValueNode");
throw std::runtime_error("Unable to add ValueNode");
}
- //DEBUGPOINT();
return;
}
void
Canvas::push_back(etl::handle<Layer> x)
{
-// DEBUGPOINT();
// int i(x->count());
insert(end(),x);
//if(x->count()!=i+1)synfig::info("push_back before %d, after %d",i,x->count());
void
Canvas::push_front(etl::handle<Layer> x)
{
-// DEBUGPOINT();
// int i(x->count());
insert(begin(),x);
//if(x->count()!=i+1)synfig::error("push_front before %d, after %d",i,x->count());
Canvas::Handle paste_sub_canvas = paste_canvas->get_sub_canvas();
if(paste_sub_canvas)
optimize_layers(paste_sub_canvas->get_context(),sub_canvas,motion_blurred);
-//#define SYNFIG_OPTIMIZE_PASTE_CANVAS 1
+// \todo: uncommenting the following breaks the rendering of at least examples/backdrop.sifz quite severely
+// #define SYNFIG_OPTIMIZE_PASTE_CANVAS
#ifdef SYNFIG_OPTIMIZE_PASTE_CANVAS
Canvas::iterator sub_iter;
- // Determine if we can just remove the paste canvas
- // altogether
- if(paste_canvas->get_blend_method()==Color::BLEND_COMPOSITE && paste_canvas->get_amount()==1.0f && paste_canvas->get_zoom()==0 && paste_canvas->get_time_offset()==0 && paste_canvas->get_origin()==Point(0,0))
- try{
- for(sub_iter=sub_canvas->begin();sub_iter!=sub_canvas->end();++sub_iter)
- {
- Layer* layer=sub_iter->get();
- // any layers that deform end up breaking things
- // so do things the old way if we run into anything like this
- if(!dynamic_cast<Layer_NoDeform*>(layer))
- throw int();
+ // Determine if we can just remove the paste canvas altogether
+ if (paste_canvas->get_blend_method() == Color::BLEND_COMPOSITE &&
+ paste_canvas->get_amount() == 1.0f &&
+ paste_canvas->get_zoom() == 0 &&
+ paste_canvas->get_time_offset() == 0 &&
+ paste_canvas->get_origin() == Point(0,0) )
+ try {
+ for(sub_iter=sub_canvas->begin();sub_iter!=sub_canvas->end();++sub_iter)
+ {
+ Layer* layer=sub_iter->get();
- ValueBase value(layer->get_param("blend_method"));
- if(value.get_type()!=ValueBase::TYPE_INTEGER || value.get(int())!=(int)Color::BLEND_COMPOSITE)
- throw int();
- }
+ // any layers that deform end up breaking things
+ // so do things the old way if we run into anything like this
+ if(!dynamic_cast<Layer_NoDeform*>(layer))
+ throw int();
- // It has turned out that we don't need a paste canvas
- // layer, so just go ahead and add all the layers onto
- // the current stack and be done with it
- while(sub_canvas->size())
- {
- sort_list.push_back(std::pair<float,Layer::Handle>(z_depth,sub_canvas->front()));
- //op_canvas->push_back_simple(sub_canvas->front());
- sub_canvas->pop_front();
+ ValueBase value(layer->get_param("blend_method"));
+ if(value.get_type()!=ValueBase::TYPE_INTEGER || value.get(int())!=(int)Color::BLEND_COMPOSITE)
+ throw int();
+ }
+
+ // It has turned out that we don't need a paste canvas
+ // layer, so just go ahead and add all the layers onto
+ // the current stack and be done with it
+ while(sub_canvas->size())
+ {
+ sort_list.push_back(std::pair<float,Layer::Handle>(z_depth,sub_canvas->front()));
+ //op_canvas->push_back_simple(sub_canvas->front());
+ sub_canvas->pop_front();
+ }
+ continue;
}
- continue;
- }catch(int) { }
-#endif
+ catch(int)
+ { }
+#endif // SYNFIG_OPTIMIZE_PASTE_CANVAS
+
Layer::Handle new_layer(Layer::create("PasteCanvas"));
dynamic_cast<Layer_PasteCanvas*>(new_layer.get())->set_muck_with_time(false);
if (motion_blurred)