pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3151 - in trunk/pingus: . src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3151 - in trunk/pingus: . src
Date: Sat, 15 Sep 2007 04:00:35 +0200

Author: grumbel
Date: 2007-09-15 04:00:32 +0200 (Sat, 15 Sep 2007)
New Revision: 3151

Modified:
   trunk/pingus/TODO
   trunk/pingus/src/sprite.cpp
   trunk/pingus/src/sprite.hpp
Log:
- moved Sprite optimization into the draw loop (this works around the scaling 
bug)

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-15 01:30:41 UTC (rev 3150)
+++ trunk/pingus/TODO   2007-09-15 02:00:32 UTC (rev 3151)
@@ -67,6 +67,8 @@
 Important:
 ==========
 
+- enable editor in the main menu again (replace credits)
+
 - create verdana11 for latin2 and latin9
 
 - miner remove graphics looks wrong (cmap instead of gfx?)

Modified: trunk/pingus/src/sprite.cpp
===================================================================
--- trunk/pingus/src/sprite.cpp 2007-09-15 01:30:41 UTC (rev 3150)
+++ trunk/pingus/src/sprite.cpp 2007-09-15 02:00:32 UTC (rev 3151)
@@ -37,7 +37,7 @@
   friend class Sprite;
 
   Surface  surface;
-
+  bool     optimized;
   Vector2i offset;
 
   Vector2i frame_pos;
@@ -60,7 +60,8 @@
   }
 
   SpriteImpl(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod = ResourceModifierNS::ROT0)
-    : finished(false),
+    : optimized(false),
+      finished(false),
       frame(0),
       tick_count(0)
   {
@@ -89,11 +90,11 @@
 
     offset = calc_origin(desc.origin, frame_size) - desc.offset;
     
-    optimize();
   }
 
   SpriteImpl(const Surface& surface_)
     : surface(surface_),
+      optimized(false),
       offset(0,0),
       frame_pos(0,0),
       frame_size(surface.get_width(), surface.get_height()),
@@ -105,7 +106,6 @@
       frame(0),
       tick_count(0)
   {
-    optimize();
   }
 
   ~SpriteImpl()
@@ -115,6 +115,7 @@
   void optimize()
   {
     surface.optimize();
+    optimized = true;
   }
 
   void update(float delta)
@@ -146,6 +147,9 @@
 
   void draw(float x, float y, SDL_Surface* dst)
   {
+    if (!optimized)
+      optimize();
+
     SDL_Rect dstrect;
     dstrect.x = (Sint16)(x - offset.x);
     dstrect.y = (Sint16)(y - offset.y);
@@ -409,10 +413,4 @@
     }
 }
 
-void
-Sprite::optimize()
-{
-  impl->optimize();
-}
-
 /* EOF */

Modified: trunk/pingus/src/sprite.hpp
===================================================================
--- trunk/pingus/src/sprite.hpp 2007-09-15 01:30:41 UTC (rev 3150)
+++ trunk/pingus/src/sprite.hpp 2007-09-15 02:00:32 UTC (rev 3151)
@@ -70,10 +70,6 @@
       will be lost. */
   void fill(const Color& color);
 
-  /** Call SDL_DisplayFormatAlpha() or SDL_DisplayFormat() to speed up
-      rendering of this sprite */
-  void optimize();
-
   /** Duplicate the underlying SDL_Surface to allow manipulation
       without affecting other references to it */
   void make_single_user();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]