From: Laszlo T. <ave...@us...> - 2004-08-05 17:25:18
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12565/Core Modified Files: Polygon.cpp Polygon.h Video.h Log Message: Optimized polygon importing (removed double allocating of polygons) Index: Video.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Video.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Video.h 3 Aug 2004 20:21:58 -0000 1.30 --- Video.h 5 Aug 2004 17:25:05 -0000 1.31 *************** *** 105,110 **** virtual void ConvertToGame(short& x, short& y) = 0; /** */ ! virtual Sprite2D* PrecalculatePolygon(Point* points, int count, ! Color& color) = 0; /** Sets the Fading to Black Percentage */ virtual void SetFadePercent(int percent) = 0; --- 105,109 ---- virtual void ConvertToGame(short& x, short& y) = 0; /** */ ! virtual Sprite2D* PrecalculatePolygon(Gem_Polygon *poly, Color &color) = 0;//Point* points, int count, Color& color, Region& bbox) = 0; /** Sets the Fading to Black Percentage */ virtual void SetFadePercent(int percent) = 0; Index: Polygon.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Polygon.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Polygon.h 1 May 2004 00:07:48 -0000 1.3 --- Polygon.h 5 Aug 2004 17:25:05 -0000 1.4 *************** *** 24,29 **** class GEM_EXPORT Gem_Polygon { public: ! Gem_Polygon(Point* points, int count, bool precalculate = false, ! Color* color = NULL); ~Gem_Polygon(void); Region BBox; --- 24,29 ---- class GEM_EXPORT Gem_Polygon { public: ! Gem_Polygon(Point* points, int count, Region *bbox = NULL, ! bool precalculate = false, Color* color = NULL); ~Gem_Polygon(void); Region BBox; Index: Polygon.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Polygon.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Polygon.cpp 5 Aug 2004 16:02:07 -0000 1.8 --- Polygon.cpp 5 Aug 2004 17:25:05 -0000 1.9 *************** *** 24,38 **** extern Interface* core; ! Gem_Polygon::Gem_Polygon(Point* points, int cnt, bool precalculate, Color* color) { if (cnt) { this->points = ( Point * ) malloc( cnt * sizeof( Point ) ); } else { this->points = NULL; } - memcpy( this->points, points, cnt * sizeof( Point ) ); count = cnt; if (precalculate) { ! fill = core->GetVideoDriver()->PrecalculatePolygon( points, cnt, *color ); } else { fill = NULL; --- 24,40 ---- extern Interface* core; ! Gem_Polygon::Gem_Polygon(Point* points, int cnt, Region *bbox, bool precalculate, Color* color) { if (cnt) { this->points = ( Point * ) malloc( cnt * sizeof( Point ) ); + memcpy( this->points, points, cnt * sizeof( Point ) ); } else { this->points = NULL; } count = cnt; + if(bbox) BBox=*bbox; + else RecalcBBox(); if (precalculate) { ! fill = core->GetVideoDriver()->PrecalculatePolygon( this, *color); //points, cnt, *color, BBox ); } else { fill = NULL; |