# HG changeset patch # User Ryan C. Gordon # Date 1175679640 0 # Node ID cd5b5c52a37e6de550335bb034bc8b9e8c918b3d # Parent d65b4a73c9911e039a196c2a02ccdd135d7ca601 Const correctness patch for SDL_MapRGB and SDL_MapRGBA. Fixes Bugzilla #421. diff -r d65b4a73c991 -r cd5b5c52a37e include/SDL_video.h --- a/include/SDL_video.h Wed Apr 04 09:32:29 2007 +0000 +++ b/include/SDL_video.h Wed Apr 04 09:40:40 2007 +0000 @@ -447,13 +447,15 @@ * Maps an RGB triple to an opaque pixel value for a given pixel format */ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB - (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b); /* * Maps an RGBA quadruple to a pixel value for a given pixel format */ -extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format, - Uint8 r, Uint8 g, Uint8 b, Uint8 a); +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); /* * Maps a pixel value into the RGB components for a given pixel format diff -r d65b4a73c991 -r cd5b5c52a37e src/video/SDL_pixels.c --- a/src/video/SDL_pixels.c Wed Apr 04 09:32:29 2007 +0000 +++ b/src/video/SDL_pixels.c Wed Apr 04 09:40:40 2007 +0000 @@ -337,7 +337,9 @@ } /* Find the opaque pixel value corresponding to an RGB triple */ -Uint32 SDL_MapRGB(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b) +Uint32 SDL_MapRGB +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b) { if ( format->palette == NULL ) { return (r >> format->Rloss) << format->Rshift @@ -350,7 +352,9 @@ } /* Find the pixel value corresponding to an RGBA quadruple */ -Uint32 SDL_MapRGBA(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a) +Uint32 SDL_MapRGBA +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a) { if ( format->palette == NULL ) { return (r >> format->Rloss) << format->Rshift