[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2571 - trunk/src/editor
From: |
jave27 |
Subject: |
[Pingus-CVS] r2571 - trunk/src/editor |
Date: |
Thu, 29 Dec 2005 23:10:39 +0100 |
Author: jave27
Date: 2005-12-29 23:10:36 +0100 (Thu, 29 Dec 2005)
New Revision: 2571
Modified:
trunk/src/editor/level_objs.cxx
Log:
Fixed the heap overflow issue - it was trying to rotate a null sprite.
Modified: trunk/src/editor/level_objs.cxx
===================================================================
--- trunk/src/editor/level_objs.cxx 2005-12-29 21:18:16 UTC (rev 2570)
+++ trunk/src/editor/level_objs.cxx 2005-12-29 22:10:36 UTC (rev 2571)
@@ -132,43 +132,46 @@
void
LevelObj::refresh_sprite()
{
- CL_PixelBuffer pb;
+ if (attribs & HAS_SURFACE)
+ {
+ CL_PixelBuffer pb;
- // Apply modifier, then change the sprite loaded for this object in
memory.
- if (stretch_x || stretch_y)
- {
- sprite = Resource::load_sprite(desc);
- float w = (float)sprite.get_width();
- float h = (float)sprite.get_height();
-
- // Determine the new dimensions for the sprite
- if (stretch_x && !stretch_y)
+ // Apply modifier, then change the sprite loaded for this
object in memory.
+ if (stretch_x || stretch_y)
{
- if (keep_aspect)
- h = h * CL_Display::get_width() / w;
- w = (float)CL_Display::get_width();
+ sprite = Resource::load_sprite(desc);
+ float w = (float)sprite.get_width();
+ float h = (float)sprite.get_height();
+
+ // Determine the new dimensions for the sprite
+ if (stretch_x && !stretch_y)
+ {
+ if (keep_aspect)
+ h = h * CL_Display::get_width() / w;
+ w = (float)CL_Display::get_width();
+ }
+ else if (stretch_y && !stretch_x)
+ {
+ if (keep_aspect)
+ w = w * CL_Display::get_height() / h;
+ h = (float)CL_Display::get_height();
+ }
+ else
+ {
+ w = (float)CL_Display::get_width();
+ h = (float)CL_Display::get_height();
+ }
+
+ pb = Blitter::scale_surface_to_canvas(
+ sprite.get_frame_pixeldata(0), (int)w, (int)h);
}
- else if (stretch_y && !stretch_x)
- {
- if (keep_aspect)
- w = w * CL_Display::get_height() / h;
- h = (float)CL_Display::get_height();
- }
- else
- {
- w = (float)CL_Display::get_width();
- h = (float)CL_Display::get_height();
- }
+ else // No stretch involved
+ pb = Resource::load_pixelbuffer(desc);
- pb = Blitter::scale_surface_to_canvas(
- sprite.get_frame_pixeldata(0), (int)w, (int)h);
+ CL_SpriteDescription sprite_desc;
+ sprite_desc.add_frame(pb);
+ sprite = CL_Sprite(sprite_desc);
}
- else // No stretch involved
- pb = Resource::load_pixelbuffer(desc);
-
- CL_SpriteDescription sprite_desc;
- sprite_desc.add_frame(pb);
- sprite = CL_Sprite(sprite_desc);
}
// Set the modifier and actually modify the sprite loaded in memory
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2571 - trunk/src/editor,
jave27 <=