Thank you automated tests (and bobbens!), fixed alpha blending for accuracy
authorSam Lantinga
Mon, 16 Nov 2009 09:47:34 +0000
changeset 3437dc2911c207e4
parent 3436 0538362b98d3
child 3438 ca5663493497
Thank you automated tests (and bobbens!), fixed alpha blending for accuracy
src/video/SDL_blit.h
     1.1 --- a/src/video/SDL_blit.h	Mon Nov 16 07:39:08 2009 +0000
     1.2 +++ b/src/video/SDL_blit.h	Mon Nov 16 09:47:34 2009 +0000
     1.3 @@ -444,9 +444,9 @@
     1.4  /* Blend the RGB values of two Pixels based on a source alpha value */
     1.5  #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
     1.6  do {						\
     1.7 -	dR = (((sR-dR)*(A)+255)>>8)+dR;		\
     1.8 -	dG = (((sG-dG)*(A)+255)>>8)+dG;		\
     1.9 -	dB = (((sB-dB)*(A)+255)>>8)+dB;		\
    1.10 +	dR = ((((int)(sR-dR)*(int)A)/255)+dR);	\
    1.11 +	dG = ((((int)(sG-dG)*(int)A)/255)+dG);	\
    1.12 +	dB = ((((int)(sB-dB)*(int)A)/255)+dB);	\
    1.13  } while(0)
    1.14  
    1.15