comparison src/video/SDL_blit.h @ 1047:ffaaf7ecf685

Altivec-optimized blitters! Vast majority of this work is compliments of Bob Ippolito. http://www.devolution.com/pipermail/sdl/2005-February/067466.html and many other posts.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 17 Apr 2005 10:19:22 +0000
parents b8d311d90021
children 2651158f59b8
comparison
equal deleted inserted replaced
1046:f09d5edfc7a3 1047:ffaaf7ecf685
372 dR = (((sR-dR)*(A))>>8)+dR; \ 372 dR = (((sR-dR)*(A))>>8)+dR; \
373 dG = (((sG-dG)*(A))>>8)+dG; \ 373 dG = (((sG-dG)*(A))>>8)+dG; \
374 dB = (((sB-dB)*(A))>>8)+dB; \ 374 dB = (((sB-dB)*(A))>>8)+dB; \
375 } while(0) 375 } while(0)
376 376
377 /* Blend the RGB values of two pixels based on a source alpha value */
378 #define ACCURATE_ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB) \
379 do { \
380 unsigned tR, tG, tB, tA; \
381 tA = 255 - sA; \
382 tR = 1 + (sR * sA) + (dR * tA); \
383 dR = (tR + (tR >> 8)) >> 8; \
384 tG = 1 + (sG * sA) + (dG * tA); \
385 dG = (tG + (tG >> 8)) >> 8; \
386 tB = 1 + (sB * sA) + (dB * tA); \
387 dB = (tB + (tB >> 8)) >> 8; \
388 } while(0)
389
390
377 /* This is a very useful loop for optimizing blitters */ 391 /* This is a very useful loop for optimizing blitters */
378 #if defined(_MSC_VER) && (_MSC_VER == 1300) 392 #if defined(_MSC_VER) && (_MSC_VER == 1300)
379 /* There's a bug in the Visual C++ 7 optimizer when compiling this code */ 393 /* There's a bug in the Visual C++ 7 optimizer when compiling this code */
380 #else 394 #else
381 #define USE_DUFFS_LOOP 395 #define USE_DUFFS_LOOP