Author: Carlos Lopez <genet...@gmail.com> Date: Mon Mar 4 20:02:48 2013 +0100
Turn FlipBookElem into a class to allow control on constructor and destructor --- synfig-studio/src/gui/preview.cpp | 7 ------- synfig-studio/src/gui/preview.h | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/synfig-studio/src/gui/preview.cpp b/synfig-studio/src/gui/preview.cpp index 7096c44..a171ff9 100644 --- a/synfig-studio/src/gui/preview.cpp +++ b/synfig-studio/src/gui/preview.cpp @@ -223,7 +223,6 @@ void studio::Preview::set_canvasview(const studio::CanvasView::LooseHandle &h) studio::Preview::~Preview() { - clear(); // we need this to remove the cairo_surface references signal_destroyed_(this); //tell anything that attached to us, we're dying } @@ -282,7 +281,6 @@ void studio::Preview::render() target->set_rend_desc(&desc); //... first we must clear our current selves of space - clear(); frames.resize(0); //now tell it to go... with inherited prog. reporting... @@ -295,10 +293,6 @@ void studio::Preview::render() void studio::Preview::clear() { - FlipBook::iterator it; - for(it=frames.begin(); it!=frames.end(); it++) - if(it->surface) - cairo_surface_destroy(it->surface); frames.clear(); } @@ -334,7 +328,6 @@ void studio::Preview::frame_finish(const Preview_Target *targ) //load time fe.t = time; - fe.surface=NULL; //uses and manages the memory for the buffer... //synfig::warning("Create a pixmap..."); fe.buf = diff --git a/synfig-studio/src/gui/preview.h b/synfig-studio/src/gui/preview.h index 436c47a..e834eaa 100644 --- a/synfig-studio/src/gui/preview.h +++ b/synfig-studio/src/gui/preview.h @@ -64,11 +64,21 @@ class AsyncRenderer; class Preview : public sigc::trackable, public etl::shared_object { public: - struct FlipbookElem + class FlipbookElem { - float t; - Glib::RefPtr<Gdk::Pixbuf> buf; //at whatever resolution they are rendered at (resized at run time) + public: + float t; + Glib::RefPtr<Gdk::Pixbuf> buf; //at whatever resolution they are rendered at (resized at run time) cairo_surface_t* surface; + FlipbookElem() + { + surface=NULL; + } + ~FlipbookElem() + { + if(surface) + cairo_surface_destroy(surface); + } }; etl::handle<studio::AsyncRenderer> renderer; ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Synfig-devl mailing list Synfig-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synfig-devl