changeset 3437:dc2911c207e4

Thank you automated tests (and bobbens!), fixed alpha blending for accuracy
author Sam Lantinga <slouken@libsdl.org>
date Mon, 16 Nov 2009 09:47:34 +0000
parents 0538362b98d3
children ca5663493497
files src/video/SDL_blit.h
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_blit.h	Mon Nov 16 07:39:08 2009 +0000
+++ b/src/video/SDL_blit.h	Mon Nov 16 09:47:34 2009 +0000
@@ -444,9 +444,9 @@
 /* Blend the RGB values of two Pixels based on a source alpha value */
 #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)	\
 do {						\
-	dR = (((sR-dR)*(A)+255)>>8)+dR;		\
-	dG = (((sG-dG)*(A)+255)>>8)+dG;		\
-	dB = (((sB-dB)*(A)+255)>>8)+dB;		\
+	dR = ((((int)(sR-dR)*(int)A)/255)+dR);	\
+	dG = ((((int)(sG-dG)*(int)A)/255)+dG);	\
+	dB = ((((int)(sB-dB)*(int)A)/255)+dB);	\
 } while(0)