Delete FbIntMult and FbIntDiv macros, and move FbIntAdd to pixman-combine.h
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Tue, 23 Jun 2009 22:41:35 +0000 (18:41 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Wed, 24 Jun 2009 16:37:46 +0000 (12:37 -0400)
pixman/make-combine.pl
pixman/pixman-combine.c.template
pixman/pixman-combine.h.template
pixman/pixman-fast-path.c
pixman/pixman-mmx.c
pixman/pixman-private.h
pixman/pixman-sse2.c
test/clip-test.c

index 3eb3d35..8f31259 100644 (file)
@@ -1,4 +1,4 @@
-$usage = "Usage: combine.pl { 8 | 16 } < combine.inc";
+$usage = "Usage: combine.pl { 8 | 16 } < pixman-combine.c.template";
 
 $#ARGV == 0 or die $usage;
 
index 53edba0..582c63e 100644 (file)
@@ -1056,6 +1056,11 @@ fbCombineConjointInPart (comp1_t a, comp1_t b)
     return IntDiv(b,a);     /* b/a */
 }
 
+#define GetComp(v,i)   ((comp2_t) (comp1_t) ((v) >> i))
+
+#define Add(x,y,i,t)   ((t) = GetComp(x,i) + GetComp(y,i),              \
+                        (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
+
 #define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
                                         IntMult(GetComp(x,i),ax,(v))), \
                                         (comp4_t) ((comp1_t) ((t) |            \
index 9f64e85..35b4c18 100644 (file)
 
 #define IntMult(a,b,t) ( (t) = (a) * (b) + ONE_HALF, ( ( ( (t)>>G_SHIFT ) + (t) )>>G_SHIFT ) )
 #define IntDiv(a,b)    (((comp2_t) (a) * MASK) / (b))
-
-#define GetComp(v,i)   ((comp2_t) (comp1_t) ((v) >> i))
-
-#define Add(x,y,i,t)   ((t) = GetComp(x,i) + GetComp(y,i),              \
-                        (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
+#define IntAdd(x,y,t) (                                                        \
+       (t) = x + y,                                                    \
+       (comp4_t) (comp1_t) ((t) | (0 - ((t) >> G_SHIFT))))
 
 #define DivOne(x)      (((x) + ONE_HALF + (((x) + ONE_HALF) >> G_SHIFT)) >> G_SHIFT)
 
index 7d3f0c0..8669ec2 100644 (file)
@@ -204,7 +204,7 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_implementation_t *imp,
                }
                else if (m != 0xff)
                {
-                   *dst = FbIntMult(m, *dst, t);
+                   *dst = IntMult(m, *dst, t);
                }
                dst++;
            }
@@ -223,14 +223,14 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_implementation_t *imp,
            while (w--)
            {
                m = *mask++;
-               m = FbIntMult(m, srca, t);
+               m = IntMult(m, srca, t);
                if (m == 0)
                {
                    *dst = 0;
                }
                else if (m != 0xff)
                {
-                   *dst = FbIntMult(m, *dst, t);
+                   *dst = IntMult(m, *dst, t);
                }
                dst++;
            }
@@ -281,7 +281,7 @@ fbCompositeSrcIn_8x8 (pixman_implementation_t *imp,
            }
            else if (s != 0xff)
            {
-               *dst = FbIntMult(s, *dst, t);
+               *dst = IntMult(s, *dst, t);
            }
            dst++;
        }
@@ -948,8 +948,8 @@ fbCompositeSrcAdd_8888x8x8 (pixman_implementation_t *imp,
            a = *mask++;
            d = *dst;
 
-           m = FbIntMult (sa, a, tmp);
-           r = FbIntAdd (m, d, tmp);
+           m = IntMult (sa, a, tmp);
+           r = IntAdd (m, d, tmp);
 
            *dst++ = r;
        }
index 00480f6..1cf2f17 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mmintrin.h>
 #include "pixman-private.h"
+#include "pixman-combine32.h"
 
 #define noVERBOSE
 
@@ -671,7 +672,7 @@ mmxCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
         uint32_t da = ~d >> 24;
 
         if (sa > da) {
-            __m64 msa = load8888(FbIntDiv(da, sa) << 24);
+            __m64 msa = load8888(IntDiv(da, sa) << 24);
             msa = expand_alpha(msa);
             ms = pix_multiply(ms, msa);
         }
@@ -2502,8 +2503,8 @@ fbCompositeIn_nx8x8mmx (pixman_implementation_t *imp,
            a = *mask++;
            d = *dst;
            
-           m = FbIntMult (sa, a, tmp);
-           d = FbIntMult (m, d, tmp);
+           m = IntMult (sa, a, tmp);
+           d = IntMult (m, d, tmp);
            
            *dst++ = d;
        }
@@ -2567,7 +2568,7 @@ fbCompositeIn_8x8mmx (pixman_implementation_t *imp,
            s = *src;
            d = *dst;
 
-           *dst = FbIntMult (s, d, tmp);
+           *dst = IntMult (s, d, tmp);
 
            src++;
            dst++;
@@ -2646,8 +2647,8 @@ fbCompositeSrcAdd_8888x8x8mmx (pixman_implementation_t *imp,
            a = *mask++;
            d = *dst;
 
-           m = FbIntMult (sa, a, tmp);
-           r = FbIntAdd (m, d, tmp);
+           m = IntMult (sa, a, tmp);
+           r = IntAdd (m, d, tmp);
 
            *dst++ = r;
        }
index 4f5931a..643c979 100644 (file)
@@ -314,12 +314,6 @@ 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 FbIntDiv(a,b)   (((uint16_t) (a) * 255) / (b))
-#define FbIntAdd(x,y,t) (                                              \
-       (t) = x + y,                                                    \
-       (uint32_t) (uint8_t) ((t) | (0 - ((t) >> 8))))
-
 /*
  * Edges
  */
index d39beae..9f60b6a 100644 (file)
@@ -34,6 +34,7 @@
 #include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */
 #include <emmintrin.h> /* for SSE2 intrinsics */
 #include "pixman-private.h"
+#include "pixman-combine32.h"
 
 #ifdef USE_SSE2
 
@@ -1330,7 +1331,7 @@ coreCombineSaturateUPixelsse2 (uint32_t src, uint32_t dst)
 
     if (sa > da)
     {
-        ms = pixMultiply_1x64 (ms, expandAlpha_1x64 (unpack_32_1x64 (FbIntDiv(da, sa) << 24)));
+        ms = pixMultiply_1x64 (ms, expandAlpha_1x64 (unpack_32_1x64 (IntDiv(da, sa) << 24)));
     }
 
     return pack_1x64_32 (_mm_adds_pu16 (md, ms));
index 90310f4..9000137 100644 (file)
@@ -71,6 +71,7 @@ main (int argc, char **argv)
     pixman_region32_init_rect (&clip_region, 50, 0, 100, 200);
     pixman_image_set_clip_region32 (src_img, &clip_region);
     pixman_image_set_source_clipping (src_img, TRUE);
+    pixman_image_set_has_client_clip (src_img, TRUE);
     pixman_image_set_transform (src_img, &trans);
     pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL);