stratagus-cvs
[Top][All Lists]
Advanced

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

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


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src/video sprite.c
Date: Sat, 22 Nov 2003 12:21:29 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Nehal Mistry <address@hidden>   03/11/22 12:21:29

Modified files:
        src/video      : sprite.c 

Log message:
        fix VideoDrawClip to clip correctly

Patches:
Index: stratagus/src/video/sprite.c
diff -u stratagus/src/video/sprite.c:1.42 stratagus/src/video/sprite.c:1.43
--- stratagus/src/video/sprite.c:1.42   Thu Nov 20 20:26:11 2003
+++ stratagus/src/video/sprite.c        Sat Nov 22 12:21:29 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: sprite.c,v 1.42 2003/11/21 01:26:11 nehalmistry Exp $
+//     $Id: sprite.c,v 1.43 2003/11/22 17:21:29 nehalmistry Exp $
 
 //@{
 
@@ -87,6 +87,30 @@
 
     SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
 }
+
+global void VideoDrawClip(const Graphic* sprite, unsigned frame, int x, int y)
+{
+    SDL_Rect srect;
+    SDL_Rect drect;
+    int oldx;
+    int oldy;
+
+    srect.x = (frame % (sprite->Surface->w / sprite->Width)) * sprite->Width;
+    srect.y = (frame / (sprite->Surface->w / sprite->Width)) * sprite->Height;
+    srect.w = sprite->Width;
+    srect.h = sprite->Height;
+
+    oldx = x;
+    oldy = y;    
+    CLIP_RECTANGLE(x, y, srect.w, srect.h);
+    srect.x += x - oldx;
+    srect.y += y - oldy;
+
+    drect.x = x;
+    drect.y = y;
+
+    SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
+}
 #else
 //
 //     The current implementation uses RLE encoded sprites.
@@ -480,26 +504,7 @@
 }
 #endif
 
-#ifdef USE_SDL_SURFACE
-global void VideoDrawClip(const Graphic* sprite, unsigned frame, int x, int y)
-{
-    SDL_Rect srect;
-    SDL_Rect drect;
-
-    srect.x = (frame % (sprite->Surface->w / sprite->Width)) * sprite->Width;
-    srect.y = (frame / (sprite->Surface->w / sprite->Width)) * sprite->Height;
-    srect.w = sprite->Width;
-
-    srect.h = sprite->Height;
-
-    CLIP_RECTANGLE(x, y, srect.w, srect.h);
-
-    drect.x = x;
-    drect.y = y;
-
-    SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
-}
-#else
+#ifndef
 /**
 **     Draw 8bit graphic object clipped into 8 bit framebuffer.
 **




reply via email to

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