Skip to content

Commit

Permalink
Changed method of layer activity check while rendering.
Browse files Browse the repository at this point in the history
Rectangles become invisible in preview
  • Loading branch information
blackwarthog committed Aug 12, 2013
1 parent 8dabec6 commit 668cc95
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions synfig-core/src/synfig/canvas.cpp
Expand Up @@ -1135,7 +1135,7 @@ synfig::optimize_layers(Time time, Context context, Canvas::Handle op_canvas, bo
Layer::Handle layer=*iter;

// If the layer isn't active, don't worry about it
if(!layer->active())
if(!context.active(*layer))
continue;

// Any layer with an amount of zero is implicitly disabled.
Expand Down Expand Up @@ -1174,7 +1174,7 @@ synfig::optimize_layers(Time time, Context context, Canvas::Handle op_canvas, bo
float z_depth(layer->get_z_depth()*1.0001+i);

// If the layer isn't active, don't worry about it
if(!layer->active())
if(!context.active(*layer))
continue;

// Any layer with an amount of zero is implicitly disabled.
Expand Down
18 changes: 9 additions & 9 deletions synfig-core/src/synfig/context.cpp
Expand Up @@ -92,7 +92,7 @@ Context::get_color(const Point &pos)const
{
// If this layer is active, then go
// ahead and break out of the loop
if((*context)->active())
if(context.active())
break;

// Otherwise, we want to keep searching
Expand All @@ -118,7 +118,7 @@ Context::get_cairocolor(const Point &pos)const
{
// If this layer is active, then go
// ahead and break out of the loop
if((*context)->active())
if(context.active())
break;

// Otherwise, we want to keep searching
Expand All @@ -145,7 +145,7 @@ Context::get_full_bounding_rect()const
{
// If this layer is active, then go
// ahead and break out of the loop
if((*context)->active())
if(context.active())
break;

// Otherwise, we want to keep searching
Expand Down Expand Up @@ -200,7 +200,7 @@ Context::set_time(Time time)const
// or it's a stroboscope layer,
// or it's a time loop layer,
// then break out of the loop and set its time
if((*context)->active() &&
if(context.active() &&
(!(*context)->dirty_time_.is_equal(time) ||
(*context)->get_name() == "stroboscope" ||
(*context)->get_name() == "timeloop"))
Expand Down Expand Up @@ -243,7 +243,7 @@ Context::set_dirty_outlines()
Context context(*this);
while(!(context)->empty())
{
if( (*context)->active() &&
if( context.active() &&
(
(*context)->get_name() == "outline" ||
(*context)->get_name() == "advanced_outline" ||
Expand Down Expand Up @@ -278,7 +278,7 @@ Context::set_time(Time time,const Vector &/*pos*/)const
{
// If this layer is active, then go
// ahead and break out of the loop
if((*context)->active())
if(context.active())
break;
// Otherwise, we want to keep searching
Expand Down Expand Up @@ -314,7 +314,7 @@ Context::hit_check(const Point &pos)const
{
// If this layer is active, then go
// ahead and break out of the loop
if((*context)->active())
if(context.active())
break;

// Otherwise, we want to keep searching
Expand Down Expand Up @@ -355,7 +355,7 @@ Context::accelerated_render(Surface *surface,int quality, const RendDesc &rendde
for(;!(context)->empty();++context)
{
// If we are not active then move on to next layer
if(!(*context)->active())
if(!context.active())
continue;
const Rect layer_bounds((*context)->get_bounding_rect());
// Cast current layer to composite
Expand Down Expand Up @@ -488,7 +488,7 @@ Context::accelerated_cairorender(cairo_t *cr,int quality, const RendDesc &rendde
for(;!(context)->empty();++context)
{
// If we are not active then move on to next layer
if(!(*context)->active())
if(!context.active())
continue;
// Found one good layer
break;
Expand Down
7 changes: 6 additions & 1 deletion synfig-core/src/synfig/context.h
Expand Up @@ -127,7 +127,12 @@ class Context : public CanvasBase::const_iterator
static inline bool active(const ContextParams &context_params, const Layer &layer) {
return layer.active()
&& (context_params.render_excluded_contexts
|| layer.get_exclude_from_rendering());
|| !layer.get_exclude_from_rendering());
}

// Returns \c true if layer is active in this context
inline bool active(const Layer &layer) {
return active(params, layer);
}

// Returns \c true if layer is active in this context
Expand Down
6 changes: 4 additions & 2 deletions synfig-core/src/tool/optionsprocessor.cpp
Expand Up @@ -565,7 +565,8 @@ Job OptionsProcessor::extract_job() throw (SynfigToolException&)
for(iter=composite->rbegin(); iter!=composite->rend(); ++iter)
{
Layer::Handle layer(*iter);
if(layer->active())
// todo: take context_params from options
if(Context::active(ContextParams(false),*layer))
job.canvas->push_front(layer->clone(composite));
}
}
Expand All @@ -591,7 +592,8 @@ Job OptionsProcessor::extract_job() throw (SynfigToolException&)
for(iter=composite->rbegin();iter!=composite->rend();++iter)
{
Layer::Handle layer(*iter);
if(layer->active())
// todo: take context_params from options
if(Context::active(ContextParams(false),*layer))
job_list.front().canvas->push_front(layer->clone(composite));
}
VERBOSE_OUT(2)<<_("Appended contents of ")<<composite_file<<endl;
Expand Down

0 comments on commit 668cc95

Please sign in to comment.