Move mod and div macros to pixman-private.h
authorSøren Sandmann <sandmann@redhat.com>
Sat, 19 May 2007 21:19:39 +0000 (17:19 -0400)
committerSøren Sandmann <sandmann@redhat.com>
Sat, 19 May 2007 21:19:39 +0000 (17:19 -0400)
TODO
pixman/pixman-compose.c
pixman/pixman-pict.c
pixman/pixman-private.h

diff --git a/TODO b/TODO
index 2ccc28d..4bc4895 100644 (file)
--- a/TODO
+++ b/TODO
@@ -25,7 +25,7 @@
         have to be kept uptodate every time something changes about the
         picture.
 
-      - Break the X server ABI and simply have the releveant parameter
+      - Break the X server ABI and simply have the relevant parameter
         stored in the pixman image. This would have the additional benefits
         that:
 
index 50fa29e..ea153a4 100644 (file)
@@ -109,8 +109,6 @@ SourcePictureClassify (source_image_t *pict,
     return pict->class;
 }
 
-#define mod(a,b)       ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
 #define SCANLINE_BUFFER_LENGTH 2048
 
 typedef FASTCALL void (*fetchProc)(pixman_image_t *image,
@@ -3036,10 +3034,6 @@ static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buff
     fetch((pixman_image_t *)pict, bits, x, width, buffer, indexed);
 }
 
-#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
-#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :               \
-                 ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
-
 typedef struct
 {
     uint32_t        left_ag;
index f5d3991..5c4fe7a 100644 (file)
@@ -918,8 +918,6 @@ fbCompositeSolidMask_nx1xn (pixman_op_t op,
 #endif
 }
 
-# define mod(a,b)      ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
 /*
  * Apply a constant alpha value in an over computation
  */
@@ -1013,9 +1011,6 @@ compute_composite_region (pixman_region16_t *region,
     return TRUE;
 }
                          
-
-#define mod(a,b)       ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
-
 static void
 pixman_walk_composite_region (pixman_op_t op,
                              pixman_image_t * pSrc,
@@ -1059,13 +1054,13 @@ pixman_walk_composite_region (pixman_op_t op,
            x_dst = pbox->x1;
            if (maskRepeat)
            {
-               y_msk = mod (y_msk, pMask->bits.height);
+               y_msk = MOD (y_msk, pMask->bits.height);
                if (h_this > pMask->bits.height - y_msk)
                    h_this = pMask->bits.height - y_msk;
            }
            if (srcRepeat)
            {
-               y_src = mod (y_src, pSrc->bits.height);
+               y_src = MOD (y_src, pSrc->bits.height);
                if (h_this > pSrc->bits.height - y_src)
                    h_this = pSrc->bits.height - y_src;
            }
@@ -1074,13 +1069,13 @@ pixman_walk_composite_region (pixman_op_t op,
                w_this = w;
                if (maskRepeat)
                {
-                   x_msk = mod (x_msk, pMask->bits.width);
+                   x_msk = MOD (x_msk, pMask->bits.width);
                    if (w_this > pMask->bits.width - x_msk)
                        w_this = pMask->bits.width - x_msk;
                }
                if (srcRepeat)
                {
-                   x_src = mod (x_src, pSrc->bits.width);
+                   x_src = MOD (x_src, pSrc->bits.width);
                    if (w_this > pSrc->bits.width - x_src)
                        w_this = pSrc->bits.width - x_src;
                }
index fbb8cb7..8b42e62 100644 (file)
@@ -490,6 +490,16 @@ void pixmanCompositeRect (const FbComposeData *data,
 
 #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
 
+#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
+
+#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :               \
+                 ((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
+
+#if 0
+/* FIXME: the MOD macro above is equivalent, but faster I think */
+#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+#endif
+
 /* FIXME: the (void)__read_func hides lots of warnings (which is what they
  * are supposed to do), but some of them are real. For example the one
  * where Fetch4 doesn't have a READ