Commit 7705734f authored by Sam Lantinga's avatar Sam Lantinga

*** empty log message ***

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40629
parent 29f7b231
...@@ -379,16 +379,16 @@ void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, ...@@ -379,16 +379,16 @@ void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
* This only works for RGB bit fields at least 4 bit * This only works for RGB bit fields at least 4 bit
* wide, which is almost always the case. * wide, which is almost always the case.
*/ */
unsigned rv, gv, bv, av; unsigned v;
rv = (pixel & fmt->Rmask) >> fmt->Rshift; v = (pixel & fmt->Rmask) >> fmt->Rshift;
*r = (rv << fmt->Rloss) + (rv >> (8 - fmt->Rloss)); *r = (v << fmt->Rloss) + (v >> (8 - fmt->Rloss));
gv = (pixel & fmt->Gmask) >> fmt->Gshift; v = (pixel & fmt->Gmask) >> fmt->Gshift;
*g = (gv << fmt->Gloss) + (gv >> (8 - fmt->Gloss)); *g = (v << fmt->Gloss) + (v >> (8 - fmt->Gloss));
bv = (pixel & fmt->Bmask) >> fmt->Bshift; v = (pixel & fmt->Bmask) >> fmt->Bshift;
*b = (bv << fmt->Bloss) + (bv >> (8 - fmt->Bloss)); *b = (v << fmt->Bloss) + (v >> (8 - fmt->Bloss));
if(fmt->Amask) { if(fmt->Amask) {
av = (pixel & fmt->Amask) >> fmt->Ashift; v = (pixel & fmt->Amask) >> fmt->Ashift;
*a = (av << fmt->Aloss) + (av >> (8 - fmt->Aloss)); *a = (v << fmt->Aloss) + (v >> (8 - fmt->Aloss));
} else } else
*a = SDL_ALPHA_OPAQUE; *a = SDL_ALPHA_OPAQUE;
} else { } else {
...@@ -403,13 +403,13 @@ void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r,Uint8 *g,Uint8 *b) ...@@ -403,13 +403,13 @@ void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r,Uint8 *g,Uint8 *b)
{ {
if ( fmt->palette == NULL ) { if ( fmt->palette == NULL ) {
/* the note for SDL_GetRGBA above applies here too */ /* the note for SDL_GetRGBA above applies here too */
unsigned rv, gv, bv; unsigned v;
rv = (pixel & fmt->Rmask) >> fmt->Rshift; v = (pixel & fmt->Rmask) >> fmt->Rshift;
*r = (rv << fmt->Rloss) + (rv >> (8 - fmt->Rloss)); *r = (v << fmt->Rloss) + (v >> (8 - fmt->Rloss));
gv = (pixel & fmt->Gmask) >> fmt->Gshift; v = (pixel & fmt->Gmask) >> fmt->Gshift;
*g = (gv << fmt->Gloss) + (gv >> (8 - fmt->Gloss)); *g = (v << fmt->Gloss) + (v >> (8 - fmt->Gloss));
bv = (pixel & fmt->Bmask) >> fmt->Bshift; v = (pixel & fmt->Bmask) >> fmt->Bshift;
*b = (bv << fmt->Bloss) + (bv >> (8 - fmt->Bloss)); *b = (v << fmt->Bloss) + (v >> (8 - fmt->Bloss));
} else { } else {
*r = fmt->palette->colors[pixel].r; *r = fmt->palette->colors[pixel].r;
*g = fmt->palette->colors[pixel].g; *g = fmt->palette->colors[pixel].g;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment