src/video/SDL_blit.h
changeset 1047 ffaaf7ecf685
parent 769 b8d311d90021
child 1162 2651158f59b8
     1.1 --- a/src/video/SDL_blit.h	Sun Apr 17 10:16:30 2005 +0000
     1.2 +++ b/src/video/SDL_blit.h	Sun Apr 17 10:19:22 2005 +0000
     1.3 @@ -374,6 +374,20 @@
     1.4  	dB = (((sB-dB)*(A))>>8)+dB;		\
     1.5  } while(0)
     1.6  
     1.7 +/* Blend the RGB values of two pixels based on a source alpha value */
     1.8 +#define ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB)	\
     1.9 +do {						\
    1.10 +    unsigned tR, tG, tB, tA; \
    1.11 +    tA = 255 - sA; \
    1.12 +    tR = 1 + (sR * sA) + (dR * tA); \
    1.13 +    dR = (tR + (tR >> 8)) >> 8; \
    1.14 +    tG = 1 + (sG * sA) + (dG * tA); \
    1.15 +    dG = (tG + (tG >> 8)) >> 8; \
    1.16 +    tB = 1 + (sB * sA) + (dB * tA); \
    1.17 +    dB = (tB + (tB >> 8)) >> 8; \
    1.18 +} while(0)
    1.19 +
    1.20 +
    1.21  /* This is a very useful loop for optimizing blitters */
    1.22  #if defined(_MSC_VER) && (_MSC_VER == 1300)
    1.23  /* There's a bug in the Visual C++ 7 optimizer when compiling this code */