Const correctness patch for SDL_MapRGB and SDL_MapRGBA. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Wed, 04 Apr 2007 09:40:40 +0000
branchSDL-1.2
changeset 3932cd5b5c52a37e
parent 3931 d65b4a73c991
child 3933 3b5c90889156
Const correctness patch for SDL_MapRGB and SDL_MapRGBA.

Fixes Bugzilla #421.
include/SDL_video.h
src/video/SDL_pixels.c
     1.1 --- a/include/SDL_video.h	Wed Apr 04 09:32:29 2007 +0000
     1.2 +++ b/include/SDL_video.h	Wed Apr 04 09:40:40 2007 +0000
     1.3 @@ -447,13 +447,15 @@
     1.4   * Maps an RGB triple to an opaque pixel value for a given pixel format
     1.5   */
     1.6  extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
     1.7 -			(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
     1.8 +(const SDL_PixelFormat * const format,
     1.9 + const Uint8 r, const Uint8 g, const Uint8 b);
    1.10  
    1.11  /*
    1.12   * Maps an RGBA quadruple to a pixel value for a given pixel format
    1.13   */
    1.14 -extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format,
    1.15 -				   Uint8 r, Uint8 g, Uint8 b, Uint8 a);
    1.16 +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
    1.17 +(const SDL_PixelFormat * const format,
    1.18 + const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
    1.19  
    1.20  /*
    1.21   * Maps a pixel value into the RGB components for a given pixel format
     2.1 --- a/src/video/SDL_pixels.c	Wed Apr 04 09:32:29 2007 +0000
     2.2 +++ b/src/video/SDL_pixels.c	Wed Apr 04 09:40:40 2007 +0000
     2.3 @@ -337,7 +337,9 @@
     2.4  }
     2.5  
     2.6  /* Find the opaque pixel value corresponding to an RGB triple */
     2.7 -Uint32 SDL_MapRGB(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
     2.8 +Uint32 SDL_MapRGB
     2.9 +(const SDL_PixelFormat * const format,
    2.10 + const Uint8 r, const Uint8 g, const Uint8 b)
    2.11  {
    2.12  	if ( format->palette == NULL ) {
    2.13  		return (r >> format->Rloss) << format->Rshift
    2.14 @@ -350,7 +352,9 @@
    2.15  }
    2.16  
    2.17  /* Find the pixel value corresponding to an RGBA quadruple */
    2.18 -Uint32 SDL_MapRGBA(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
    2.19 +Uint32 SDL_MapRGBA
    2.20 +(const SDL_PixelFormat * const format,
    2.21 + const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
    2.22  {
    2.23  	if ( format->palette == NULL ) {
    2.24  	        return (r >> format->Rloss) << format->Rshift