From aa6adb646a2c61062d867cece2b0669f658abb39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Tue, 23 Jun 2009 18:41:35 -0400 Subject: [PATCH] Delete FbIntMult and FbIntDiv macros, and move FbIntAdd to pixman-combine.h --- pixman/make-combine.pl | 2 +- pixman/pixman-combine.c.template | 5 +++++ pixman/pixman-combine.h.template | 8 +++----- pixman/pixman-fast-path.c | 12 ++++++------ pixman/pixman-mmx.c | 13 +++++++------ pixman/pixman-private.h | 6 ------ pixman/pixman-sse2.c | 3 ++- test/clip-test.c | 1 + 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pixman/make-combine.pl b/pixman/make-combine.pl index 3eb3d35..8f31259 100644 --- a/pixman/make-combine.pl +++ b/pixman/make-combine.pl @@ -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; diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template index 53edba0..582c63e 100644 --- a/pixman/pixman-combine.c.template +++ b/pixman/pixman-combine.c.template @@ -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) | \ diff --git a/pixman/pixman-combine.h.template b/pixman/pixman-combine.h.template index 9f64e85..35b4c18 100644 --- a/pixman/pixman-combine.h.template +++ b/pixman/pixman-combine.h.template @@ -23,11 +23,9 @@ #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) diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index 7d3f0c0..8669ec2 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -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; } diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 00480f6..1cf2f17 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -37,6 +37,7 @@ #include #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; } diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 4f5931a..643c979 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -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 */ diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c index d39beae..9f60b6a 100644 --- a/pixman/pixman-sse2.c +++ b/pixman/pixman-sse2.c @@ -34,6 +34,7 @@ #include /* for _mm_shuffle_pi16 and _MM_SHUFFLE */ #include /* 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)); diff --git a/test/clip-test.c b/test/clip-test.c index 90310f4..9000137 100644 --- a/test/clip-test.c +++ b/test/clip-test.c @@ -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); -- 2.7.4