Move FbGet8() macro into pixman-bits-image.c
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Mon, 22 Jun 2009 23:38:58 +0000 (19:38 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Mon, 22 Jun 2009 23:38:58 +0000 (19:38 -0400)
It is only used for bilinear filtering now. Also some formatting
changes in pixman-private.h

pixman/pixman-bits-image.c
pixman/pixman-private.h

index 97acb0c..82a480b 100644 (file)
@@ -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;
index 8201545..131d6b0 100644 (file)
@@ -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