Author: grumbel
Date: 2007-08-14 16:59:58 +0200 (Tue, 14 Aug 2007)
New Revision: 2899
Modified:
branches/pingus_sdl/src/sprite.cpp
Log:
- do nothing when the new_surface is the same as the current
Modified: branches/pingus_sdl/src/sprite.cpp
===================================================================
--- branches/pingus_sdl/src/sprite.cpp 2007-08-14 14:49:24 UTC (rev 2898)
+++ branches/pingus_sdl/src/sprite.cpp 2007-08-14 14:59:58 UTC (rev 2899)
@@ -178,20 +178,23 @@
void set_surface(SDL_Surface* new_surface)
{
- SDL_FreeSurface(surface);
- surface = new_surface;
+ if (surface != new_surface)
+ {
+ SDL_FreeSurface(surface);
+ surface = new_surface;
- if (sprite_description)
- {
- frame_size.width = (sprite_description->frame_size.width == -1) ?
surface->w : sprite_description->frame_size.width;
- frame_size.height = (sprite_description->frame_size.height == -1) ?
surface->h : sprite_description->frame_size.height;
- offset = calc_origin(sprite_description->origin, frame_size) -
sprite_description->offset;
+ if (sprite_description)
+ {
+ frame_size.width = (sprite_description->frame_size.width == -1)
? surface->w : sprite_description->frame_size.width;
+ frame_size.height = (sprite_description->frame_size.height == -1)
? surface->h : sprite_description->frame_size.height;
+ offset = calc_origin(sprite_description->origin, frame_size) -
sprite_description->offset;
+ }
+ else
+ {
+ frame_size.width = surface->w;
+ frame_size.height = surface->h;
+ }
}
- else
- {
- frame_size.width = surface->w;
- frame_size.height = surface->h;
- }
}
};
_______________________________________________
pingus-cvs mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pingus-cvs