changeset 107:01fcac5d146e

Fixed crash in testsprite when using the -fast option (nobody caught this?)
author Sam Lantinga <slouken@lokigames.com>
date Fri, 13 Jul 2001 10:20:43 +0000
parents 63ec24e0575f
children e021a4c9e25f
files test/testsprite.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/testsprite.c	Fri Jul 13 10:19:51 2001 +0000
+++ b/test/testsprite.c	Fri Jul 13 10:20:43 2001 +0000
@@ -92,7 +92,7 @@
 }
 
 /* This is a way of telling whether or not to use hardware surfaces */
-Uint32 FastestFlags(Uint32 flags)
+Uint32 FastestFlags(Uint32 flags, int width, int height, int bpp)
 {
 	const SDL_VideoInfo *info;
 
@@ -112,8 +112,7 @@
 		/* Direct hardware blitting without double-buffering
 		   causes really bad flickering.
 		 */
-		SDL_Surface *screen = SDL_GetVideoSurface();
-		if ( info->video_mem > (screen->h*screen->pitch) ) {
+		if ( info->video_mem*1024 > (height*width*bpp/8) ) {
 			flags |= SDL_DOUBLEBUF;
 		} else {
 			flags &= ~SDL_HWSURFACE;
@@ -164,7 +163,7 @@
 			--argc;
 		} else
 		if ( strcmp(argv[argc], "-fast") == 0 ) {
-			videoflags = FastestFlags(videoflags);
+			videoflags = FastestFlags(videoflags, width, height, video_bpp);
 		} else
 		if ( strcmp(argv[argc], "-hw") == 0 ) {
 			videoflags ^= SDL_HWSURFACE;