[Tux4kids-commits] r590 - tuxmath/branches/factroids/src

tholy-guest at alioth.debian.org tholy-guest at alioth.debian.org
Wed Aug 6 10:21:28 UTC 2008


Author: tholy-guest
Date: 2008-08-06 10:21:27 +0000 (Wed, 06 Aug 2008)
New Revision: 590

Modified:
   tuxmath/branches/factroids/src/factroids.c
Log:
Speed optimizations in factroids. This improves the animation a lot.


Modified: tuxmath/branches/factroids/src/factroids.c
===================================================================
--- tuxmath/branches/factroids/src/factroids.c	2008-08-06 02:55:05 UTC (rev 589)
+++ tuxmath/branches/factroids/src/factroids.c	2008-08-06 10:21:27 UTC (rev 590)
@@ -353,6 +353,7 @@
 /************ Initialize all vars... ****************/
 static int FF_init(void){
   int i;
+  SDL_Surface *tmp;
   SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   SDL_Flip(screen);
   bkg_h=(images[BG_STARS]->h)>>1;
@@ -360,6 +361,11 @@
   bgSrc.x=0;
   bgSrc.w=screen->w;
   bgSrc.h=screen->h;
+  // Optimize the background surface so it doesn't take too much time to draw
+  SDL_SetAlpha(images[BG_STARS],SDL_RLEACCEL,SDL_ALPHA_OPAQUE);  // turn off transparency, since it's the background
+  tmp = SDL_DisplayFormat(images[BG_STARS]);  // optimize the format
+  SDL_FreeSurface(images[BG_STARS]);
+  images[BG_STARS] = tmp;
   
   escape_received = 0;
   game_status = GAME_IN_PROGRESS;  




More information about the Tux4kids-commits mailing list