From: Søren Sandmann Pedersen Date: Tue, 23 Jun 2009 17:41:27 +0000 (-0400) Subject: Write alpha map fetching with FbByteMul() instead of div_255() X-Git-Tag: pixman-0.15.14~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=039d4618f79e384d93a7548466f80acae6da738c;p=platform%2Fupstream%2Fpixman.git Write alpha map fetching with FbByteMul() instead of div_255() Delete the div_255/div_65535 macros. --- diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 82a480b..797bf85 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -29,8 +29,8 @@ #include #include #include "pixman-private.h" +#include "pixman-combine32.h" -#define Alpha(x) ((x) >> 24) #define Red(x) (((x) >> 16) & 0xff) #define Green(x) (((x) >> 8) & 0xff) #define Blue(x) ((x) & 0xff) @@ -171,14 +171,11 @@ bits_image_fetch_alpha_pixels (bits_image_t *image, uint32_t *buffer, int n_pixe for (j = 0; j < tmp_n_pixels; ++j) { int a = alpha_pixels[j] >> 24; - - buffer[i] = - (a << 24) | - div_255 (Red (buffer[2 * i - j]) * a) << 16 | - div_255 (Green (buffer[2 * i - j]) * a) << 8 | - div_255 (Blue (buffer[2 * i - j]) * a); - - i++; + uint32_t p = buffer[2 * i - j] | 0xff000000; + + FbByteMul (p, a); + + buffer[i++] = p; } } } diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 501139f..a39b6c4 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -319,8 +319,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, #define FbIntAdd(x,y,t) ( \ (t) = x + y, \ (uint32_t) (uint8_t) ((t) | (0 - ((t) >> 8)))) -#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) -#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16) #define PIXMAN_FORMAT_16BPC(f) (PIXMAN_FORMAT_A(f) > 8 || \ PIXMAN_FORMAT_R(f) > 8 || \