1
0

std_math.cpp 423 B

123456789101112131415161718
  1. #include "precomp_wasabi_bfc.h"
  2. #include "std_math.h"
  3. void premultiplyARGB32(ARGB32 *words, int nwords)
  4. {
  5. for (; nwords > 0; nwords--, words++)
  6. {
  7. unsigned char *pixel = (unsigned char *)words;
  8. unsigned int alpha = pixel[3];
  9. if (alpha == 255) continue;
  10. pixel[0] = (pixel[0] * alpha) >> 8; // blue
  11. pixel[1] = (pixel[1] * alpha) >> 8; // green
  12. pixel[2] = (pixel[2] * alpha) >> 8; // red
  13. }
  14. }