comparison src/video/SDL_pixels.c @ 4173:34068be6aa0b SDL-1.2

Fixed bug #421 Comment #3 From esigra@gmail.com 2008-04-09 11:46:46 (-) [reply] ------- This bug also needs to be fixed for SDL_GetRGB and SDL_GetRGBA (those should not change the format of the surface either). Until this is fixed, I still need to const_cast the format parameter in calls to those functions.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Apr 2009 09:03:35 +0000
parents a1b03ba2fcd0
children
comparison
equal deleted inserted replaced
4172:48f1406df2a8 4173:34068be6aa0b
364 } else { 364 } else {
365 return SDL_FindColor(format->palette, r, g, b); 365 return SDL_FindColor(format->palette, r, g, b);
366 } 366 }
367 } 367 }
368 368
369 void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, 369 void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * const fmt,
370 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) 370 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
371 { 371 {
372 if ( fmt->palette == NULL ) { 372 if ( fmt->palette == NULL ) {
373 /* 373 /*
374 * This makes sure that the result is mapped to the 374 * This makes sure that the result is mapped to the
398 *b = fmt->palette->colors[pixel].b; 398 *b = fmt->palette->colors[pixel].b;
399 *a = SDL_ALPHA_OPAQUE; 399 *a = SDL_ALPHA_OPAQUE;
400 } 400 }
401 } 401 }
402 402
403 void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r,Uint8 *g,Uint8 *b) 403 void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * const fmt,
404 Uint8 *r,Uint8 *g,Uint8 *b)
404 { 405 {
405 if ( fmt->palette == NULL ) { 406 if ( fmt->palette == NULL ) {
406 /* the note for SDL_GetRGBA above applies here too */ 407 /* the note for SDL_GetRGBA above applies here too */
407 unsigned v; 408 unsigned v;
408 v = (pixel & fmt->Rmask) >> fmt->Rshift; 409 v = (pixel & fmt->Rmask) >> fmt->Rshift;