stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/video graphic.c


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src/video graphic.c
Date: 15 Jan 2004 17:57:09 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/15 17:57:09

Modified files:
        src/video      : graphic.c 

Log message:
        Fixed crash

Patches:
Index: stratagus/src/video/graphic.c
diff -u stratagus/src/video/graphic.c:1.64 stratagus/src/video/graphic.c:1.65
--- stratagus/src/video/graphic.c:1.64  Thu Jan 15 15:20:42 2004
+++ stratagus/src/video/graphic.c       Thu Jan 15 17:57:08 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: graphic.c,v 1.64 2004/01/15 04:20:42 jsalmon3 Exp $
+//      $Id: graphic.c,v 1.65 2004/01/15 06:57:08 jsalmon3 Exp $
 
 //@{
 
@@ -185,8 +185,6 @@
 global void VideoFree(Graphic* graphic)
 {
 #ifdef DEBUG
-       AllocatedGraphicMemory -=
-               graphic->Width * graphic->Height * 
graphic->Surface->format->BytesPerPixel;
        AllocatedGraphicMemory -= sizeof(Graphic);
 #endif
 
@@ -197,8 +195,14 @@
        }
 #endif
 
-       VideoPaletteListRemove(graphic->Surface);
-       SDL_FreeSurface(graphic->Surface);
+       if (graphic->Surface) {
+#ifdef DEBUG
+               AllocatedGraphicMemory -=
+                       graphic->Width * graphic->Height * 
graphic->Surface->format->BytesPerPixel;
+#endif
+               VideoPaletteListRemove(graphic->Surface);
+               SDL_FreeSurface(graphic->Surface);
+       }
        if (graphic->SurfaceFlip) {
 #ifdef DEBUG
                AllocatedGraphicMemory -=
@@ -442,7 +446,7 @@
                        int z;
                        SDL_Color p;
 
-                       c = (h - i - 1) * w * 4 + j * 4;
+                       c = i * w * 4 + j * 4;
                        for (z = 0; z < maplen; ++z) {
                                if (*sp == map[z * 2]) {
                                        p = 
TheMap.TileGraphic->Surface->format->palette->colors[map[z * 2 + 1]];




reply via email to

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