Commit 34da4efe authored by Sam Lantinga's avatar Sam Lantinga

Fixed crash in testsprite when using the -fast option (nobody caught this?)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40108
parent a079e297
...@@ -92,7 +92,7 @@ void MoveSprites(SDL_Surface *screen, Uint32 background) ...@@ -92,7 +92,7 @@ void MoveSprites(SDL_Surface *screen, Uint32 background)
} }
/* This is a way of telling whether or not to use hardware surfaces */ /* 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; const SDL_VideoInfo *info;
...@@ -112,8 +112,7 @@ Uint32 FastestFlags(Uint32 flags) ...@@ -112,8 +112,7 @@ Uint32 FastestFlags(Uint32 flags)
/* Direct hardware blitting without double-buffering /* Direct hardware blitting without double-buffering
causes really bad flickering. causes really bad flickering.
*/ */
SDL_Surface *screen = SDL_GetVideoSurface(); if ( info->video_mem*1024 > (height*width*bpp/8) ) {
if ( info->video_mem > (screen->h*screen->pitch) ) {
flags |= SDL_DOUBLEBUF; flags |= SDL_DOUBLEBUF;
} else { } else {
flags &= ~SDL_HWSURFACE; flags &= ~SDL_HWSURFACE;
...@@ -164,7 +163,7 @@ int main(int argc, char *argv[]) ...@@ -164,7 +163,7 @@ int main(int argc, char *argv[])
--argc; --argc;
} else } else
if ( strcmp(argv[argc], "-fast") == 0 ) { if ( strcmp(argv[argc], "-fast") == 0 ) {
videoflags = FastestFlags(videoflags); videoflags = FastestFlags(videoflags, width, height, video_bpp);
} else } else
if ( strcmp(argv[argc], "-hw") == 0 ) { if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags ^= SDL_HWSURFACE; videoflags ^= SDL_HWSURFACE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment