From fe8ef09e9835f90b669a2b1ddfda49e839d6de53 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Mon, 22 Jun 2009 19:38:58 -0400 Subject: [PATCH] Move FbGet8() macro into pixman-bits-image.c It is only used for bilinear filtering now. Also some formatting changes in pixman-private.h --- pixman/pixman-bits-image.c | 2 ++ pixman/pixman-private.h | 19 +++---------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 97acb0c..82a480b 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -339,6 +339,8 @@ bits_image_fetch_bilinear_pixels (bits_image_t *image, uint32_t *buffer, int n_p idistx = 256 - distx; idisty = 256 - disty; + +#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i)) ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 8201545..131d6b0 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -307,15 +307,13 @@ uint32_t _pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, pixman_fixed_32_32_t x); -#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) +#define FbIntMult(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8)) #define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b)) - #define FbIntAdd(x,y,t) ( \ (t) = x + y, \ (uint32_t) (uint8_t) ((t) | (0 - ((t) >> 8)))) - -#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i)) - +#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) +#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16) #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 5) & 0x07e0) | \ @@ -324,17 +322,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) -/* - * There are two ways of handling alpha -- either as a single unified value or - * a separate value for each component, hence each macro must have two - * versions. The unified alpha version has a 'U' at the end of the name, - * the component version has a 'C'. Similarly, functions which deal with - * this difference will have two versions using the same convention. - */ - -#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) -#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16) - #ifdef PIXMAN_FB_ACCESSORS #define ACCESS(sym) sym##_accessors -- 2.7.4