diff options
author | marha <marha@users.sourceforge.net> | 2013-01-07 12:17:07 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-07 12:17:07 +0100 |
commit | 0e950715b62dcf30ffbf69831bf932fd348537e5 (patch) | |
tree | 83fdafc455e9906f029e2e1ad926fb35c98e7be9 /pixman | |
parent | 506537495e6d808f219361a5b270510c752e7a2e (diff) | |
parent | 3f553aaceddc9b09363c73d9bea40eaea8164fc4 (diff) | |
download | vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.gz vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.tar.bz2 vcxsrv-0e950715b62dcf30ffbf69831bf932fd348537e5.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013
Conflicts:
fontconfig/src/fcatomic.c
pixman/pixman/pixman-mmx.c
pixman/pixman/pixman-sse2.c
xorg-server/dix/dispatch.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/xfixes/cursor.c
Diffstat (limited to 'pixman')
-rw-r--r-- | pixman/configure.ac | 2 | ||||
-rw-r--r-- | pixman/pixman/pixman-bits-image.c | 2 | ||||
-rw-r--r-- | pixman/pixman/pixman-combine-float.c | 28 | ||||
-rw-r--r-- | pixman/pixman/pixman-combine32.h | 47 | ||||
-rw-r--r-- | pixman/pixman/pixman-compiler.h | 4 | ||||
-rw-r--r-- | pixman/pixman/pixman-edge.c | 1 | ||||
-rw-r--r-- | pixman/pixman/pixman-fast-path.c | 64 | ||||
-rw-r--r-- | pixman/pixman/pixman-filter.c | 10 | ||||
-rw-r--r-- | pixman/pixman/pixman-general.c | 8 | ||||
-rw-r--r-- | pixman/pixman/pixman-glyph.c | 2 | ||||
-rw-r--r-- | pixman/pixman/pixman-image.c | 2 | ||||
-rw-r--r-- | pixman/pixman/pixman-implementation.c | 4 | ||||
-rw-r--r-- | pixman/pixman/pixman-inlines.h | 30 | ||||
-rwxr-xr-x | pixman/pixman/pixman-mmx.c | 40 | ||||
-rw-r--r-- | pixman/pixman/pixman-noop.c | 20 | ||||
-rw-r--r-- | pixman/pixman/pixman-private.h | 60 | ||||
-rw-r--r-- | pixman/pixman/pixman-region.c | 2 | ||||
-rw-r--r-- | pixman/pixman/pixman-solid-fill.c | 25 | ||||
-rwxr-xr-x[-rw-r--r--] | pixman/pixman/pixman-sse2.c | 30 | ||||
-rw-r--r-- | pixman/pixman/pixman-trap.c | 7 | ||||
-rw-r--r-- | pixman/pixman/pixman.c | 6 | ||||
-rw-r--r-- | pixman/test/lowlevel-blt-bench.c | 1 | ||||
-rw-r--r-- | pixman/test/stress-test.c | 160 |
23 files changed, 370 insertions, 185 deletions
diff --git a/pixman/configure.ac b/pixman/configure.ac index 81f068d9c..515e31218 100644 --- a/pixman/configure.ac +++ b/pixman/configure.ac @@ -64,7 +64,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Suppress verbose compile lines m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AC_CANONICAL_HOST diff --git a/pixman/pixman/pixman-bits-image.c b/pixman/pixman/pixman-bits-image.c index 86d80c3f5..75a39a115 100644 --- a/pixman/pixman/pixman-bits-image.c +++ b/pixman/pixman/pixman-bits-image.c @@ -1114,7 +1114,7 @@ convert_a8 (const uint8_t *row, int x) static force_inline uint32_t convert_r5g6b5 (const uint8_t *row, int x) { - return CONVERT_0565_TO_0888 (*((uint16_t *)row + x)); + return convert_0565_to_0888 (*((uint16_t *)row + x)); } #define MAKE_SEPARABLE_CONVOLUTION_FETCHER(name, format, repeat_mode) \ diff --git a/pixman/pixman/pixman-combine-float.c b/pixman/pixman/pixman-combine-float.c index c3d54f025..c916df8a3 100644 --- a/pixman/pixman/pixman-combine-float.c +++ b/pixman/pixman/pixman-combine-float.c @@ -42,6 +42,8 @@ #define force_inline __inline__ #endif +#define IS_ZERO(f) (-FLT_MIN < (f) && (f) < FLT_MIN) + typedef float (* combine_channel_t) (float sa, float s, float da, float d); static force_inline void @@ -201,56 +203,56 @@ get_factor (combine_factor_t factor, float sa, float da) break; case SA_OVER_DA: - if (da == 0.0f) + if (IS_ZERO (da)) f = 1.0f; else f = CLAMP (sa / da); break; case DA_OVER_SA: - if (sa == 0.0f) + if (IS_ZERO (sa)) f = 1.0f; else f = CLAMP (da / sa); break; case INV_SA_OVER_DA: - if (da == 0.0f) + if (IS_ZERO (da)) f = 1.0f; else f = CLAMP ((1.0f - sa) / da); break; case INV_DA_OVER_SA: - if (sa == 0.0f) + if (IS_ZERO (sa)) f = 1.0f; else f = CLAMP ((1.0f - da) / sa); break; case ONE_MINUS_SA_OVER_DA: - if (da == 0.0f) + if (IS_ZERO (da)) f = 0.0f; else f = CLAMP (1.0f - sa / da); break; case ONE_MINUS_DA_OVER_SA: - if (sa == 0.0f) + if (IS_ZERO (sa)) f = 0.0f; else f = CLAMP (1.0f - da / sa); break; case ONE_MINUS_INV_DA_OVER_SA: - if (sa == 0.0f) + if (IS_ZERO (sa)) f = 0.0f; else f = CLAMP (1.0f - (1.0f - da) / sa); break; case ONE_MINUS_INV_SA_OVER_DA: - if (da == 0.0f) + if (IS_ZERO (da)) f = 0.0f; else f = CLAMP (1.0f - (1.0f - sa) / da); @@ -403,11 +405,11 @@ blend_lighten (float sa, float s, float da, float d) static force_inline float blend_color_dodge (float sa, float s, float da, float d) { - if (d == 0.0f) + if (IS_ZERO (d)) return 0.0f; else if (d * sa >= sa * da - s * da) return sa * da; - else if (sa - s == 0.0f) + else if (IS_ZERO (sa - s)) return sa * da; else return sa * sa * d / (sa - s); @@ -420,7 +422,7 @@ blend_color_burn (float sa, float s, float da, float d) return sa * da; else if (sa * (da - d) >= s * da) return 0.0f; - else if (s == 0.0f) + else if (IS_ZERO (s)) return 0.0f; else return sa * (da - sa * (da - d) / s); @@ -440,14 +442,14 @@ blend_soft_light (float sa, float s, float da, float d) { if (2 * s < sa) { - if (da == 0.0f) + if (IS_ZERO (da)) return d * sa; else return d * sa - d * (da - d) * (sa - 2 * s) / da; } else { - if (da == 0.0f) + if (IS_ZERO (da)) { return 0.0f; } diff --git a/pixman/pixman/pixman-combine32.h b/pixman/pixman/pixman-combine32.h index 875dde3cf..cdd56a61a 100644 --- a/pixman/pixman/pixman-combine32.h +++ b/pixman/pixman/pixman-combine32.h @@ -20,6 +20,47 @@ #define BLUE_8(x) ((x) & MASK) /* + * ARMv6 has UQADD8 instruction, which implements unsigned saturated + * addition for 8-bit values packed in 32-bit registers. It is very useful + * for UN8x4_ADD_UN8x4, UN8_rb_ADD_UN8_rb and ADD_UN8 macros (which would + * otherwise need a lot of arithmetic operations to simulate this operation). + * Since most of the major ARM linux distros are built for ARMv7, we are + * much less dependent on runtime CPU detection and can get practical + * benefits from conditional compilation here for a lot of users. + */ + +#if defined(USE_GCC_INLINE_ASM) && defined(__arm__) && \ + !defined(__aarch64__) && (!defined(__thumb__) || defined(__thumb2__)) +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ + defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \ + defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) || \ + defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7__) || \ + defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ + defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) + +static force_inline uint32_t +un8x4_add_un8x4 (uint32_t x, uint32_t y) +{ + uint32_t t; + asm ("uqadd8 %0, %1, %2" : "=r" (t) : "%r" (x), "r" (y)); + return t; +} + +#define UN8x4_ADD_UN8x4(x, y) \ + ((x) = un8x4_add_un8x4 ((x), (y))) + +#define UN8_rb_ADD_UN8_rb(x, y, t) \ + ((t) = un8x4_add_un8x4 ((x), (y)), (x) = (t)) + +#define ADD_UN8(x, y, t) \ + ((t) = (x), un8x4_add_un8x4 ((t), (y))) + +#endif +#endif + +/*****************************************************************************/ + +/* * Helper macros. */ @@ -29,9 +70,11 @@ #define DIV_UN8(a, b) \ (((uint16_t) (a) * MASK + ((b) / 2)) / (b)) +#ifndef ADD_UN8 #define ADD_UN8(x, y, t) \ ((t) = (x) + (y), \ (uint32_t) (uint8_t) ((t) | (0 - ((t) >> G_SHIFT)))) +#endif #define DIV_ONE_UN8(x) \ (((x) + ONE_HALF + (((x) + ONE_HALF) >> G_SHIFT)) >> G_SHIFT) @@ -56,6 +99,7 @@ /* * x_rb = min (x_rb + y_rb, 255) */ +#ifndef UN8_rb_ADD_UN8_rb #define UN8_rb_ADD_UN8_rb(x, y, t) \ do \ { \ @@ -63,6 +107,7 @@ t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \ x = (t & RB_MASK); \ } while (0) +#endif /* * x_rb = (x_rb * a_rb) / 255 @@ -208,6 +253,7 @@ /* x_c = min(x_c + y_c, 255) */ +#ifndef UN8x4_ADD_UN8x4 #define UN8x4_ADD_UN8x4(x, y) \ do \ { \ @@ -223,3 +269,4 @@ \ x = r1__ | (r2__ << G_SHIFT); \ } while (0) +#endif diff --git a/pixman/pixman/pixman-compiler.h b/pixman/pixman/pixman-compiler.h index 2c9df716e..d38dfbe34 100644 --- a/pixman/pixman/pixman-compiler.h +++ b/pixman/pixman/pixman-compiler.h @@ -56,6 +56,10 @@ # define INT64_MAX (9223372036854775807) #endif +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t)-1) +#endif + #ifndef M_PI # define M_PI 3.14159265358979323846 diff --git a/pixman/pixman/pixman-edge.c b/pixman/pixman/pixman-edge.c index 8d498ab44..ad6dfc4cf 100644 --- a/pixman/pixman/pixman-edge.c +++ b/pixman/pixman/pixman-edge.c @@ -374,6 +374,7 @@ pixman_rasterize_edges (pixman_image_t *image, pixman_fixed_t b) { return_if_fail (image->type == BITS); + return_if_fail (PIXMAN_FORMAT_TYPE (image->bits.format) == PIXMAN_TYPE_A); if (image->bits.read_func || image->bits.write_func) pixman_rasterize_edges_accessors (image, l, r, t, b); diff --git a/pixman/pixman/pixman-fast-path.c b/pixman/pixman/pixman-fast-path.c index 342975888..c625e0c4a 100644 --- a/pixman/pixman/pixman-fast-path.c +++ b/pixman/pixman/pixman-fast-path.c @@ -507,15 +507,15 @@ fast_composite_over_n_8_0565 (pixman_implementation_t *imp, else { d = *dst; - d = over (src, CONVERT_0565_TO_0888 (d)); + d = over (src, convert_0565_to_0888 (d)); } - *dst = CONVERT_8888_TO_0565 (d); + *dst = convert_8888_to_0565 (d); } else if (m) { d = *dst; - d = over (in (src, m), CONVERT_0565_TO_0888 (d)); - *dst = CONVERT_8888_TO_0565 (d); + d = over (in (src, m), convert_0565_to_0888 (d)); + *dst = convert_8888_to_0565 (d); } dst++; } @@ -541,7 +541,7 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp, if (src == 0) return; - src16 = CONVERT_8888_TO_0565 (src); + src16 = convert_8888_to_0565 (src); PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1); @@ -566,14 +566,14 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp, else { d = *dst; - d = over (src, CONVERT_0565_TO_0888 (d)); - *dst = CONVERT_8888_TO_0565 (d); + d = over (src, convert_0565_to_0888 (d)); + *dst = convert_8888_to_0565 (d); } } else if (ma) { d = *dst; - d = CONVERT_0565_TO_0888 (d); + d = convert_0565_to_0888 (d); s = src; @@ -582,7 +582,7 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp, ma = ~ma; UN8x4_MUL_UN8x4_ADD_UN8x4 (d, ma, s); - *dst = CONVERT_8888_TO_0565 (d); + *dst = convert_8888_to_0565 (d); } dst++; } @@ -729,9 +729,9 @@ fast_composite_over_8888_0565 (pixman_implementation_t *imp, else { d = *dst; - d = over (s, CONVERT_0565_TO_0888 (d)); + d = over (s, convert_0565_to_0888 (d)); } - *dst = CONVERT_8888_TO_0565 (d); + *dst = convert_8888_to_0565 (d); } dst++; } @@ -762,7 +762,7 @@ fast_composite_src_x888_0565 (pixman_implementation_t *imp, while (w--) { s = *src++; - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); dst++; } } @@ -838,13 +838,13 @@ fast_composite_add_0565_0565 (pixman_implementation_t *imp, if (s) { d = *dst; - s = CONVERT_0565_TO_8888 (s); + s = convert_0565_to_8888 (s); if (d) { - d = CONVERT_0565_TO_8888 (d); + d = convert_0565_to_8888 (d); UN8x4_ADD_UN8x4 (s, d); } - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); } dst++; } @@ -1094,7 +1094,7 @@ fast_composite_over_n_1_0565 (pixman_implementation_t *imp, if (srca == 0xff) { - src565 = CONVERT_8888_TO_0565 (src); + src565 = convert_8888_to_0565 (src); while (height--) { dst = dst_line; @@ -1142,8 +1142,8 @@ fast_composite_over_n_1_0565 (pixman_implementation_t *imp, } if (bitcache & bitmask) { - d = over (src, CONVERT_0565_TO_0888 (*dst)); - *dst = CONVERT_8888_TO_0565 (d); + d = over (src, convert_0565_to_0888 (*dst)); + *dst = convert_8888_to_0565 (d); } bitmask = UPDATE_BITMASK (bitmask); dst++; @@ -1176,7 +1176,7 @@ fast_composite_solid_fill (pixman_implementation_t *imp, else if (dest_image->bits.format == PIXMAN_r5g6b5 || dest_image->bits.format == PIXMAN_b5g6r5) { - src = CONVERT_8888_TO_0565 (src); + src = convert_8888_to_0565 (src); } pixman_fill (dest_image->bits.bits, dest_image->bits.rowstride, @@ -2067,12 +2067,12 @@ pixman_fill1 (uint32_t *bits, int y, int width, int height, - uint32_t xor) + uint32_t filler) { uint32_t *dst = bits + y * stride + (x >> 5); int offs = x & 31; - if (xor & 1) + if (filler & 1) { while (height--) { @@ -2097,11 +2097,11 @@ pixman_fill8 (uint32_t *bits, int y, int width, int height, - uint32_t xor) + uint32_t filler) { int byte_stride = stride * (int) sizeof (uint32_t); uint8_t *dst = (uint8_t *) bits; - uint8_t v = xor & 0xff; + uint8_t v = filler & 0xff; int i; dst = dst + y * byte_stride + x; @@ -2122,12 +2122,12 @@ pixman_fill16 (uint32_t *bits, int y, int width, int height, - uint32_t xor) + uint32_t filler) { int short_stride = (stride * (int)sizeof (uint32_t)) / (int)sizeof (uint16_t); uint16_t *dst = (uint16_t *)bits; - uint16_t v = xor & 0xffff; + uint16_t v = filler & 0xffff; int i; dst = dst + y * short_stride + x; @@ -2148,7 +2148,7 @@ pixman_fill32 (uint32_t *bits, int y, int width, int height, - uint32_t xor) + uint32_t filler) { int i; @@ -2157,7 +2157,7 @@ pixman_fill32 (uint32_t *bits, while (height--) { for (i = 0; i < width; ++i) - bits[i] = xor; + bits[i] = filler; bits += stride; } @@ -2172,24 +2172,24 @@ fast_path_fill (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor) + uint32_t filler) { switch (bpp) { case 1: - pixman_fill1 (bits, stride, x, y, width, height, xor); + pixman_fill1 (bits, stride, x, y, width, height, filler); break; case 8: - pixman_fill8 (bits, stride, x, y, width, height, xor); + pixman_fill8 (bits, stride, x, y, width, height, filler); break; case 16: - pixman_fill16 (bits, stride, x, y, width, height, xor); + pixman_fill16 (bits, stride, x, y, width, height, filler); break; case 32: - pixman_fill32 (bits, stride, x, y, width, height, xor); + pixman_fill32 (bits, stride, x, y, width, height, filler); break; default: diff --git a/pixman/pixman/pixman-filter.c b/pixman/pixman/pixman-filter.c index c9d2dc74c..26b39d571 100644 --- a/pixman/pixman/pixman-filter.c +++ b/pixman/pixman/pixman-filter.c @@ -231,6 +231,8 @@ create_1d_filter (int *width, *width = ceil (size); p = params = malloc (*width * n_phases * sizeof (pixman_fixed_t)); + if (!params) + return NULL; step = 1.0 / n_phases; @@ -309,7 +311,7 @@ pixman_filter_create_separable_convolution (int *n_values, { double sx = fabs (pixman_fixed_to_double (scale_x)); double sy = fabs (pixman_fixed_to_double (scale_y)); - pixman_fixed_t *horz, *vert, *params; + pixman_fixed_t *horz = NULL, *vert = NULL, *params = NULL; int subsample_x, subsample_y; int width, height; @@ -319,9 +321,14 @@ pixman_filter_create_separable_convolution (int *n_values, horz = create_1d_filter (&width, reconstruct_x, sample_x, sx, subsample_x); vert = create_1d_filter (&height, reconstruct_y, sample_y, sy, subsample_y); + if (!horz || !vert) + goto out; + *n_values = 4 + width * subsample_x + height * subsample_y; params = malloc (*n_values * sizeof (pixman_fixed_t)); + if (!params) + goto out; params[0] = pixman_int_to_fixed (width); params[1] = pixman_int_to_fixed (height); @@ -333,6 +340,7 @@ pixman_filter_create_separable_convolution (int *n_values, memcpy (params + 4 + width * subsample_x, vert, height * subsample_y * sizeof (pixman_fixed_t)); +out: free (horz); free (vert); diff --git a/pixman/pixman/pixman-general.c b/pixman/pixman/pixman-general.c index 0bf91e444..f175d771e 100644 --- a/pixman/pixman/pixman-general.c +++ b/pixman/pixman/pixman-general.c @@ -42,9 +42,7 @@ general_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) { pixman_image_t *image = iter->image; - if (image->type == SOLID) - _pixman_solid_fill_iter_init (image, iter); - else if (image->type == LINEAR) + if (image->type == LINEAR) _pixman_linear_gradient_iter_init (image, iter); else if (image->type == RADIAL) _pixman_radial_gradient_iter_init (image, iter); @@ -52,7 +50,9 @@ general_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) _pixman_conical_gradient_iter_init (image, iter); else if (image->type == BITS) _pixman_bits_image_src_iter_init (image, iter); - else + else if (image->type == SOLID) + _pixman_log_error (FUNC, "Solid image not handled by noop"); + else _pixman_log_error (FUNC, "Pixman bug: unknown image type\n"); return TRUE; diff --git a/pixman/pixman/pixman-glyph.c b/pixman/pixman/pixman-glyph.c index 15b3f1fea..6d2c8bbb7 100644 --- a/pixman/pixman/pixman-glyph.c +++ b/pixman/pixman/pixman-glyph.c @@ -508,7 +508,7 @@ add_glyphs (pixman_glyph_cache_t *cache, uint32_t glyph_flags = 0; pixman_composite_func_t func = NULL; pixman_implementation_t *implementation = NULL; - uint32_t dest_format; + pixman_format_code_t dest_format; uint32_t dest_flags; pixman_box32_t dest_box; pixman_composite_info_t info; diff --git a/pixman/pixman/pixman-image.c b/pixman/pixman/pixman-image.c index 6f076d5c6..65041b43b 100644 --- a/pixman/pixman/pixman-image.c +++ b/pixman/pixman/pixman-image.c @@ -888,7 +888,7 @@ pixman_image_get_format (pixman_image_t *image) if (image->type == BITS) return image->bits.format; - return 0; + return PIXMAN_null; } uint32_t diff --git a/pixman/pixman/pixman-implementation.c b/pixman/pixman/pixman-implementation.c index a70892c75..ec467a619 100644 --- a/pixman/pixman/pixman-implementation.c +++ b/pixman/pixman/pixman-implementation.c @@ -242,12 +242,12 @@ _pixman_implementation_fill (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor) + uint32_t filler) { while (imp) { if (imp->fill && - ((*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor))) + ((*imp->fill) (imp, bits, stride, bpp, x, y, width, height, filler))) { return TRUE; } diff --git a/pixman/pixman/pixman-inlines.h b/pixman/pixman/pixman-inlines.h index 13f901485..ce94e5248 100644 --- a/pixman/pixman/pixman-inlines.h +++ b/pixman/pixman/pixman-inlines.h @@ -314,36 +314,36 @@ scanline_func_name (dst_type_t *dst, \ \ if (a1 == 0xff) \ { \ - *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \ + *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \ } \ else if (s1) \ { \ - d = CONVERT_ ## DST_FORMAT ## _TO_8888 (*dst); \ - s1 = CONVERT_ ## SRC_FORMAT ## _TO_8888 (s1); \ + d = convert_ ## DST_FORMAT ## _to_8888 (*dst); \ + s1 = convert_ ## SRC_FORMAT ## _to_8888 (s1); \ a1 ^= 0xff; \ UN8x4_MUL_UN8_ADD_UN8x4 (d, a1, s1); \ - *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \ + *dst = convert_8888_to_ ## DST_FORMAT (d); \ } \ dst++; \ \ if (a2 == 0xff) \ { \ - *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s2); \ + *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s2); \ } \ else if (s2) \ { \ - d = CONVERT_## DST_FORMAT ## _TO_8888 (*dst); \ - s2 = CONVERT_## SRC_FORMAT ## _TO_8888 (s2); \ + d = convert_## DST_FORMAT ## _to_8888 (*dst); \ + s2 = convert_## SRC_FORMAT ## _to_8888 (s2); \ a2 ^= 0xff; \ UN8x4_MUL_UN8_ADD_UN8x4 (d, a2, s2); \ - *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \ + *dst = convert_8888_to_ ## DST_FORMAT (d); \ } \ dst++; \ } \ else /* PIXMAN_OP_SRC */ \ { \ - *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \ - *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s2); \ + *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \ + *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s2); \ } \ } \ \ @@ -358,21 +358,21 @@ scanline_func_name (dst_type_t *dst, \ \ if (a1 == 0xff) \ { \ - *dst = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \ + *dst = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \ } \ else if (s1) \ { \ - d = CONVERT_## DST_FORMAT ## _TO_8888 (*dst); \ - s1 = CONVERT_ ## SRC_FORMAT ## _TO_8888 (s1); \ + d = convert_## DST_FORMAT ## _to_8888 (*dst); \ + s1 = convert_ ## SRC_FORMAT ## _to_8888 (s1); \ a1 ^= 0xff; \ UN8x4_MUL_UN8_ADD_UN8x4 (d, a1, s1); \ - *dst = CONVERT_8888_TO_ ## DST_FORMAT (d); \ + *dst = convert_8888_to_ ## DST_FORMAT (d); \ } \ dst++; \ } \ else /* PIXMAN_OP_SRC */ \ { \ - *dst++ = CONVERT_ ## SRC_FORMAT ## _TO_ ## DST_FORMAT (s1); \ + *dst++ = convert_ ## SRC_FORMAT ## _to_ ## DST_FORMAT (s1); \ } \ } \ } diff --git a/pixman/pixman/pixman-mmx.c b/pixman/pixman/pixman-mmx.c index 71c013318..7fae1067e 100755 --- a/pixman/pixman/pixman-mmx.c +++ b/pixman/pixman/pixman-mmx.c @@ -2088,7 +2088,7 @@ mmx_fill (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor) + uint32_t filler) { uint64_t fill; __m64 vfill; @@ -2108,7 +2108,7 @@ mmx_fill (pixman_implementation_t *imp, byte_line = (uint8_t *)(((uint8_t *)bits) + stride * y + x); byte_width = width; stride *= 1; - xor = (xor & 0xff) * 0x01010101; + filler = (filler & 0xff) * 0x01010101; } else if (bpp == 16) { @@ -2116,7 +2116,7 @@ mmx_fill (pixman_implementation_t *imp, byte_line = (uint8_t *)(((uint16_t *)bits) + stride * y + x); byte_width = 2 * width; stride *= 2; - xor = (xor & 0xffff) * 0x00010001; + filler = (filler & 0xffff) * 0x00010001; } else { @@ -2126,7 +2126,7 @@ mmx_fill (pixman_implementation_t *imp, stride *= 4; } - fill = ((uint64_t)xor << 32) | xor; + fill = ((uint64_t)filler << 32) | filler; vfill = to_m64 (fill); #if defined __GNUC__ && defined USE_X86_MMX @@ -2153,21 +2153,21 @@ mmx_fill (pixman_implementation_t *imp, if (w >= 1 && ((uintptr_t)d & 1)) { - *(uint8_t *)d = (xor & 0xff); + *(uint8_t *)d = (filler & 0xff); w--; d++; } if (w >= 2 && ((uintptr_t)d & 3)) { - *(uint16_t *)d = (xor & 0xffff); + *(uint16_t *)d = (filler & 0xffff); w -= 2; d += 2; } while (w >= 4 && ((uintptr_t)d & 7)) { - *(uint32_t *)d = xor; + *(uint32_t *)d = filler; w -= 4; d += 4; @@ -2206,20 +2206,20 @@ mmx_fill (pixman_implementation_t *imp, while (w >= 4) { - *(uint32_t *)d = xor; + *(uint32_t *)d = filler; w -= 4; d += 4; } if (w >= 2) { - *(uint16_t *)d = (xor & 0xffff); + *(uint16_t *)d = (filler & 0xffff); w -= 2; d += 2; } if (w >= 1) { - *(uint8_t *)d = (xor & 0xff); + *(uint8_t *)d = (filler & 0xff); w--; d++; } @@ -2254,7 +2254,7 @@ mmx_composite_src_x888_0565 (pixman_implementation_t *imp, while (w && (uintptr_t)dst & 7) { s = *src++; - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); dst++; w--; } @@ -2277,7 +2277,7 @@ mmx_composite_src_x888_0565 (pixman_implementation_t *imp, while (w) { s = *src++; - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); dst++; w--; } @@ -3160,13 +3160,13 @@ mmx_composite_add_0565_0565 (pixman_implementation_t *imp, if (s) { d = *dst; - s = CONVERT_0565_TO_8888 (s); + s = convert_0565_to_8888 (s); if (d) { - d = CONVERT_0565_TO_8888 (d); + d = convert_0565_to_8888 (d); UN8x4_ADD_UN8x4 (s, d); } - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); } dst++; w--; @@ -3198,13 +3198,13 @@ mmx_composite_add_0565_0565 (pixman_implementation_t *imp, if (s) { d = *dst; - s = CONVERT_0565_TO_8888 (s); + s = convert_0565_to_8888 (s); if (d) { - d = CONVERT_0565_TO_8888 (d); + d = convert_0565_to_8888 (d); UN8x4_ADD_UN8x4 (s, d); } - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); } dst++; } @@ -3851,7 +3851,7 @@ mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask) { uint16_t s = *src++; - *dst++ = CONVERT_0565_TO_8888 (s); + *dst++ = convert_0565_to_8888 (s); w--; } @@ -3874,7 +3874,7 @@ mmx_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask) { uint16_t s = *src++; - *dst++ = CONVERT_0565_TO_8888 (s); + *dst++ = convert_0565_to_8888 (s); w--; } diff --git a/pixman/pixman/pixman-noop.c b/pixman/pixman/pixman-noop.c index 850caa192..e39996d9d 100644 --- a/pixman/pixman/pixman-noop.c +++ b/pixman/pixman/pixman-noop.c @@ -77,25 +77,33 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) iter->get_scanline = _pixman_iter_get_scanline_noop; } else if (image->common.extended_format_code == PIXMAN_solid && - ((iter->image_flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) == - (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP))) + (iter->image->type == SOLID || + (iter->image_flags & FAST_PATH_NO_ALPHA_MAP))) { - bits_image_t *bits = &image->bits; - if (iter->iter_flags & ITER_NARROW) { - uint32_t color = bits->fetch_pixel_32 (bits, 0, 0); uint32_t *buffer = iter->buffer; uint32_t *end = buffer + iter->width; + uint32_t color; + + if (image->type == SOLID) + color = image->solid.color_32; + else + color = image->bits.fetch_pixel_32 (&image->bits, 0, 0); while (buffer < end) *(buffer++) = color; } else { - argb_t color = bits->fetch_pixel_float (bits, 0, 0); argb_t *buffer = (argb_t *)iter->buffer; argb_t *end = buffer + iter->width; + argb_t color; + + if (image->type == SOLID) + color = image->solid.color_float; + else + color = image->bits.fetch_pixel_float (&image->bits, 0, 0); while (buffer < end) *(buffer++) = color; diff --git a/pixman/pixman/pixman-private.h b/pixman/pixman/pixman-private.h index 99125a17e..e5ab873ed 100644 --- a/pixman/pixman/pixman-private.h +++ b/pixman/pixman/pixman-private.h @@ -263,9 +263,6 @@ void _pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter); void -_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t *iter); - -void _pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter); void @@ -455,7 +452,7 @@ typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor); + uint32_t filler); typedef pixman_bool_t (*pixman_iter_init_func_t) (pixman_implementation_t *imp, pixman_iter_t *iter); @@ -542,7 +539,7 @@ _pixman_implementation_fill (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor); + uint32_t filler); pixman_bool_t _pixman_implementation_src_iter_init (pixman_implementation_t *imp, @@ -884,22 +881,51 @@ pixman_list_move_to_front (pixman_list_t *list, pixman_link_t *link) /* Conversion between 8888 and 0565 */ -#define CONVERT_8888_TO_0565(s) \ - ((((s) >> 3) & 0x001f) | \ - (((s) >> 5) & 0x07e0) | \ - (((s) >> 8) & 0xf800)) +static force_inline uint16_t +convert_8888_to_0565 (uint32_t s) +{ + /* The following code can be compiled into just 4 instructions on ARM */ + uint32_t a, b; + a = (s >> 3) & 0x1F001F; + b = s & 0xFC00; + a |= a >> 5; + a |= b >> 5; + return (uint16_t)a; +} -#define CONVERT_0565_TO_0888(s) \ - (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ - ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ - ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) +static force_inline uint32_t +convert_0565_to_0888 (uint16_t s) +{ + return (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | + ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | + ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))); +} -#define CONVERT_0565_TO_8888(s) (CONVERT_0565_TO_0888(s) | 0xff000000) +static force_inline uint32_t +convert_0565_to_8888 (uint16_t s) +{ + return convert_0565_to_0888 (s) | 0xff000000; +} /* Trivial versions that are useful in macros */ -#define CONVERT_8888_TO_8888(s) (s) -#define CONVERT_x888_TO_8888(s) ((s) | 0xff000000) -#define CONVERT_0565_TO_0565(s) (s) + +static force_inline uint32_t +convert_8888_to_8888 (uint32_t s) +{ + return s; +} + +static force_inline uint32_t +convert_x888_to_8888 (uint32_t s) +{ + return s | 0xff000000; +} + +static force_inline uint16_t +convert_0565_to_0565 (uint16_t s) +{ + return s; +} #define PIXMAN_FORMAT_IS_WIDE(f) \ (PIXMAN_FORMAT_A (f) > 8 || \ diff --git a/pixman/pixman/pixman-region.c b/pixman/pixman/pixman-region.c index 8955fe760..2d6f1571c 100644 --- a/pixman/pixman/pixman-region.c +++ b/pixman/pixman/pixman-region.c @@ -202,7 +202,7 @@ PIXREGION_SZOF (size_t n) return size + sizeof(region_data_type_t); } -static void * +static region_data_type_t * alloc_data (size_t n) { size_t sz = PIXREGION_SZOF (n); diff --git a/pixman/pixman/pixman-solid-fill.c b/pixman/pixman/pixman-solid-fill.c index 60d56d52a..5f9fef630 100644 --- a/pixman/pixman/pixman-solid-fill.c +++ b/pixman/pixman/pixman-solid-fill.c @@ -26,31 +26,6 @@ #endif #include "pixman-private.h" -void -_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t *iter) -{ - if (iter->iter_flags & ITER_NARROW) - { - uint32_t *b = (uint32_t *)iter->buffer; - uint32_t *e = b + iter->width; - uint32_t color = iter->image->solid.color_32; - - while (b < e) - *(b++) = color; - } - else - { - argb_t *b = (argb_t *)iter->buffer; - argb_t *e = b + iter->width; - argb_t color = image->solid.color_float; - - while (b < e) - *(b++) = color; - } - - iter->get_scanline = _pixman_iter_get_scanline_noop; -} - static uint32_t color_to_uint32 (const pixman_color_t *color) { diff --git a/pixman/pixman/pixman-sse2.c b/pixman/pixman/pixman-sse2.c index 59ff915b6..97d63d1ad 100644..100755 --- a/pixman/pixman/pixman-sse2.c +++ b/pixman/pixman/pixman-sse2.c @@ -2881,7 +2881,7 @@ sse2_composite_src_x888_0565 (pixman_implementation_t *imp, while (w && (uintptr_t)dst & 15) { s = *src++; - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); dst++; w--; } @@ -2901,7 +2901,7 @@ sse2_composite_src_x888_0565 (pixman_implementation_t *imp, while (w) { s = *src++; - *dst = CONVERT_8888_TO_0565 (s); + *dst = convert_8888_to_0565 (s); dst++; w--; } @@ -3321,7 +3321,7 @@ sse2_fill (pixman_implementation_t *imp, int y, int width, int height, - uint32_t xor) + uint32_t filler) { uint32_t byte_width; uint8_t *byte_line; @@ -3338,9 +3338,9 @@ sse2_fill (pixman_implementation_t *imp, byte_width = width; stride *= 1; - b = xor & 0xff; + b = filler & 0xff; w = (b << 8) | b; - xor = (w << 16) | w; + filler = (w << 16) | w; } else if (bpp == 16) { @@ -3349,7 +3349,7 @@ sse2_fill (pixman_implementation_t *imp, byte_width = 2 * width; stride *= 2; - xor = (xor & 0xffff) * 0x00010001; + filler = (filler & 0xffff) * 0x00010001; } else if (bpp == 32) { @@ -3363,7 +3363,7 @@ sse2_fill (pixman_implementation_t *imp, return FALSE; } - xmm_def = create_mask_2x32_128 (xor, xor); + xmm_def = create_mask_2x32_128 (filler, filler); while (height--) { @@ -3374,21 +3374,21 @@ sse2_fill (pixman_implementation_t *imp, if (w >= 1 && ((uintptr_t)d & 1)) { - *(uint8_t *)d = xor&0xff; + *(uint8_t *)d = filler&0xff; w -= 1; d += 1; } while (w >= 2 && ((uintptr_t)d & 3)) { - *(uint16_t *)d = xor&0xffff; + *(uint16_t *)d = filler&0xffff; w -= 2; d += 2; } while (w >= 4 && ((uintptr_t)d & 15)) { - *(uint32_t *)d = xor; + *(uint32_t *)d = filler; w -= 4; d += 4; @@ -3439,7 +3439,7 @@ sse2_fill (pixman_implementation_t *imp, while (w >= 4) { - *(uint32_t *)d = xor; + *(uint32_t *)d = filler; w -= 4; d += 4; @@ -3447,14 +3447,14 @@ sse2_fill (pixman_implementation_t *imp, if (w >= 2) { - *(uint16_t *)d = xor&0xffff; + *(uint16_t *)d = filler&0xffff; w -= 2; d += 2; } if (w >= 1) { - *(uint8_t *)d = xor&0xff; + *(uint8_t *)d = filler&0xff; w -= 1; d += 1; } @@ -5970,7 +5970,7 @@ sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask) { uint16_t s = *src++; - *dst++ = CONVERT_0565_TO_8888 (s); + *dst++ = convert_0565_to_8888 (s); w--; } @@ -5995,7 +5995,7 @@ sse2_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask) { uint16_t s = *src++; - *dst++ = CONVERT_0565_TO_8888 (s); + *dst++ = convert_0565_to_8888 (s); w--; } diff --git a/pixman/pixman/pixman-trap.c b/pixman/pixman/pixman-trap.c index f0935b217..7ccf91be3 100644 --- a/pixman/pixman/pixman-trap.c +++ b/pixman/pixman/pixman-trap.c @@ -491,6 +491,8 @@ pixman_composite_trapezoids (pixman_op_t op, { int i; + return_if_fail (PIXMAN_FORMAT_TYPE (mask_format) == PIXMAN_TYPE_A); + if (n_traps <= 0) return; @@ -521,8 +523,9 @@ pixman_composite_trapezoids (pixman_op_t op, if (!get_trap_extents (op, dst, traps, n_traps, &box)) return; - tmp = pixman_image_create_bits ( - mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1); + if (!(tmp = pixman_image_create_bits ( + mask_format, box.x2 - box.x1, box.y2 - box.y1, NULL, -1))) + return; for (i = 0; i < n_traps; ++i) { diff --git a/pixman/pixman/pixman.c b/pixman/pixman/pixman.c index 0661f41b0..3fabed161 100644 --- a/pixman/pixman/pixman.c +++ b/pixman/pixman/pixman.c @@ -766,10 +766,10 @@ pixman_fill (uint32_t *bits, int y, int width, int height, - uint32_t xor) + uint32_t filler) { return _pixman_implementation_fill ( - get_implementation(), bits, stride, bpp, x, y, width, height, xor); + get_implementation(), bits, stride, bpp, x, y, width, height, filler); } static uint32_t @@ -828,7 +828,7 @@ color_to_pixel (const pixman_color_t *color, c = c >> 24; else if (format == PIXMAN_r5g6b5 || format == PIXMAN_b5g6r5) - c = CONVERT_8888_TO_0565 (c); + c = convert_8888_to_0565 (c); #if 0 printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue); diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c index 3afa926b0..2f97b7b24 100644 --- a/pixman/test/lowlevel-blt-bench.c +++ b/pixman/test/lowlevel-blt-bench.c @@ -616,6 +616,7 @@ tests_tbl[] = { "src_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, { "src_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, { "src_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_0565_8888", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, { "src_8888_4444", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, { "src_8888_2222", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, { "src_8888_2x10", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c index ee55c21ea..9d949afad 100644 --- a/pixman/test/stress-test.c +++ b/pixman/test/stress-test.c @@ -205,8 +205,29 @@ rand_y (pixman_image_t *image) return log_rand (); } +static pixman_format_code_t +random_format (pixman_bool_t prefer_alpha) +{ + pixman_format_code_t format; + int n = prng_rand_n (ARRAY_LENGTH (image_formats)); + + if (prefer_alpha && prng_rand_n (4) != 0) + { + do + { + format = image_formats[n++ % ARRAY_LENGTH (image_formats)]; + } while (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_A); + } + else + { + format = image_formats[n]; + } + + return format; +} + static pixman_image_t * -create_random_bits_image (void) +create_random_bits_image (pixman_bool_t prefer_alpha) { pixman_format_code_t format; pixman_indexed_t *indexed; @@ -220,7 +241,7 @@ create_random_bits_image (void) int n_coefficients = 0; /* format */ - format = image_formats[prng_rand_n (ARRAY_LENGTH (image_formats))]; + format = random_format (prefer_alpha); indexed = NULL; if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR) @@ -389,7 +410,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map) pixman_image_t *alpha_map; int16_t x, y; - alpha_map = create_random_bits_image (); + alpha_map = create_random_bits_image (FALSE); if (alpha_map) { @@ -695,7 +716,7 @@ create_random_image (void) { default: case 0: - result = create_random_bits_image (); + result = create_random_bits_image (FALSE); break; case 1: @@ -721,6 +742,39 @@ create_random_image (void) return result; } +static void +random_line (pixman_line_fixed_t *line, int width, int height) +{ + line->p1.x = prng_rand_n (width) << 16; + line->p1.y = prng_rand_n (height) << 16; + line->p2.x = prng_rand_n (width) << 16; + line->p2.y = prng_rand_n (height) << 16; +} + +static pixman_trapezoid_t * +create_random_trapezoids (int *n_traps, int height, int width) +{ + pixman_trapezoid_t *trapezoids; + int i; + + *n_traps = prng_rand_n (16) + 1; + + trapezoids = malloc (sizeof (pixman_trapezoid_t) * *n_traps); + + for (i = 0; i < *n_traps; ++i) + { + pixman_trapezoid_t *t = &(trapezoids[i]); + + t->top = prng_rand_n (height) << 16; + t->bottom = prng_rand_n (height) << 16; + + random_line (&t->left, height, width); + random_line (&t->right, height, width); + } + + return trapezoids; +} + static const pixman_op_t op_list[] = { PIXMAN_OP_SRC, @@ -792,31 +846,87 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod) if (mod == 0 || (seed % mod) == 0) printf ("Seed 0x%08x\n", seed); } - - prng_srand (seed); - source = create_random_image (); - mask = create_random_image (); - dest = create_random_bits_image (); + source = mask = dest = NULL; + + prng_srand (seed); - if (source && mask && dest) + if (prng_rand_n (8) == 0) { - set_general_properties (dest, TRUE); - - op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; - - pixman_image_composite32 (op, - source, mask, dest, - rand_x (source), rand_y (source), - rand_x (mask), rand_y (mask), - 0, 0, - dest->bits.width, - dest->bits.height); + int n_traps; + pixman_trapezoid_t *trapezoids; + + dest = create_random_bits_image (TRUE); + + if (dest) + { + set_general_properties (dest, TRUE); + + trapezoids = create_random_trapezoids ( + &n_traps, dest->bits.width, dest->bits.height); + + if (trapezoids) + { + switch (prng_rand_n (3)) + { + case 0: + pixman_rasterize_trapezoid ( + dest, &trapezoids[prng_rand_n (n_traps)], + rand_x (dest), rand_y (dest)); + break; + + case 1: + source = create_random_image (); + + if (source) + { + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_composite_trapezoids ( + op, source, dest, + random_format (TRUE), + rand_x (source), rand_y (source), + rand_x (dest), rand_y (dest), + n_traps, trapezoids); + } + break; + + case 2: + pixman_add_trapezoids ( + dest, rand_x (dest), rand_y (dest), n_traps, trapezoids); + break; + } + + free (trapezoids); + } + } } - if (source) - pixman_image_unref (source); - if (mask) - pixman_image_unref (mask); + else + { + dest = create_random_bits_image (FALSE); + source = create_random_image (); + mask = create_random_image (); + + if (source && mask && dest) + { + set_general_properties (dest, TRUE); + + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_image_composite32 (op, + source, mask, dest, + rand_x (source), rand_y (source), + rand_x (mask), rand_y (mask), + 0, 0, + dest->bits.width, + dest->bits.height); + } + } + + if (source) + pixman_image_unref (source); + if (mask) + pixman_image_unref (mask); if (dest) pixman_image_unref (dest); } |