From 411fee180730c3b93f679f032d9a4e5daa97541c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 4 Apr 2007 09:43:53 +0000 Subject: [PATCH] Merged r3007:3008 from branches/SDL-1.2: MapRGB/MapRGBA const correctness. --- include/SDL_video.h | 11 ++++++----- src/video/SDL_pixels.c | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/SDL_video.h b/include/SDL_video.h index 68c98dcef..0abe6d16f 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1300,15 +1300,16 @@ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); /* * 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); +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(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 fmt, + 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 --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c index ce2dafc00..18cc0bd6a 100644 --- a/src/video/SDL_pixels.c +++ b/src/video/SDL_pixels.c @@ -537,7 +537,8 @@ SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b) /* Find the opaque pixel value corresponding to an RGB triple */ Uint32 -SDL_MapRGB(SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b) +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 @@ -550,7 +551,8 @@ SDL_MapRGB(SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b) /* Find the pixel value corresponding to an RGBA quadruple */ Uint32 -SDL_MapRGBA(SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b, Uint8 a) +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