bool StateBrush_Context::build_transform_stack( Canvas::Handle canvas, Layer::Handle layer, CanvasView::Handle canvas_view, TransformStack& transform_stack ) { int count = 0; for(Canvas::iterator i = canvas->begin(); i != canvas->end() ;++i) { if(*i == layer) return true; if((*i)->active()) { Transform::Handle trans((*i)->get_transform()); if(trans) { transform_stack.push(trans); count++; } } // If this is a paste canvas layer, then we need to // descend into it if(etl::handle<Layer_PasteCanvas> layer_pastecanvas = etl::handle<Layer_PasteCanvas>::cast_dynamic(*i)) { transform_stack.push_back( new Transform_Matrix( layer_pastecanvas->get_guid(), layer_pastecanvas->get_summary_transformation().get_matrix() ) ); if (build_transform_stack(layer_pastecanvas->get_sub_canvas(), layer, canvas_view, transform_stack)) return true; transform_stack.pop(); } } while(count-- > 0) transform_stack.pop(); return false; }
void pushTransform(const Transform& transform) { transformStack.push(transform); }