aboutsummaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-08-24 18:51:48 +0000
committermarha <marha@users.sourceforge.net>2010-08-24 18:51:48 +0000
commitc5e0555ef58f02918a9803cb910e2cc523260d5d (patch)
tree61a37e4e7898c36e58d63369272b9a6ffb405ce0 /pixman
parentd23cfa7fb93fc22ea11fd25d50aecb10582e32b2 (diff)
downloadvcxsrv-c5e0555ef58f02918a9803cb910e2cc523260d5d.tar.gz
vcxsrv-c5e0555ef58f02918a9803cb910e2cc523260d5d.tar.bz2
vcxsrv-c5e0555ef58f02918a9803cb910e2cc523260d5d.zip
libxcb pixman git update 24/8/2010
Diffstat (limited to 'pixman')
-rw-r--r--pixman/configure.ac2
-rw-r--r--pixman/pixman/pixman-region.c42
-rw-r--r--pixman/pixman/pixman-region16.c130
-rw-r--r--pixman/pixman/pixman-region32.c90
-rw-r--r--pixman/pixman/pixman.c17
-rw-r--r--pixman/test/Makefile.am2
-rw-r--r--pixman/test/region-translate-test.c30
7 files changed, 178 insertions, 135 deletions
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 <sandmann@redhat.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#undef PIXMAN_DISABLE_DEPRECATED
-
-#include "pixman-private.h"
-
-#include <stdlib.h>
-
-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 <sandmann@redhat.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#undef PIXMAN_DISABLE_DEPRECATED
+
+#include "pixman-private.h"
+
+#include <stdlib.h>
+
+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 <sandmann@redhat.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pixman-private.h"
-
-#include <stdlib.h>
-
-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 <sandmann@redhat.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pixman-private.h"
+
+#include <stdlib.h>
+
+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 <pixman.h>
+#include <assert.h>
+
+/* 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;
+}