Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit.h @ 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 | 90aec03bf9fd |
children | 83910f4c373f |
comparison
equal
deleted
inserted
replaced
3436:0538362b98d3 | 3437:dc2911c207e4 |
---|---|
442 } | 442 } |
443 | 443 |
444 /* Blend the RGB values of two Pixels based on a source alpha value */ | 444 /* Blend the RGB values of two Pixels based on a source alpha value */ |
445 #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \ | 445 #define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \ |
446 do { \ | 446 do { \ |
447 dR = (((sR-dR)*(A)+255)>>8)+dR; \ | 447 dR = ((((int)(sR-dR)*(int)A)/255)+dR); \ |
448 dG = (((sG-dG)*(A)+255)>>8)+dG; \ | 448 dG = ((((int)(sG-dG)*(int)A)/255)+dG); \ |
449 dB = (((sB-dB)*(A)+255)>>8)+dB; \ | 449 dB = ((((int)(sB-dB)*(int)A)/255)+dB); \ |
450 } while(0) | 450 } while(0) |
451 | 451 |
452 | 452 |
453 /* This is a very useful loop for optimizing blitters */ | 453 /* This is a very useful loop for optimizing blitters */ |
454 #if defined(_MSC_VER) && (_MSC_VER == 1300) | 454 #if defined(_MSC_VER) && (_MSC_VER == 1300) |