From a038afba319658dafcf7d32e20b4aad4589af5c9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 16 Nov 2009 09:47:34 +0000 Subject: [PATCH] Thank you automated tests (and bobbens!), fixed alpha blending for accuracy --- src/video/SDL_blit.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index 0b4578847..c58a76a18 100644 --- a/src/video/SDL_blit.h +++ b/src/video/SDL_blit.h @@ -444,9 +444,9 @@ do { \ /* 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)