/* -*- c++ -*- * Copyright ©2008 Hugo Mills * * This software is distributed under the terms of the GNU GPL v3 * For more information on the GPL, see the file COPYING or * visit http://www.gnu.org/ * * This software is distributed without warranty */ #include "rendercontextstacked.h" RenderContextStacked::RenderContextStacked(RenderContext* c) : RenderContext(-1, c->getdisplay(), c->getviewport()) { stack.push_back(c); } RenderContextStacked::~RenderContextStacked() { for(std::list::iterator it = stack.begin(); it != stack.end(); it++) { delete *it; } } void RenderContextStacked::render(Output* where) const { for(std::list::const_iterator it = stack.begin(); it != stack.end(); it++) { (*it)->render(where); } } void RenderContextStacked::halve(RenderContext** B0, RenderContext** B1) const { RenderContextStacked* t0; RenderContextStacked* t1; t0 = new RenderContextStacked(); t1 = new RenderContextStacked(); for(std::list::const_iterator it = stack.begin(); it != stack.end(); it++) { RenderContext* c0; RenderContext* c1; (*it)->halve(&c0, &c1); t0->stack.push_back(c0); t1->stack.push_back(c1); } *B0 = t0; *B1 = t1; }