From c5e0555ef58f02918a9803cb910e2cc523260d5d Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 24 Aug 2010 18:51:48 +0000 Subject: libxcb pixman git update 24/8/2010 --- pixman/configure.ac | 2 +- pixman/pixman/pixman-region.c | 42 ++++++------ pixman/pixman/pixman-region16.c | 130 +++++++++++++++++++----------------- pixman/pixman/pixman-region32.c | 90 +++++++++++++------------ pixman/pixman/pixman.c | 17 +++-- pixman/test/Makefile.am | 2 + pixman/test/region-translate-test.c | 30 +++++++++ 7 files changed, 178 insertions(+), 135 deletions(-) create mode 100644 pixman/test/region-translate-test.c (limited to 'pixman') diff --git a/pixman/configure.ac b/pixman/configure.ac index be1690b3b..1b592de14 100644 --- a/pixman/configure.ac +++ b/pixman/configure.ac @@ -54,7 +54,7 @@ AC_PREREQ([2.57]) m4_define([pixman_major], 0) m4_define([pixman_minor], 19) -m4_define([pixman_micro], 1) +m4_define([pixman_micro], 3) m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro]) diff --git a/pixman/pixman/pixman-region.c b/pixman/pixman/pixman-region.c index 4f694b63b..52e26dd5c 100644 --- a/pixman/pixman/pixman-region.c +++ b/pixman/pixman/pixman-region.c @@ -2212,7 +2212,7 @@ PIXMAN_EXPORT PREFIX (_contains_rectangle) (region_type_t * region, PIXMAN_EXPORT void PREFIX (_translate) (region_type_t *region, int x, int y) { - int x1, x2, y1, y2; + overflow_int_t x1, x2, y1, y2; int nbox; box_type_t * pbox; @@ -2222,7 +2222,7 @@ PREFIX (_translate) (region_type_t *region, int x, int y) region->extents.x2 = x2 = region->extents.x2 + x; region->extents.y2 = y2 = region->extents.y2 + y; - if (((x1 - SHRT_MIN) | (y1 - SHRT_MIN) | (SHRT_MAX - x2) | (SHRT_MAX - y2)) >= 0) + if (((x1 - PIXMAN_REGION_MIN) | (y1 - PIXMAN_REGION_MIN) | (PIXMAN_REGION_MAX - x2) | (PIXMAN_REGION_MAX - y2)) >= 0) { if (region->data && (nbox = region->data->numRects)) { @@ -2237,7 +2237,7 @@ PREFIX (_translate) (region_type_t *region, int x, int y) return; } - if (((x2 - SHRT_MIN) | (y2 - SHRT_MIN) | (SHRT_MAX - x1) | (SHRT_MAX - y1)) <= 0) + if (((x2 - PIXMAN_REGION_MIN) | (y2 - PIXMAN_REGION_MIN) | (PIXMAN_REGION_MAX - x1) | (PIXMAN_REGION_MAX - y1)) <= 0) { region->extents.x2 = region->extents.x1; region->extents.y2 = region->extents.y1; @@ -2246,15 +2246,15 @@ PREFIX (_translate) (region_type_t *region, int x, int y) return; } - if (x1 < SHRT_MIN) - region->extents.x1 = SHRT_MIN; - else if (x2 > SHRT_MAX) - region->extents.x2 = SHRT_MAX; + if (x1 < PIXMAN_REGION_MIN) + region->extents.x1 = PIXMAN_REGION_MIN; + else if (x2 > PIXMAN_REGION_MAX) + region->extents.x2 = PIXMAN_REGION_MAX; - if (y1 < SHRT_MIN) - region->extents.y1 = SHRT_MIN; - else if (y2 > SHRT_MAX) - region->extents.y2 = SHRT_MAX; + if (y1 < PIXMAN_REGION_MIN) + region->extents.y1 = PIXMAN_REGION_MIN; + else if (y2 > PIXMAN_REGION_MAX) + region->extents.y2 = PIXMAN_REGION_MAX; if (region->data && (nbox = region->data->numRects)) { @@ -2267,22 +2267,22 @@ PREFIX (_translate) (region_type_t *region, int x, int y) pbox_out->x2 = x2 = pbox->x2 + x; pbox_out->y2 = y2 = pbox->y2 + y; - if (((x2 - SHRT_MIN) | (y2 - SHRT_MIN) | - (SHRT_MAX - x1) | (SHRT_MAX - y1)) <= 0) + if (((x2 - PIXMAN_REGION_MIN) | (y2 - PIXMAN_REGION_MIN) | + (PIXMAN_REGION_MAX - x1) | (PIXMAN_REGION_MAX - y1)) <= 0) { region->data->numRects--; continue; } - if (x1 < SHRT_MIN) - pbox_out->x1 = SHRT_MIN; - else if (x2 > SHRT_MAX) - pbox_out->x2 = SHRT_MAX; + if (x1 < PIXMAN_REGION_MIN) + pbox_out->x1 = PIXMAN_REGION_MIN; + else if (x2 > PIXMAN_REGION_MAX) + pbox_out->x2 = PIXMAN_REGION_MAX; - if (y1 < SHRT_MIN) - pbox_out->y1 = SHRT_MIN; - else if (y2 > SHRT_MAX) - pbox_out->y2 = SHRT_MAX; + if (y1 < PIXMAN_REGION_MIN) + pbox_out->y1 = PIXMAN_REGION_MIN; + else if (y2 > PIXMAN_REGION_MAX) + pbox_out->y2 = PIXMAN_REGION_MAX; pbox_out++; } diff --git a/pixman/pixman/pixman-region16.c b/pixman/pixman/pixman-region16.c index 46f5e26ea..39d122590 100644 --- a/pixman/pixman/pixman-region16.c +++ b/pixman/pixman/pixman-region16.c @@ -1,63 +1,67 @@ -/* - * Copyright © 2008 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Soren Sandmann - */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#undef PIXMAN_DISABLE_DEPRECATED - -#include "pixman-private.h" - -#include - -typedef pixman_box16_t box_type_t; -typedef pixman_region16_data_t region_data_type_t; -typedef pixman_region16_t region_type_t; - -typedef struct { - int x, y; -} point_type_t; - -#define PREFIX(x) pixman_region##x - -#include "pixman-region.c" - -/* This function exists only to make it possible to preserve the X ABI - - * it should go away at first opportunity. - * - * The problem is that the X ABI exports the three structs and has used - * them through macros. So the X server calls this function with - * the addresses of those structs which makes the existing code continue to - * work. - */ -PIXMAN_EXPORT void -pixman_region_set_static_pointers (pixman_box16_t *empty_box, - pixman_region16_data_t *empty_data, - pixman_region16_data_t *broken_data) -{ - pixman_region_empty_box = empty_box; - pixman_region_empty_data = empty_data; - pixman_broken_data = broken_data; -} +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Soren Sandmann + */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#undef PIXMAN_DISABLE_DEPRECATED + +#include "pixman-private.h" + +#include + +typedef pixman_box16_t box_type_t; +typedef pixman_region16_data_t region_data_type_t; +typedef pixman_region16_t region_type_t; +typedef int32_t overflow_int_t; + +typedef struct { + int x, y; +} point_type_t; + +#define PREFIX(x) pixman_region##x + +#define PIXMAN_REGION_MAX INT16_MAX +#define PIXMAN_REGION_MIN INT16_MIN + +#include "pixman-region.c" + +/* This function exists only to make it possible to preserve the X ABI - + * it should go away at first opportunity. + * + * The problem is that the X ABI exports the three structs and has used + * them through macros. So the X server calls this function with + * the addresses of those structs which makes the existing code continue to + * work. + */ +PIXMAN_EXPORT void +pixman_region_set_static_pointers (pixman_box16_t *empty_box, + pixman_region16_data_t *empty_data, + pixman_region16_data_t *broken_data) +{ + pixman_region_empty_box = empty_box; + pixman_region_empty_data = empty_data; + pixman_broken_data = broken_data; +} diff --git a/pixman/pixman/pixman-region32.c b/pixman/pixman/pixman-region32.c index aeee86cf9..ccab36050 100644 --- a/pixman/pixman/pixman-region32.c +++ b/pixman/pixman/pixman-region32.c @@ -1,43 +1,47 @@ -/* - * Copyright © 2008 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Soren Sandmann - */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "pixman-private.h" - -#include - -typedef pixman_box32_t box_type_t; -typedef pixman_region32_data_t region_data_type_t; -typedef pixman_region32_t region_type_t; - -typedef struct { - int x, y; -} point_type_t; - -#define PREFIX(x) pixman_region32##x - -#include "pixman-region.c" +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Soren Sandmann + */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "pixman-private.h" + +#include + +typedef pixman_box32_t box_type_t; +typedef pixman_region32_data_t region_data_type_t; +typedef pixman_region32_t region_type_t; +typedef int64_t overflow_int_t; + +typedef struct { + int x, y; +} point_type_t; + +#define PREFIX(x) pixman_region32##x + +#define PIXMAN_REGION_MAX INT32_MAX +#define PIXMAN_REGION_MIN INT32_MIN + +#include "pixman-region.c" diff --git a/pixman/pixman/pixman.c b/pixman/pixman/pixman.c index 819bb5146..81cf20a8f 100644 --- a/pixman/pixman/pixman.c +++ b/pixman/pixman/pixman.c @@ -787,14 +787,17 @@ analyze_extent (pixman_image_t *image, int x, int y, if (!compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) return FALSE; - /* Check whether the non-expanded, transformed extent is entirely within - * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is. - */ - ex = *extents; - if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) + if (image->type == BITS) { - if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height) - *flags |= FAST_PATH_SAMPLES_COVER_CLIP; + /* Check whether the non-expanded, transformed extent is entirely within + * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is. + */ + ex = *extents; + if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) + { + if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height) + *flags |= FAST_PATH_SAMPLES_COVER_CLIP; + } } return TRUE; diff --git a/pixman/test/Makefile.am b/pixman/test/Makefile.am index d3e9d3fa0..108ae96ee 100644 --- a/pixman/test/Makefile.am +++ b/pixman/test/Makefile.am @@ -7,6 +7,7 @@ INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman TESTPROGRAMS = \ a1-trap-test \ region-test \ + region-translate-test \ fetch-test \ oob-test \ window-test \ @@ -27,6 +28,7 @@ trap_crasher_LDADD = $(TEST_LDADD) oob_test_LDADD = $(TEST_LDADD) window_test_LDADD = $(TEST_LDADD) scaling_crash_test_LDADD = $(TEST_LDADD) +region_translate_test_LDADD = $(TEST_LDADD) region_test_LDADD = $(TEST_LDADD) region_test_SOURCES = region-test.c utils.c utils.h diff --git a/pixman/test/region-translate-test.c b/pixman/test/region-translate-test.c new file mode 100644 index 000000000..7c63df966 --- /dev/null +++ b/pixman/test/region-translate-test.c @@ -0,0 +1,30 @@ +#include +#include + +/* Pixman had a bug where 32bit regions where clipped to 16bit sizes when + * pixman_region32_translate() was called. This test exercises that bug. + */ + +#define LARGE 32000 + +int +main (int argc, char **argv) +{ + pixman_box32_t rect = { -LARGE, -LARGE, LARGE, LARGE }; + pixman_region32_t r1, r2; + + pixman_region32_init_rects (&r1, &rect, 1); + pixman_region32_init_rect (&r2, rect.x1, rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1); + + assert (pixman_region32_equal (&r1, &r2)); + + pixman_region32_translate (&r1, -LARGE, LARGE); + pixman_region32_translate (&r1, LARGE, -LARGE); + + assert (pixman_region32_equal (&r1, &r2)); + + pixman_region32_fini (&r1); + pixman_region32_fini (&r2); + + return 0; +} -- cgit v1.2.3