Skip to content

Commit

Permalink
Fixed bug #421
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Apr 13, 2009
1 parent 78ccd1d commit 53fa4bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions include/SDL_video.h
Expand Up @@ -460,14 +460,16 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
/*
* Maps a pixel value into the RGB components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
const SDL_PixelFormat * const fmt,
Uint8 *r, Uint8 *g, Uint8 *b);

/*
* Maps a pixel value into the RGBA components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
const SDL_PixelFormat * const fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);

/*
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
Expand Down
5 changes: 3 additions & 2 deletions src/video/SDL_pixels.c
Expand Up @@ -366,7 +366,7 @@ Uint32 SDL_MapRGBA
}
}

void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * const fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
{
if ( fmt->palette == NULL ) {
Expand Down Expand Up @@ -400,7 +400,8 @@ void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
}
}

void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r,Uint8 *g,Uint8 *b)
void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * const fmt,
Uint8 *r,Uint8 *g,Uint8 *b)
{
if ( fmt->palette == NULL ) {
/* the note for SDL_GetRGBA above applies here too */
Expand Down

0 comments on commit 53fa4bc

Please sign in to comment.