X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Ftarget_tile.cpp;h=24674bc91f72f0bc5cbb912971893e71cf866586;hb=31259be3ce6f46267dcf10b2c856c2477a4afcb5;hp=77b158e3670070c6eb51ed866aa145a629101549;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/target_tile.cpp b/synfig-core/trunk/src/synfig/target_tile.cpp index 77b158e..24674bc 100644 --- a/synfig-core/trunk/src/synfig/target_tile.cpp +++ b/synfig-core/trunk/src/synfig/target_tile.cpp @@ -2,19 +2,20 @@ /*! \file target_tile.cpp ** \brief Template File ** -** $Id: target_tile.cpp,v 1.2 2005/01/12 06:46:45 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -91,11 +92,11 @@ Target_Tile::next_frame(Time& time) frame_end=desc.get_frame_end(); time_start=desc.get_time_start(); time_end=desc.get_time_end(); - + // Calculate the number of frames total_frames=frame_end-frame_start; if(total_frames<=0)total_frames=1; - + //RendDesc rend_desc=desc; //rend_desc.set_gamma(1); @@ -123,7 +124,7 @@ Target_Tile::next_tile(int& x, int& y) // Add the last tiles (which will be clipped) if(rend_desc().get_w()%tile_w_!=0)tw++; if(rend_desc().get_h()%tile_h_!=0)th++; - + x=(curr_tile_%tw)*tile_h_; y=(curr_tile_/tw)*tile_w_; @@ -147,13 +148,13 @@ synfig::Target_Tile::render_frame_(Context context,ProgressCallback *cb) etl::clock::value_type find_tile_time(0); etl::clock::value_type add_tile_time(0); total_time.reset(); - + // If the quality is set to zero, then we // use the parametric scanline-renderer. if(get_quality()==0) { Surface surface; - + RendDesc tile_desc; int x,y,w,h; int i; @@ -199,7 +200,7 @@ synfig::Target_Tile::render_frame_(Context context,ProgressCallback *cb) if(get_remove_alpha()) for(int i=0;iamount_complete(total_tiles,total_tiles)) return false; - + #if SYNFIG_DISPLAY_EFFICIENCY==1 synfig::info(">>>>>> Render Time: %fsec, Find Tile Time: %fsec, Add Tile Time: %fsec, Total Time: %fsec",work_time,find_tile_time,add_tile_time,total_time()); - synfig::info(">>>>>> FRAME EFICIENCY: %f%%",(100.0f*work_time/total_time())); + synfig::info(">>>>>> FRAME EFFICIENCY: %f%%",(100.0f*work_time/total_time())); #endif #undef total_tiles return true; @@ -305,7 +307,12 @@ synfig::Target_Tile::render(ProgressCallback *cb) assert(canvas); curr_frame_=0; init(); - + if( !init() ){ + if(cb) cb->error(_("Target initialization failure")); + return false; + } + + // If the description's end frame is equal to // the start frame, then it is assumed that we // are rendering only one frame. Correct it. @@ -316,38 +323,38 @@ synfig::Target_Tile::render(ProgressCallback *cb) frame_end=desc.get_frame_end(); time_start=desc.get_time_start(); time_end=desc.get_time_end(); - + // Calculate the number of frames total_frames=frame_end-frame_start; - - - + + + try { // Grab the time i=next_frame(t); - + //synfig::info("1time_set_to %s",t.get_string().c_str()); - + if(i>=1) { do { curr_tile_=0; - + // If we have a callback, and it returns // false, go ahead and bail. (maybe a use cancel) if(cb && !cb->amount_complete(total_frames-(i-1),total_frames)) return false; - + if(!start_frame(cb)) return false; // Set the time that we wish to render //if(!get_avoid_time_sync() || canvas->get_time()!=t) canvas->set_time(t); - + Context context; - + #ifdef SYNFIG_OPTIMIZE_LAYER_TREE Canvas::Handle op_canvas(Canvas::create()); optimize_layers(canvas->get_context(), op_canvas); @@ -355,7 +362,7 @@ synfig::Target_Tile::render(ProgressCallback *cb) #else context=canvas->get_context(); #endif - + /* #ifdef SYNFIG_OPTIMIZE_LAYER_TREE Context context; @@ -371,7 +378,7 @@ synfig::Target_Tile::render(ProgressCallback *cb) context=canvas->get_context(); #endif */ - + if(!render_frame_(context,0)) return false; end_frame(); @@ -381,7 +388,7 @@ synfig::Target_Tile::render(ProgressCallback *cb) else { curr_tile_=0; - + if(!start_frame(cb)) return false; @@ -392,7 +399,7 @@ synfig::Target_Tile::render(ProgressCallback *cb) //synfig::info("2time_set_to %s",t.get_string().c_str()); Context context; - + #ifdef SYNFIG_OPTIMIZE_LAYER_TREE Canvas::Handle op_canvas(Canvas::create()); optimize_layers(canvas->get_context(), op_canvas); @@ -400,12 +407,12 @@ synfig::Target_Tile::render(ProgressCallback *cb) #else context=canvas->get_context(); #endif - + if(!render_frame_(context, cb)) return false; end_frame(); } - + } catch(String str) {