00001 /* === S Y N F I G ========================================================= */ 00022 /* ========================================================================= */ 00023 00024 /* === S T A R T =========================================================== */ 00025 00026 #ifndef __SYNFIG_TARGET_TILE_H 00027 #define __SYNFIG_TARGET_TILE_H 00028 00029 /* === H E A D E R S ======================================================= */ 00030 00031 #include "target.h" 00032 00033 /* === M A C R O S ========================================================= */ 00034 00035 #define TILE_SIZE 120 00036 00037 /* === T Y P E D E F S ===================================================== */ 00038 00039 /* === C L A S S E S & S T R U C T S ======================================= */ 00040 00041 namespace synfig { 00042 00047 class Target_Tile : public Target 00048 { 00049 int threads_; 00050 int tile_w_; 00051 int tile_h_; 00052 int curr_tile_; 00053 int curr_frame_; 00054 bool clipping_; 00055 public: 00056 typedef etl::handle<Target_Tile> Handle; 00057 typedef etl::loose_handle<Target_Tile> LooseHandle; 00058 typedef etl::handle<const Target_Tile> ConstHandle; 00059 00060 Target_Tile(); 00061 00063 virtual bool render(ProgressCallback *cb=NULL); 00064 00066 00072 virtual int next_tile(int& x, int& y); 00073 00074 virtual int next_frame(Time& time); 00075 00077 virtual bool add_tile(const synfig::Surface &surface, int x, int y)=0; 00078 00079 virtual int total_tiles()const 00080 { 00081 // Width of the image(in tiles) 00082 const int tw(rend_desc().get_w()/tile_w_+(rend_desc().get_w()%tile_w_?1:0)); 00083 const int th(rend_desc().get_h()/tile_h_+(rend_desc().get_h()%tile_h_?1:0)); 00084 00085 return tw*th; 00086 } 00087 00089 00092 virtual bool start_frame(ProgressCallback *cb=NULL)=0; 00093 00095 00096 virtual void end_frame()=0; 00097 00098 void set_threads(int x) { threads_=x; } 00099 00100 int get_threads()const { return threads_; } 00101 00102 void set_tile_w(int w) { tile_w_=w; } 00103 00104 int get_tile_w()const { return tile_w_; } 00105 00106 void set_tile_h(int h) { tile_h_=h; } 00107 00108 int get_tile_h()const { return tile_h_; } 00109 00110 bool get_clipping()const { return clipping_; } 00111 00112 void set_clipping(bool x) { clipping_=x; } 00113 00114 private: 00115 00116 bool render_frame_(Context context,ProgressCallback *cb=0); 00117 00118 }; // END of class Target_Tile 00119 00120 }; // END of namespace synfig 00121 00122 /* === E N D =============================================================== */ 00123 00124 #endif