Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Merged r3007:3008 from branches/SDL-1.2: MapRGB/MapRGBA const correct…
Browse files Browse the repository at this point in the history
…ness.
  • Loading branch information
icculus committed Apr 4, 2007
1 parent d335b14 commit 411fee1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions include/SDL_video.h
Expand Up @@ -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 * Maps an RGB triple to an opaque pixel value for a given pixel format
*/ */
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * const format,
(SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b); const Uint8 r, const Uint8 g,
const Uint8 b);


/* /*
* Maps an RGBA quadruple to a pixel value for a given pixel format * Maps an RGBA quadruple to a pixel value for a given pixel format
*/ */
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat * format, extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * const fmt,
Uint8 r, Uint8 g, Uint8 b, const Uint8 r, const Uint8 g,
Uint8 a); const Uint8 b, const Uint8 a);


/* /*
* Maps a pixel value into the RGB components for a given pixel format * Maps a pixel value into the RGB components for a given pixel format
Expand Down
6 changes: 4 additions & 2 deletions src/video/SDL_pixels.c
Expand Up @@ -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 */ /* Find the opaque pixel value corresponding to an RGB triple */
Uint32 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) { if (format->palette == NULL) {
return (r >> format->Rloss) << format->Rshift return (r >> format->Rloss) << format->Rshift
Expand All @@ -550,7 +551,8 @@ SDL_MapRGB(SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)


/* Find the pixel value corresponding to an RGBA quadruple */ /* Find the pixel value corresponding to an RGBA quadruple */
Uint32 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) { if (format->palette == NULL) {
return (r >> format->Rloss) << format->Rshift return (r >> format->Rloss) << format->Rshift
Expand Down

0 comments on commit 411fee1

Please sign in to comment.