Fixed crash in testsprite when using the -fast option (nobody caught this?)
authorSam Lantinga <slouken@lokigames.com>
Fri, 13 Jul 2001 10:20:43 +0000
changeset 10701fcac5d146e
parent 106 63ec24e0575f
child 108 e021a4c9e25f
Fixed crash in testsprite when using the -fast option (nobody caught this?)
test/testsprite.c
     1.1 --- a/test/testsprite.c	Fri Jul 13 10:19:51 2001 +0000
     1.2 +++ b/test/testsprite.c	Fri Jul 13 10:20:43 2001 +0000
     1.3 @@ -92,7 +92,7 @@
     1.4  }
     1.5  
     1.6  /* This is a way of telling whether or not to use hardware surfaces */
     1.7 -Uint32 FastestFlags(Uint32 flags)
     1.8 +Uint32 FastestFlags(Uint32 flags, int width, int height, int bpp)
     1.9  {
    1.10  	const SDL_VideoInfo *info;
    1.11  
    1.12 @@ -112,8 +112,7 @@
    1.13  		/* Direct hardware blitting without double-buffering
    1.14  		   causes really bad flickering.
    1.15  		 */
    1.16 -		SDL_Surface *screen = SDL_GetVideoSurface();
    1.17 -		if ( info->video_mem > (screen->h*screen->pitch) ) {
    1.18 +		if ( info->video_mem*1024 > (height*width*bpp/8) ) {
    1.19  			flags |= SDL_DOUBLEBUF;
    1.20  		} else {
    1.21  			flags &= ~SDL_HWSURFACE;
    1.22 @@ -164,7 +163,7 @@
    1.23  			--argc;
    1.24  		} else
    1.25  		if ( strcmp(argv[argc], "-fast") == 0 ) {
    1.26 -			videoflags = FastestFlags(videoflags);
    1.27 +			videoflags = FastestFlags(videoflags, width, height, video_bpp);
    1.28  		} else
    1.29  		if ( strcmp(argv[argc], "-hw") == 0 ) {
    1.30  			videoflags ^= SDL_HWSURFACE;