Eliminate FbStipMask macro.
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 21 Jun 2009 20:45:17 +0000 (16:45 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 21 Jun 2009 20:45:17 +0000 (16:45 -0400)
It was only used for storing into a1 images, and that code could be
written more clearly by computing the bit index directly.

pixman/pixman-access.c
pixman/pixman-private.h

index 8a5a1f5..8fa1c9d 100644 (file)
@@ -2427,11 +2427,16 @@ fbStore_a1 (pixman_image_t *image,
            uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
     int i;
-    for (i = 0; i < width; ++i) {
+    for (i = 0; i < width; ++i)
+    {
        uint32_t  *pixel = ((uint32_t *) bits) + ((i+x) >> 5);
-       uint32_t  mask = FbStipMask((i+x) & 0x1f, 1);
-
-       uint32_t v = values[i] & 0x80000000 ? mask : 0;
+       uint32_t mask, v;
+#ifdef WORDS_BIGENDIAN
+       mask = 1 << (0x1f - ((i+x) & 0x1f));
+#else
+       mask = 1 << ((i+x) & 0x1f);
+#endif
+       v = values[i] & 0x80000000 ? mask : 0;
        WRITE(image, pixel, (READ(image, pixel) & ~mask) | v);
     }
 }
@@ -2441,11 +2446,17 @@ fbStore_g1 (pixman_image_t *image,
            uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed)
 {
     int i;
-    for (i = 0; i < width; ++i) {
+    for (i = 0; i < width; ++i)
+    {
        uint32_t  *pixel = ((uint32_t *) bits) + ((i+x) >> 5);
-       uint32_t  mask = FbStipMask((i+x) & 0x1f, 1);
+       uint32_t  mask, v;
 
-       uint32_t v = miIndexToEntY24(indexed,values[i]) ? mask : 0;
+#ifdef WORDS_BIGENDIAN
+       mask = 1 << (0x1f - ((i+x) & 0x1f));
+#else
+       mask = 1 << ((i + x) & 0x1f);
+#endif
+       v = miIndexToEntY24 (indexed, values[i]) ? mask : 0;
        WRITE(image, pixel, (READ(image, pixel) & ~mask) | v);
     }
 }
index 753d705..d701288 100644 (file)
@@ -392,10 +392,7 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t       *walker,
 
 #define FbStipLeft(x,n)        FbScrLeft(x,n)
 #define FbStipRight(x,n) FbScrRight(x,n)
-#define FbStipMask(x,w)        (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
-                        FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
-
-#define FbLeftMask(x)       ( ((x) & FB_MASK) ? \
+#define FbLeftMask(x)       ( ((x) & FB_MASK) ?        \
                              FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
 #define FbRightMask(x)      ( ((FB_UNIT - (x)) & FB_MASK) ? \
                              FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)