Fixed bug #421 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Mon, 13 Apr 2009 09:03:35 +0000
branchSDL-1.2
changeset 417334068be6aa0b
parent 4172 48f1406df2a8
child 4174 3370c734fd49
Fixed bug #421

Comment #3 From esigra@gmail.com 2008-04-09 11:46:46 (-) [reply] -------

This bug also needs to be fixed for SDL_GetRGB and SDL_GetRGBA (those should
not change the format of the surface either). Until this is fixed, I still need
to const_cast the format parameter in calls to those functions.
include/SDL_video.h
src/video/SDL_pixels.c
     1.1 --- a/include/SDL_video.h	Mon Apr 13 08:49:41 2009 +0000
     1.2 +++ b/include/SDL_video.h	Mon Apr 13 09:03:35 2009 +0000
     1.3 @@ -460,14 +460,16 @@
     1.4  /*
     1.5   * Maps a pixel value into the RGB components for a given pixel format
     1.6   */
     1.7 -extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
     1.8 +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
     1.9 +				const SDL_PixelFormat * const fmt,
    1.10  				Uint8 *r, Uint8 *g, Uint8 *b);
    1.11  
    1.12  /*
    1.13   * Maps a pixel value into the RGBA components for a given pixel format
    1.14   */
    1.15 -extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
    1.16 -				 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
    1.17 +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
    1.18 +				const SDL_PixelFormat * const fmt,
    1.19 +				Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
    1.20  
    1.21  /*
    1.22   * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
     2.1 --- a/src/video/SDL_pixels.c	Mon Apr 13 08:49:41 2009 +0000
     2.2 +++ b/src/video/SDL_pixels.c	Mon Apr 13 09:03:35 2009 +0000
     2.3 @@ -366,7 +366,7 @@
     2.4  	}
     2.5  }
     2.6  
     2.7 -void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
     2.8 +void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * const fmt,
     2.9  		 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
    2.10  {
    2.11  	if ( fmt->palette == NULL ) {
    2.12 @@ -400,7 +400,8 @@
    2.13  	}
    2.14  }
    2.15  
    2.16 -void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r,Uint8 *g,Uint8 *b)
    2.17 +void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * const fmt,
    2.18 +                Uint8 *r,Uint8 *g,Uint8 *b)
    2.19  {
    2.20  	if ( fmt->palette == NULL ) {
    2.21  	        /* the note for SDL_GetRGBA above applies here too */