Mercurial > sdl-ios-xcode
comparison src/video/SDL_pixels.c @ 3932:cd5b5c52a37e SDL-1.2
Const correctness patch for SDL_MapRGB and SDL_MapRGBA.
Fixes Bugzilla #421.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 04 Apr 2007 09:40:40 +0000 |
parents | 61c237f69076 |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
3931:d65b4a73c991 | 3932:cd5b5c52a37e |
---|---|
335 } | 335 } |
336 return(pixel); | 336 return(pixel); |
337 } | 337 } |
338 | 338 |
339 /* Find the opaque pixel value corresponding to an RGB triple */ | 339 /* Find the opaque pixel value corresponding to an RGB triple */ |
340 Uint32 SDL_MapRGB(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b) | 340 Uint32 SDL_MapRGB |
341 (const SDL_PixelFormat * const format, | |
342 const Uint8 r, const Uint8 g, const Uint8 b) | |
341 { | 343 { |
342 if ( format->palette == NULL ) { | 344 if ( format->palette == NULL ) { |
343 return (r >> format->Rloss) << format->Rshift | 345 return (r >> format->Rloss) << format->Rshift |
344 | (g >> format->Gloss) << format->Gshift | 346 | (g >> format->Gloss) << format->Gshift |
345 | (b >> format->Bloss) << format->Bshift | 347 | (b >> format->Bloss) << format->Bshift |
348 return SDL_FindColor(format->palette, r, g, b); | 350 return SDL_FindColor(format->palette, r, g, b); |
349 } | 351 } |
350 } | 352 } |
351 | 353 |
352 /* Find the pixel value corresponding to an RGBA quadruple */ | 354 /* Find the pixel value corresponding to an RGBA quadruple */ |
353 Uint32 SDL_MapRGBA(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a) | 355 Uint32 SDL_MapRGBA |
356 (const SDL_PixelFormat * const format, | |
357 const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a) | |
354 { | 358 { |
355 if ( format->palette == NULL ) { | 359 if ( format->palette == NULL ) { |
356 return (r >> format->Rloss) << format->Rshift | 360 return (r >> format->Rloss) << format->Rshift |
357 | (g >> format->Gloss) << format->Gshift | 361 | (g >> format->Gloss) << format->Gshift |
358 | (b >> format->Bloss) << format->Bshift | 362 | (b >> format->Bloss) << format->Bshift |