# HG changeset patch # User Sam Lantinga # Date 1054182553 0 # Node ID e561e8752d33023383ca7556c4e679ae3b0013fe # Parent 8b9ac38381d0d8d745bd55462d541394cb0b1522 *** empty log message *** diff -r 8b9ac38381d0 -r e561e8752d33 src/video/SDL_pixels.c --- a/src/video/SDL_pixels.c Thu May 29 04:25:29 2003 +0000 +++ b/src/video/SDL_pixels.c Thu May 29 04:29:13 2003 +0000 @@ -379,16 +379,16 @@ * This only works for RGB bit fields at least 4 bit * wide, which is almost always the case. */ - unsigned rv, gv, bv, av; - rv = (pixel & fmt->Rmask) >> fmt->Rshift; - *r = (rv << fmt->Rloss) + (rv >> (8 - fmt->Rloss)); - gv = (pixel & fmt->Gmask) >> fmt->Gshift; - *g = (gv << fmt->Gloss) + (gv >> (8 - fmt->Gloss)); - bv = (pixel & fmt->Bmask) >> fmt->Bshift; - *b = (bv << fmt->Bloss) + (bv >> (8 - fmt->Bloss)); + unsigned v; + v = (pixel & fmt->Rmask) >> fmt->Rshift; + *r = (v << fmt->Rloss) + (v >> (8 - fmt->Rloss)); + v = (pixel & fmt->Gmask) >> fmt->Gshift; + *g = (v << fmt->Gloss) + (v >> (8 - fmt->Gloss)); + v = (pixel & fmt->Bmask) >> fmt->Bshift; + *b = (v << fmt->Bloss) + (v >> (8 - fmt->Bloss)); if(fmt->Amask) { - av = (pixel & fmt->Amask) >> fmt->Ashift; - *a = (av << fmt->Aloss) + (av >> (8 - fmt->Aloss)); + v = (pixel & fmt->Amask) >> fmt->Ashift; + *a = (v << fmt->Aloss) + (v >> (8 - fmt->Aloss)); } else *a = SDL_ALPHA_OPAQUE; } else { @@ -403,13 +403,13 @@ { if ( fmt->palette == NULL ) { /* the note for SDL_GetRGBA above applies here too */ - unsigned rv, gv, bv; - rv = (pixel & fmt->Rmask) >> fmt->Rshift; - *r = (rv << fmt->Rloss) + (rv >> (8 - fmt->Rloss)); - gv = (pixel & fmt->Gmask) >> fmt->Gshift; - *g = (gv << fmt->Gloss) + (gv >> (8 - fmt->Gloss)); - bv = (pixel & fmt->Bmask) >> fmt->Bshift; - *b = (bv << fmt->Bloss) + (bv >> (8 - fmt->Bloss)); + unsigned v; + v = (pixel & fmt->Rmask) >> fmt->Rshift; + *r = (v << fmt->Rloss) + (v >> (8 - fmt->Rloss)); + v = (pixel & fmt->Gmask) >> fmt->Gshift; + *g = (v << fmt->Gloss) + (v >> (8 - fmt->Gloss)); + v = (pixel & fmt->Bmask) >> fmt->Bshift; + *b = (v << fmt->Bloss) + (v >> (8 - fmt->Bloss)); } else { *r = fmt->palette->colors[pixel].r; *g = fmt->palette->colors[pixel].g;