[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3045 - trunk/pingus/src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3045 - trunk/pingus/src |
Date: |
Tue, 28 Aug 2007 22:47:36 +0200 |
Author: grumbel
Date: 2007-08-28 22:47:36 +0200 (Tue, 28 Aug 2007)
New Revision: 3045
Modified:
trunk/pingus/src/sprite.cpp
Log:
- convert all Sprites automatically to display format, seems to cause glitches
in ActionButton, maybe elsewhere too
Modified: trunk/pingus/src/sprite.cpp
===================================================================
--- trunk/pingus/src/sprite.cpp 2007-08-28 20:43:47 UTC (rev 3044)
+++ trunk/pingus/src/sprite.cpp 2007-08-28 20:47:36 UTC (rev 3045)
@@ -36,6 +36,7 @@
friend class Sprite;
SDL_Surface* surface;
+ bool optimized;
Vector2i offset;
@@ -60,6 +61,7 @@
SpriteImpl(const SpriteDescription& desc)
: surface(0),
+ optimized(false),
finished(false),
frame(0),
tick_count(0)
@@ -90,7 +92,8 @@
}
SpriteImpl(const PixelBuffer& pixelbuffer)
- : offset(0,0),
+ : optimized(false),
+ offset(0,0),
frame_pos(0,0),
frame_size(pixelbuffer.get_width(), pixelbuffer.get_height()),
frame_delay(0),
@@ -107,6 +110,8 @@
surface = SDL_DisplayFormat(pixelbuffer.get_surface());
else
surface = SDL_DisplayFormatAlpha(pixelbuffer.get_surface());
+
+ optimized = true;
}
else
{
@@ -122,15 +127,20 @@
void optimize()
{
- // FIXME: Could add a check to check if the surface is already optimized
- SDL_Surface* old_surface = surface;
+ if (!optimized)
+ {
+ // FIXME: Could add a check to check if the surface is already
optimized
+ SDL_Surface* old_surface = surface;
- if (surface->format->Amask == 0)
- surface = SDL_DisplayFormat(old_surface);
- else
- surface = SDL_DisplayFormatAlpha(old_surface);
+ if (surface->format->Amask == 0)
+ surface = SDL_DisplayFormat(old_surface);
+ else
+ surface = SDL_DisplayFormatAlpha(old_surface);
- SDL_FreeSurface(old_surface);
+ SDL_FreeSurface(old_surface);
+
+ optimized = true;
+ }
}
void update(float delta)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3045 - trunk/pingus/src,
grumbel at BerliOS <=