stratagus-cvs
[Top][All Lists]
Advanced

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

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


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src game/intro.c video/graphic.c
Date: Sat, 22 Nov 2003 17:50:51 -0500

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

Modified files:
        src/game       : intro.c 
        src/video      : graphic.c 

Log message:
        small speed improvements to intro

Patches:
Index: stratagus/src/game/intro.c
diff -u stratagus/src/game/intro.c:1.108 stratagus/src/game/intro.c:1.109
--- stratagus/src/game/intro.c:1.108    Sat Nov 22 17:32:31 2003
+++ stratagus/src/game/intro.c  Sat Nov 22 17:50:50 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: intro.c,v 1.108 2003/11/22 22:32:31 nehalmistry Exp $
+//     $Id: intro.c,v 1.109 2003/11/22 22:50:50 nehalmistry Exp $
 
 //@{
 
@@ -820,11 +820,12 @@
     max = chapter->Data.Picture.FadeIn;
     while (IntroNoEvent && i < max) {
 #ifdef USE_SDL_SURFACE
+       VideoClearScreen();
        VideoDrawSubClipFaded(background, 0, 0,
            background->Width, background->Height,
            (VideoWidth - background->Width) / 2,
            (VideoHeight - background->Height) / 2,
-           255 - (255 * i / max));
+           255 * i / max);
        PictureDrawText(chapter, lines);
 #else
        VideoLockScreen();
@@ -880,11 +881,12 @@
     max = chapter->Data.Picture.FadeOut;
     while (i >= 0) {
 #ifdef USE_SDL_SURFACE
+       VideoClearScreen();
        VideoDrawSubClipFaded(background, 0, 0,
            background->Width, background->Height,
            (VideoWidth - background->Width) / 2,
            (VideoHeight - background->Height) / 2,
-           255 - (255 * i / max));
+           255 * i / max);
        PictureDrawText(chapter, lines);
 #else
        VideoLockScreen();
Index: stratagus/src/video/graphic.c
diff -u stratagus/src/video/graphic.c:1.52 stratagus/src/video/graphic.c:1.53
--- stratagus/src/video/graphic.c:1.52  Thu Nov 20 02:59:45 2003
+++ stratagus/src/video/graphic.c       Sat Nov 22 17:50:50 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: graphic.c,v 1.52 2003/11/20 07:59:45 nehalmistry Exp $
+//     $Id: graphic.c,v 1.53 2003/11/22 22:50:50 nehalmistry Exp $
 
 //@{
 
@@ -82,17 +82,22 @@
     drect.x = x;
     drect.y = y;
 
-    CLIP_RECTANGLE(gx, gy, w, h);
-
     SDL_BlitSurface(graphic->Surface, &srect, TheScreen, &drect);
-//    InvalidateArea(x, y, w, h);
 }
 
 global void VideoDrawSubClip(const Graphic* graphic, int gx, int gy,
     int w, int h, int x, int y)
 {
+    CLIP_RECTANGLE(gx, gy, w, h);
+    VideoDrawSub(graphic, gx, gy, w, h, x, y);
+}
+
+global void VideoDrawSubFaded(const Graphic* graphic, int gx, int gy,
+    int w, int h, int x, int y, unsigned char fade)
+{
     SDL_Rect srect;
     SDL_Rect drect;
+    int alpha;
 
     srect.x = gx;
     srect.y = gy;
@@ -102,11 +107,17 @@
     drect.x = x;
     drect.y = y;
 
-    CLIP_RECTANGLE(gx, gy, w, h);
-
+    alpha = graphic->Surface->format->alpha;
+    SDL_SetAlpha(graphic->Surface, SDL_SRCALPHA, fade);
     SDL_BlitSurface(graphic->Surface, &srect, TheScreen, &drect);
-//    InvalidateArea(x, y, w, h);
-//    Invalidate();
+    SDL_SetAlpha(graphic->Surface, SDL_SRCALPHA, alpha);
+}
+
+global void VideoDrawSubClipFaded(Graphic* graphic, int gx, int gy,
+    int w, int h, int x, int y, unsigned char fade)
+{
+    CLIP_RECTANGLE(gx, gy, w, h);
+    VideoDrawSubFaded(graphic, gx, gy, w, h, x, y, fade);
 }
 
 #else
@@ -480,6 +491,7 @@
 --     Global functions
 ----------------------------------------------------------------------------*/
 
+#ifndef USE_SDL_SURFACE
 /**
 **     Video draw part of a graphic clipped and faded.
 **
@@ -498,6 +510,7 @@
     VideoDrawSubClip(graphic, gx, gy, w, h, x, y);
     VideoFillTransRectangle(ColorBlack, x, y, w, h, fade);
 }
+#endif
 
 /**
 **     Make a graphic object.




reply via email to

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