aboutsummaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
Diffstat (limited to 'pixman')
-rw-r--r--pixman/pixman/pixman-combine.c.template6
-rw-r--r--pixman/pixman/pixman-combine.h.template452
-rw-r--r--pixman/pixman/pixman-fast-path.c4
-rw-r--r--pixman/pixman/pixman-image.c15
-rw-r--r--pixman/pixman/pixman-mmx.c57
-rw-r--r--pixman/pixman/pixman-trap.c2
-rw-r--r--pixman/pixman/pixman-utils.c35
-rw-r--r--pixman/pixman/pixman.h12
-rw-r--r--pixman/test/blitters-test.c4
-rw-r--r--pixman/test/composite-traps-test.c2
-rw-r--r--pixman/test/region-contains-test.c4
-rw-r--r--pixman/test/stress-test.c3
12 files changed, 318 insertions, 278 deletions
diff --git a/pixman/pixman/pixman-combine.c.template b/pixman/pixman/pixman-combine.c.template
index c17bcea5d..cd008d967 100644
--- a/pixman/pixman/pixman-combine.c.template
+++ b/pixman/pixman/pixman-combine.c.template
@@ -522,7 +522,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc (result, isa, s, ida); \
\
*(dest + i) = result + \
- (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
+ (DIV_ONE_UNc (sa * (comp4_t)da) << A_SHIFT) + \
(blend_ ## name (RED_c (d), da, RED_c (s), sa) << R_SHIFT) + \
(blend_ ## name (GREEN_c (d), da, GREEN_c (s), sa) << G_SHIFT) + \
(blend_ ## name (BLUE_c (d), da, BLUE_c (s), sa)); \
@@ -552,7 +552,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (result, ~m, s, ida); \
\
result += \
- (DIV_ONE_UNc (ALPHA_c (m) * da) << A_SHIFT) + \
+ (DIV_ONE_UNc (ALPHA_c (m) * (comp4_t)da) << A_SHIFT) + \
(blend_ ## name (RED_c (d), da, RED_c (s), RED_c (m)) << R_SHIFT) + \
(blend_ ## name (GREEN_c (d), da, GREEN_c (s), GREEN_c (m)) << G_SHIFT) + \
(blend_ ## name (BLUE_c (d), da, BLUE_c (s), BLUE_c (m))); \
@@ -926,7 +926,7 @@ PDF_SEPARABLE_BLEND_MODE (exclusion)
blend_ ## name (c, dc, da, sc, sa); \
\
*(dest + i) = result + \
- (DIV_ONE_UNc (sa * da) << A_SHIFT) + \
+ (DIV_ONE_UNc (sa * (comp4_t)da) << A_SHIFT) + \
(DIV_ONE_UNc (c[0]) << R_SHIFT) + \
(DIV_ONE_UNc (c[1]) << G_SHIFT) + \
(DIV_ONE_UNc (c[2])); \
diff --git a/pixman/pixman/pixman-combine.h.template b/pixman/pixman/pixman-combine.h.template
index c5b6dcdc6..20f784b5b 100644
--- a/pixman/pixman/pixman-combine.h.template
+++ b/pixman/pixman/pixman-combine.h.template
@@ -1,226 +1,226 @@
-
-#define COMPONENT_SIZE
-#define MASK
-#define ONE_HALF
-
-#define A_SHIFT
-#define R_SHIFT
-#define G_SHIFT
-#define A_MASK
-#define R_MASK
-#define G_MASK
-
-#define RB_MASK
-#define AG_MASK
-#define RB_ONE_HALF
-#define RB_MASK_PLUS_ONE
-
-#define ALPHA_c(x) ((x) >> A_SHIFT)
-#define RED_c(x) (((x) >> R_SHIFT) & MASK)
-#define GREEN_c(x) (((x) >> G_SHIFT) & MASK)
-#define BLUE_c(x) ((x) & MASK)
-
-/*
- * Helper macros.
- */
-
-#define MUL_UNc(a, b, t) \
- ((t) = (a) * (b) + ONE_HALF, ((((t) >> G_SHIFT ) + (t) ) >> G_SHIFT ))
-
-#define DIV_UNc(a, b) \
- (((comp2_t) (a) * MASK) / (b))
-
-#define ADD_UNc(x, y, t) \
- ((t) = (x) + (y), \
- (comp4_t) (comp1_t) ((t) | (0 - ((t) >> G_SHIFT))))
-
-#define DIV_ONE_UNc(x) \
- (((x) + ONE_HALF + (((x) + ONE_HALF) >> G_SHIFT)) >> G_SHIFT)
-
-/*
- * The methods below use some tricks to be able to do two color
- * components at the same time.
- */
-
-/*
- * x_rb = (x_rb * a) / 255
- */
-#define UNc_rb_MUL_UNc(x, a, t) \
- do \
- { \
- t = ((x) & RB_MASK) * (a); \
- t += RB_ONE_HALF; \
- x = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
- x &= RB_MASK; \
- } while (0)
-
-/*
- * x_rb = min (x_rb + y_rb, 255)
- */
-#define UNc_rb_ADD_UNc_rb(x, y, t) \
- do \
- { \
- t = ((x) + (y)); \
- t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
- x = (t & RB_MASK); \
- } while (0)
-
-/*
- * x_rb = (x_rb * a_rb) / 255
- */
-#define UNc_rb_MUL_UNc_rb(x, a, t) \
- do \
- { \
- t = (x & MASK) * (a & MASK); \
- t |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
- t += RB_ONE_HALF; \
- t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
- x = t & RB_MASK; \
- } while (0)
-
-/*
- * x_c = (x_c * a) / 255
- */
-#define UNcx4_MUL_UNc(x, a) \
- do \
- { \
- comp4_t r1__, r2__, t__; \
- \
- r1__ = (x); \
- UNc_rb_MUL_UNc (r1__, (a), t__); \
- \
- r2__ = (x) >> G_SHIFT; \
- UNc_rb_MUL_UNc (r2__, (a), t__); \
- \
- (x) = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- * x_c = (x_c * a) / 255 + y_c
- */
-#define UNcx4_MUL_UNc_ADD_UNcx4(x, a, y) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x); \
- r2__ = (y) & RB_MASK; \
- UNc_rb_MUL_UNc (r1__, (a), t__); \
- UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = (x) >> G_SHIFT; \
- r3__ = ((y) >> G_SHIFT) & RB_MASK; \
- UNc_rb_MUL_UNc (r2__, (a), t__); \
- UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
- \
- (x) = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- * x_c = (x_c * a + y_c * b) / 255
- */
-#define UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc(x, a, y, b) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x); \
- r2__ = (y); \
- UNc_rb_MUL_UNc (r1__, (a), t__); \
- UNc_rb_MUL_UNc (r2__, (b), t__); \
- UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = ((x) >> G_SHIFT); \
- r3__ = ((y) >> G_SHIFT); \
- UNc_rb_MUL_UNc (r2__, (a), t__); \
- UNc_rb_MUL_UNc (r3__, (b), t__); \
- UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
- \
- (x) = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- * x_c = (x_c * a_c) / 255
- */
-#define UNcx4_MUL_UNcx4(x, a) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x); \
- r2__ = (a); \
- UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = (x) >> G_SHIFT; \
- r3__ = (a) >> G_SHIFT; \
- UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
- \
- (x) = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- * x_c = (x_c * a_c) / 255 + y_c
- */
-#define UNcx4_MUL_UNcx4_ADD_UNcx4(x, a, y) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x); \
- r2__ = (a); \
- UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
- r2__ = (y) & RB_MASK; \
- UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = ((x) >> G_SHIFT); \
- r3__ = ((a) >> G_SHIFT); \
- UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
- r3__ = ((y) >> G_SHIFT) & RB_MASK; \
- UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
- \
- (x) = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- * x_c = (x_c * a_c + y_c * b) / 255
- */
-#define UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc(x, a, y, b) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x); \
- r2__ = (a); \
- UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
- r2__ = (y); \
- UNc_rb_MUL_UNc (r2__, (b), t__); \
- UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = (x) >> G_SHIFT; \
- r3__ = (a) >> G_SHIFT; \
- UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
- r3__ = (y) >> G_SHIFT; \
- UNc_rb_MUL_UNc (r3__, (b), t__); \
- UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
- \
- x = r1__ | (r2__ << G_SHIFT); \
- } while (0)
-
-/*
- x_c = min(x_c + y_c, 255)
-*/
-#define UNcx4_ADD_UNcx4(x, y) \
- do \
- { \
- comp4_t r1__, r2__, r3__, t__; \
- \
- r1__ = (x) & RB_MASK; \
- r2__ = (y) & RB_MASK; \
- UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
- \
- r2__ = ((x) >> G_SHIFT) & RB_MASK; \
- r3__ = ((y) >> G_SHIFT) & RB_MASK; \
- UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
- \
- x = r1__ | (r2__ << G_SHIFT); \
- } while (0)
+
+#define COMPONENT_SIZE
+#define MASK
+#define ONE_HALF
+
+#define A_SHIFT
+#define R_SHIFT
+#define G_SHIFT
+#define A_MASK
+#define R_MASK
+#define G_MASK
+
+#define RB_MASK
+#define AG_MASK
+#define RB_ONE_HALF
+#define RB_MASK_PLUS_ONE
+
+#define ALPHA_c(x) ((x) >> A_SHIFT)
+#define RED_c(x) (((x) >> R_SHIFT) & MASK)
+#define GREEN_c(x) (((x) >> G_SHIFT) & MASK)
+#define BLUE_c(x) ((x) & MASK)
+
+/*
+ * Helper macros.
+ */
+
+#define MUL_UNc(a, b, t) \
+ ((t) = (a) * (comp2_t)(b) + ONE_HALF, ((((t) >> G_SHIFT ) + (t) ) >> G_SHIFT ))
+
+#define DIV_UNc(a, b) \
+ (((comp2_t) (a) * MASK + ((b) / 2)) / (b))
+
+#define ADD_UNc(x, y, t) \
+ ((t) = (x) + (y), \
+ (comp4_t) (comp1_t) ((t) | (0 - ((t) >> G_SHIFT))))
+
+#define DIV_ONE_UNc(x) \
+ (((x) + ONE_HALF + (((x) + ONE_HALF) >> G_SHIFT)) >> G_SHIFT)
+
+/*
+ * The methods below use some tricks to be able to do two color
+ * components at the same time.
+ */
+
+/*
+ * x_rb = (x_rb * a) / 255
+ */
+#define UNc_rb_MUL_UNc(x, a, t) \
+ do \
+ { \
+ t = ((x) & RB_MASK) * (a); \
+ t += RB_ONE_HALF; \
+ x = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
+ x &= RB_MASK; \
+ } while (0)
+
+/*
+ * x_rb = min (x_rb + y_rb, 255)
+ */
+#define UNc_rb_ADD_UNc_rb(x, y, t) \
+ do \
+ { \
+ t = ((x) + (y)); \
+ t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
+ x = (t & RB_MASK); \
+ } while (0)
+
+/*
+ * x_rb = (x_rb * a_rb) / 255
+ */
+#define UNc_rb_MUL_UNc_rb(x, a, t) \
+ do \
+ { \
+ t = (x & MASK) * (a & MASK); \
+ t |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
+ t += RB_ONE_HALF; \
+ t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
+ x = t & RB_MASK; \
+ } while (0)
+
+/*
+ * x_c = (x_c * a) / 255
+ */
+#define UNcx4_MUL_UNc(x, a) \
+ do \
+ { \
+ comp4_t r1__, r2__, t__; \
+ \
+ r1__ = (x); \
+ UNc_rb_MUL_UNc (r1__, (a), t__); \
+ \
+ r2__ = (x) >> G_SHIFT; \
+ UNc_rb_MUL_UNc (r2__, (a), t__); \
+ \
+ (x) = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ * x_c = (x_c * a) / 255 + y_c
+ */
+#define UNcx4_MUL_UNc_ADD_UNcx4(x, a, y) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x); \
+ r2__ = (y) & RB_MASK; \
+ UNc_rb_MUL_UNc (r1__, (a), t__); \
+ UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = (x) >> G_SHIFT; \
+ r3__ = ((y) >> G_SHIFT) & RB_MASK; \
+ UNc_rb_MUL_UNc (r2__, (a), t__); \
+ UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
+ \
+ (x) = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ * x_c = (x_c * a + y_c * b) / 255
+ */
+#define UNcx4_MUL_UNc_ADD_UNcx4_MUL_UNc(x, a, y, b) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x); \
+ r2__ = (y); \
+ UNc_rb_MUL_UNc (r1__, (a), t__); \
+ UNc_rb_MUL_UNc (r2__, (b), t__); \
+ UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = ((x) >> G_SHIFT); \
+ r3__ = ((y) >> G_SHIFT); \
+ UNc_rb_MUL_UNc (r2__, (a), t__); \
+ UNc_rb_MUL_UNc (r3__, (b), t__); \
+ UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
+ \
+ (x) = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ * x_c = (x_c * a_c) / 255
+ */
+#define UNcx4_MUL_UNcx4(x, a) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x); \
+ r2__ = (a); \
+ UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = (x) >> G_SHIFT; \
+ r3__ = (a) >> G_SHIFT; \
+ UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
+ \
+ (x) = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ * x_c = (x_c * a_c) / 255 + y_c
+ */
+#define UNcx4_MUL_UNcx4_ADD_UNcx4(x, a, y) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x); \
+ r2__ = (a); \
+ UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
+ r2__ = (y) & RB_MASK; \
+ UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = ((x) >> G_SHIFT); \
+ r3__ = ((a) >> G_SHIFT); \
+ UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
+ r3__ = ((y) >> G_SHIFT) & RB_MASK; \
+ UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
+ \
+ (x) = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ * x_c = (x_c * a_c + y_c * b) / 255
+ */
+#define UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc(x, a, y, b) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x); \
+ r2__ = (a); \
+ UNc_rb_MUL_UNc_rb (r1__, r2__, t__); \
+ r2__ = (y); \
+ UNc_rb_MUL_UNc (r2__, (b), t__); \
+ UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = (x) >> G_SHIFT; \
+ r3__ = (a) >> G_SHIFT; \
+ UNc_rb_MUL_UNc_rb (r2__, r3__, t__); \
+ r3__ = (y) >> G_SHIFT; \
+ UNc_rb_MUL_UNc (r3__, (b), t__); \
+ UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
+ \
+ x = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
+
+/*
+ x_c = min(x_c + y_c, 255)
+*/
+#define UNcx4_ADD_UNcx4(x, y) \
+ do \
+ { \
+ comp4_t r1__, r2__, r3__, t__; \
+ \
+ r1__ = (x) & RB_MASK; \
+ r2__ = (y) & RB_MASK; \
+ UNc_rb_ADD_UNc_rb (r1__, r2__, t__); \
+ \
+ r2__ = ((x) >> G_SHIFT) & RB_MASK; \
+ r3__ = ((y) >> G_SHIFT) & RB_MASK; \
+ UNc_rb_ADD_UNc_rb (r2__, r3__, t__); \
+ \
+ x = r1__ | (r2__ << G_SHIFT); \
+ } while (0)
diff --git a/pixman/pixman/pixman-fast-path.c b/pixman/pixman/pixman-fast-path.c
index 038dcf722..eac8dea66 100644
--- a/pixman/pixman/pixman-fast-path.c
+++ b/pixman/pixman/pixman-fast-path.c
@@ -1969,9 +1969,9 @@ static const pixman_fast_path_t c_fast_paths[] =
};
#ifdef WORDS_BIGENDIAN
-#define A1_FILL_MASK(n, offs) (((1 << (n)) - 1) << (32 - (offs) - (n)))
+#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (32 - (offs) - (n)))
#else
-#define A1_FILL_MASK(n, offs) (((1 << (n)) - 1) << (offs))
+#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (offs))
#endif
static force_inline void
diff --git a/pixman/pixman/pixman-image.c b/pixman/pixman/pixman-image.c
index 913853ceb..8599a1eb1 100644
--- a/pixman/pixman/pixman-image.c
+++ b/pixman/pixman/pixman-image.c
@@ -299,13 +299,12 @@ compute_image_info (pixman_image_t *image)
image->common.transform->matrix[1][1] == 0)
{
pixman_fixed_t m01 = image->common.transform->matrix[0][1];
- if (m01 == -image->common.transform->matrix[1][0])
- {
- if (m01 == -pixman_fixed_1)
- flags |= FAST_PATH_ROTATE_90_TRANSFORM;
- else if (m01 == pixman_fixed_1)
- flags |= FAST_PATH_ROTATE_270_TRANSFORM;
- }
+ pixman_fixed_t m10 = image->common.transform->matrix[1][0];
+
+ if (m01 == -1 && m10 == 1)
+ flags |= FAST_PATH_ROTATE_90_TRANSFORM;
+ else if (m01 == 1 && m10 == -1)
+ flags |= FAST_PATH_ROTATE_270_TRANSFORM;
}
}
@@ -631,7 +630,7 @@ pixman_image_set_transform (pixman_image_t * image,
}
if (common->transform &&
- memcmp (common->transform, transform, sizeof (pixman_transform_t) == 0))
+ memcmp (common->transform, transform, sizeof (pixman_transform_t)) == 0)
{
return TRUE;
}
diff --git a/pixman/pixman/pixman-mmx.c b/pixman/pixman/pixman-mmx.c
index 5da1f6622..937ce8fae 100644
--- a/pixman/pixman/pixman-mmx.c
+++ b/pixman/pixman/pixman-mmx.c
@@ -77,17 +77,38 @@ _mm_empty (void)
/* --------------- MMX primitives ------------------------------------- */
-#ifdef __GNUC__
+/* If __m64 is defined as a struct or union, then define M64_MEMBER to be
+ * the name of the member used to access the data.
+ * If __m64 requires using mm_cvt* intrinsics functions to convert between
+ * uint64_t and __m64 values, then define USE_CVT_INTRINSICS.
+ * If __m64 and uint64_t values can just be cast to each other directly,
+ * then define USE_M64_CASTS.
+ */
+#ifdef _MSC_VER
+# define M64_MEMBER m64_u64
+#elif defined(__ICC)
+# define USE_CVT_INTRINSICS
+#elif defined(__GNUC__)
+# define USE_M64_CASTS
+#elif defined(__SUNPRO_C)
+# if (__SUNPRO_C >= 0x5120) && !defined(__NOVECTORSIZE__)
+/* Solaris Studio 12.3 (Sun C 5.12) introduces __attribute__(__vector_size__)
+ * support, and defaults to using it to define __m64, unless __NOVECTORSIZE__
+ * is defined. If it is used, then the mm_cvt* intrinsics must be used.
+ */
+# define USE_CVT_INTRINSICS
+# else
+/* For Studio 12.2 or older, or when __attribute__(__vector_size__) is
+ * disabled, __m64 is defined as a struct containing "unsigned long long l_".
+ */
+# define M64_MEMBER l_
+# endif
+#endif
+
+#if defined(USE_M64_CASTS) || defined(USE_CVT_INTRINSICS)
typedef uint64_t mmxdatafield;
#else
typedef __m64 mmxdatafield;
-/* If __m64 is defined as a struct or union, define M64_MEMBER to be the
- name of the member used to access the data */
-# ifdef _MSC_VER
-# define M64_MEMBER m64_u64
-# elif defined(__SUNPRO_C)
-# define M64_MEMBER l_
-# endif
#endif
typedef struct
@@ -113,7 +134,7 @@ typedef struct
# define MMXDATA_INIT(field, val) { val ## UI64 }
#elif defined(M64_MEMBER) /* __m64 is a struct, not an integral type */
# define MMXDATA_INIT(field, val) field = { val ## ULL }
-#else /* __m64 is an integral type */
+#else /* mmxdatafield is an integral type */
# define MMXDATA_INIT(field, val) field = val ## ULL
#endif
@@ -136,12 +157,10 @@ static const mmx_data_t c =
MMXDATA_INIT (.mmx_000000000000ffff, 0x000000000000ffff),
};
-#ifdef __GNUC__
-# ifdef __ICC
-# define MC(x) to_m64 (c.mmx_ ## x)
-# else
-# define MC(x) ((__m64)c.mmx_ ## x)
-# endif
+#ifdef USE_CVT_INTRINSICS
+# define MC(x) to_m64 (c.mmx_ ## x)
+#elif defined(USE_M64_CASTS)
+# define MC(x) ((__m64)c.mmx_ ## x)
#else
# define MC(x) c.mmx_ ## x
#endif
@@ -149,14 +168,14 @@ static const mmx_data_t c =
static force_inline __m64
to_m64 (uint64_t x)
{
-#ifdef __ICC
+#ifdef USE_CVT_INTRINSICS
return _mm_cvtsi64_m64 (x);
#elif defined M64_MEMBER /* __m64 is a struct, not an integral type */
__m64 res;
res.M64_MEMBER = x;
return res;
-#else /* __m64 is an integral type */
+#else /* USE_M64_CASTS */
return (__m64)x;
#endif
}
@@ -164,12 +183,12 @@ to_m64 (uint64_t x)
static force_inline uint64_t
to_uint64 (__m64 x)
{
-#ifdef __ICC
+#ifdef USE_CVT_INTRINSICS
return _mm_cvtm64_si64 (x);
#elif defined M64_MEMBER /* __m64 is a struct, not an integral type */
uint64_t res = x.M64_MEMBER;
return res;
-#else /* __m64 is an integral type */
+#else /* USE_M64_CASTS */
return (uint64_t)x;
#endif
}
diff --git a/pixman/pixman/pixman-trap.c b/pixman/pixman/pixman-trap.c
index c99f03ecc..adf5d7bb5 100644
--- a/pixman/pixman/pixman-trap.c
+++ b/pixman/pixman/pixman-trap.c
@@ -139,7 +139,7 @@ _pixman_edge_multi_init (pixman_edge_t * e,
if (ne > 0)
{
int nx = ne / e->dy;
- ne -= nx * e->dy;
+ ne -= nx * (pixman_fixed_48_16_t)e->dy;
stepx += nx * e->signdx;
}
diff --git a/pixman/pixman/pixman-utils.c b/pixman/pixman/pixman-utils.c
index d2af51a30..2ec2594e1 100644
--- a/pixman/pixman/pixman-utils.c
+++ b/pixman/pixman/pixman-utils.c
@@ -220,16 +220,33 @@ pixman_expand (uint64_t * dst,
for (i = width - 1; i >= 0; i--)
{
const uint32_t pixel = src[i];
- const uint8_t a = (pixel >> a_shift) & a_mask,
- r = (pixel >> r_shift) & r_mask,
- g = (pixel >> g_shift) & g_mask,
- b = (pixel >> b_shift) & b_mask;
- const uint64_t
- a16 = a_size ? unorm_to_unorm (a, a_size, 16) : 0xffff,
- r16 = unorm_to_unorm (r, r_size, 16),
- g16 = unorm_to_unorm (g, g_size, 16),
- b16 = unorm_to_unorm (b, b_size, 16);
+ uint8_t a, r, g, b;
+ uint64_t a16, r16, g16, b16;
+
+ if (a_size)
+ {
+ a = (pixel >> a_shift) & a_mask;
+ a16 = unorm_to_unorm (a, a_size, 16);
+ }
+ else
+ {
+ a16 = 0xffff;
+ }
+ if (r_size)
+ {
+ r = (pixel >> r_shift) & r_mask;
+ g = (pixel >> g_shift) & g_mask;
+ b = (pixel >> b_shift) & b_mask;
+ r16 = unorm_to_unorm (r, r_size, 16);
+ g16 = unorm_to_unorm (g, g_size, 16);
+ b16 = unorm_to_unorm (b, b_size, 16);
+ }
+ else
+ {
+ r16 = g16 = b16 = 0;
+ }
+
dst[i] = a16 << 48 | r16 << 32 | g16 << 16 | b16;
}
}
diff --git a/pixman/pixman/pixman.h b/pixman/pixman/pixman.h
index 18d951312..20ff49695 100644
--- a/pixman/pixman/pixman.h
+++ b/pixman/pixman/pixman.h
@@ -908,10 +908,14 @@ struct pixman_triangle
};
/* whether 't' is a well defined not obviously empty trapezoid */
-#define pixman_trapezoid_valid(t) \
- ((t)->left.p1.y != (t)->left.p2.y && \
- (t)->right.p1.y != (t)->right.p2.y && \
- (int) ((t)->bottom - (t)->top) > 0)
+#define pixman_trapezoid_valid(t) \
+ ((t)->left.p1.y != (t)->left.p2.y && \
+ (t)->right.p1.y != (t)->right.p2.y && \
+ (int) ((t)->bottom - (t)->top) > 0 && \
+ (t)->bottom <= (t)->left.p2.y && \
+ (t)->bottom <= (t)->right.p2.y && \
+ (t)->top >= (t)->left.p1.y && \
+ (t)->top >= (t)->right.p1.y)
struct pixman_span_fix
{
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 55b6c735c..feea308c2 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -103,7 +103,7 @@ free_random_image (uint32_t initcrc,
mask <<= (PIXMAN_FORMAT_BPP (fmt) - PIXMAN_FORMAT_DEPTH (fmt));
}
- for (i = 0; i < 32; i++)
+ for (i = 0; i * PIXMAN_FORMAT_BPP (fmt) < 32; i++)
mask |= mask << (i * PIXMAN_FORMAT_BPP (fmt));
for (i = 0; i < stride * height / 4; i++)
@@ -424,6 +424,6 @@ main (int argc, const char *argv[])
}
return fuzzer_test_main("blitters", 2000000,
- 0x29137844,
+ 0xA364B5BF,
test_composite, argc, argv);
}
diff --git a/pixman/test/composite-traps-test.c b/pixman/test/composite-traps-test.c
index ff03b50d9..de518d820 100644
--- a/pixman/test/composite-traps-test.c
+++ b/pixman/test/composite-traps-test.c
@@ -251,6 +251,6 @@ test_composite (int testnum,
int
main (int argc, const char *argv[])
{
- return fuzzer_test_main("composite traps", 40000, 0xE3112106,
+ return fuzzer_test_main("composite traps", 40000, 0x4346479C,
test_composite, argc, argv);
}
diff --git a/pixman/test/region-contains-test.c b/pixman/test/region-contains-test.c
index 2372686fc..9524e2888 100644
--- a/pixman/test/region-contains-test.c
+++ b/pixman/test/region-contains-test.c
@@ -73,7 +73,7 @@ random_coord (pixman_region32_t *region, pixman_bool_t x)
case 3:
return begin;
default:
- return (begin + end) / 2;
+ return (end - begin) / 2 + begin;
}
return 0;
}
@@ -163,7 +163,7 @@ main (int argc, const char *argv[])
{
return fuzzer_test_main ("region_contains",
1000000,
- 0xD7C297CC,
+ 0xD2BF8C73,
test_region_contains_rectangle,
argc, argv);
}
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c
index 08bf1d4df..3174621e6 100644
--- a/pixman/test/stress-test.c
+++ b/pixman/test/stress-test.c
@@ -166,7 +166,8 @@ fake_reader (const void *src, int size)
uint32_t r = lcg_rand_u32 ();
assert (size == 1 || size == 2 || size == 4);
- return r & ((1 << (size * 8)) - 1);
+
+ return r >> (32 - (size * 8));
}
static void