Mercurial > sdl-ios-xcode
diff src/video/photon/SDL_ph_video.c @ 370:ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
From: Mike Gorchak <mike@malva.ua>
Subject: New QNX patches
- Added more error check to avoid SEGFAULTS;
- Fixed bug in update function for SDL_HWSURFACE. BTW: update is much
faster than before.
- Added checks for SDL_HWSURFACE flag, chosen bpp must be equal to
desktop bpp for SDL_HWSURFACE.
- Fixed overlay bug, no more SEGFAULTS.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 May 2002 19:54:01 +0000 |
parents | 66f815c147ed |
children | bce7171e7a85 |
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_video.c Sun May 19 19:52:32 2002 +0000 +++ b/src/video/photon/SDL_ph_video.c Sun May 19 19:54:01 2002 +0000 @@ -255,6 +255,16 @@ if ((flags & SDL_OPENGL)!=SDL_OPENGL) { pargc=0; + + // prevent using HWSURFACE in window mode if desktop bpp != chosen bpp + if ((flags & SDL_HWSURFACE) && (!(flags & SDL_FULLSCREEN))) + { + if (desktopbpp!=bpp) + { + fprintf(stderr, "ph_SetVideoMode(): SDL_HWSURFACE available only with chosen bpp equal desktop bpp !\n"); + return NULL; + } + } PtSetArg(&arg[pargc++], Pt_ARG_DIM, &dim, 0); PtSetArg(&arg[pargc++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED); @@ -317,7 +327,7 @@ #else if (flags & SDL_OPENGL) /* if no built-in OpenGL support */ { - fprintf(stderr, "error: no OpenGL support, try to recompile library.\n"); + fprintf(stderr, "ph_SetVideoMode(): no OpenGL support, try to recompile library.\n"); current->flags=(flags & (~SDL_OPENGL)); return NULL; #endif /* HAVE_OPENGL */ @@ -332,7 +342,7 @@ { if ((mode = get_mode_any_format(width, height, bpp)) == 0) { - fprintf(stderr,"error: get_mode_any_format failed\n"); + fprintf(stderr,"ph_SetVideoMode(): get_mode_any_format failed !\n"); exit(1); } } @@ -340,7 +350,7 @@ { if ((mode = get_mode(width, height, bpp)) == 0) { - fprintf(stderr,"error: get_mode failed\n"); + fprintf(stderr,"ph_SetVideoMode(): get_mode failed !\n"); exit(1); } } @@ -362,7 +372,7 @@ if (PgSetVideoMode(&settings) < 0) { - fprintf(stderr,"error: PgSetVideoMode failed\n"); + fprintf(stderr,"ph_SetVideoMode(): PgSetVideoMode failed !\n"); } current->flags = (flags & (~SDL_RESIZABLE)); /* no resize for Direct Context */ @@ -424,8 +434,15 @@ current->format->BitsPerPixel = bpp; current->format->BytesPerPixel = (bpp+7)/8; current->pitch = SDL_CalculatePitch(current); + /* Must call at least once it setup image planes */ - ph_ResizeImage(this, current, flags); + rtnval = ph_ResizeImage(this, current, flags); + + if (rtnval==-1) + { + fprintf(stderr,"ph_SetVideoMode(): ph_ResizeImage failed !\n"); + return NULL; + } /* delayed set caption call */ if (captionflag) @@ -512,9 +529,10 @@ SDL_Image->palette[i] |= colors[i-firstcolor].g<<8; SDL_Image->palette[i] |= colors[i-firstcolor].b; } + + /* image needs to be redrawed, very slow method */ + PgDrawPhImage(&point, SDL_Image, 0); } - /* image needs to be redrawed, very slow method */ - PgDrawPhImage(&point, SDL_Image, 0); } else { @@ -533,7 +551,10 @@ /* window mode must use soft palette */ PgSetPalette((PgColor_t*)&syspalph[firstcolor], 0, firstcolor, ncolors, Pg_PALSET_SOFT, 0); /* image needs to be redrawed, very slow method */ - PgDrawPhImage(&point, SDL_Image, 0); + if (SDL_Image) + { + PgDrawPhImage(&point, SDL_Image, 0); + } } else { @@ -602,7 +623,7 @@ if (oglctx==NULL) { - fprintf(stderr,"ph_SetupOpenGLContext: cannot create OpenGL context.\n"); + fprintf(stderr,"ph_SetupOpenGLContext(): cannot create OpenGL context.\n"); return (-1); }