summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@daimi.au.dk>2008-06-09 01:57:26 -0400
committerSøren Sandmann Pedersen <sandmann@daimi.au.dk>2008-06-09 01:57:26 -0400
commit95e749168d08cd35e151e612404c9318dcb0df9e (patch)
treedfa821c7d85f9a22292e4a9dfbce032194f2db6a
parentf7f5da7fc446c3cadb3f82a2ddc6ae57f4c4b795 (diff)
parentae1f016d404d323158072499f83185d4e83eaedb (diff)
Merge region32 branch; fix conflicts
-rw-r--r--TODO2
-rw-r--r--pixman/Makefile.am6
-rw-r--r--pixman/pixman-compute-region.c105
-rw-r--r--pixman/pixman-edge.c2
-rw-r--r--pixman/pixman-image.c105
-rw-r--r--pixman/pixman-pict.c18
-rw-r--r--pixman/pixman-private.h32
-rw-r--r--pixman/pixman-region.c706
-rw-r--r--pixman/pixman-region16.c70
-rw-r--r--pixman/pixman-region32.c68
-rw-r--r--pixman/pixman-transformed.c42
-rw-r--r--pixman/pixman-trap.c16
-rw-r--r--pixman/pixman-utils.c20
-rw-r--r--pixman/pixman.h437
-rw-r--r--test/Makefile.am2
-rw-r--r--test/region-test.c23
16 files changed, 805 insertions, 849 deletions
diff --git a/TODO b/TODO
index 5acadf3..4f8f9c4 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+ - Behdad's MMX issue - see list
+
- SSE 2 issues:
- Commented-out uses of fbCompositeCopyAreasse2()
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index b7810fe..68ba6d9 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -1,11 +1,13 @@
lib_LTLIBRARIES = libpixman-1.la
libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
libpixman_1_la_LIBADD = @DEP_LIBS@ -lm
+libpixman_1_la_CFLAGS = -DPIXMAN_DISABLE_DEPRECATED
libpixman_1_la_SOURCES = \
pixman.h \
pixman-access.c \
pixman-access-accessors.c \
- pixman-region.c \
+ pixman-region16.c \
+ pixman-region32.c \
pixman-private.h \
pixman-image.c \
pixman-combine32.c \
@@ -38,7 +40,7 @@ pixman-combine64.c : combine.inc pixman-combine64.h combine.pl
pixman-combine64.h : combine.h.inc combine.pl
$(PERL) $(srcdir)/combine.pl 16 < $(srcdir)/combine.h.inc > $@ || ($(RM) $@; exit 1)
-EXTRA_DIST = Makefile.win32 combine.inc combine.pl combine.h.inc
+EXTRA_DIST = Makefile.win32 combine.inc combine.pl pixman-region.c combine.h.inc
CLEANFILES = pixman-combine32.c pixman-combine64.c pixman-combine32.h pixman-combine64.h
# mmx code
diff --git a/pixman/pixman-compute-region.c b/pixman/pixman-compute-region.c
index 1e566a9..a93cee0 100644
--- a/pixman/pixman-compute-region.c
+++ b/pixman/pixman-compute-region.c
@@ -32,16 +32,16 @@
#define BOUND(v) (int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
static inline pixman_bool_t
-miClipPictureReg (pixman_region16_t * pRegion,
- pixman_region16_t * pClip,
+miClipPictureReg (pixman_region32_t * pRegion,
+ pixman_region32_t * pClip,
int dx,
int dy)
{
- if (pixman_region_n_rects(pRegion) == 1 &&
- pixman_region_n_rects(pClip) == 1)
+ if (pixman_region32_n_rects(pRegion) == 1 &&
+ pixman_region32_n_rects(pClip) == 1)
{
- pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
- pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
+ pixman_box32_t * pRbox = pixman_region32_rectangles(pRegion, NULL);
+ pixman_box32_t * pCbox = pixman_region32_rectangles(pClip, NULL);
int v;
if (pRbox->x1 < (v = pCbox->x1 + dx))
@@ -55,26 +55,26 @@ miClipPictureReg (pixman_region16_t * pRegion,
if (pRbox->x1 >= pRbox->x2 ||
pRbox->y1 >= pRbox->y2)
{
- pixman_region_init (pRegion);
+ pixman_region32_init (pRegion);
}
}
- else if (!pixman_region_not_empty (pClip))
+ else if (!pixman_region32_not_empty (pClip))
return FALSE;
else
{
if (dx || dy)
- pixman_region_translate (pRegion, -dx, -dy);
- if (!pixman_region_intersect (pRegion, pRegion, pClip))
+ pixman_region32_translate (pRegion, -dx, -dy);
+ if (!pixman_region32_intersect (pRegion, pRegion, pClip))
return FALSE;
if (dx || dy)
- pixman_region_translate(pRegion, dx, dy);
+ pixman_region32_translate(pRegion, dx, dy);
}
- return pixman_region_not_empty(pRegion);
+ return pixman_region32_not_empty(pRegion);
}
static inline pixman_bool_t
-miClipPictureSrc (pixman_region16_t * pRegion,
+miClipPictureSrc (pixman_region32_t * pRegion,
pixman_image_t * pPicture,
int dx,
int dy)
@@ -98,13 +98,13 @@ miClipPictureSrc (pixman_region16_t * pRegion,
*/
if (pPicture->common.has_client_clip)
{
- pixman_region_translate ( pRegion, dx, dy);
+ pixman_region32_translate ( pRegion, dx, dy);
- if (!pixman_region_intersect (pRegion, pRegion,
- (pixman_region16_t *) pPicture->common.src_clip))
+ if (!pixman_region32_intersect (pRegion, pRegion,
+ pPicture->common.src_clip))
return FALSE;
- pixman_region_translate ( pRegion, -dx, -dy);
+ pixman_region32_translate ( pRegion, -dx, -dy);
}
return TRUE;
@@ -124,18 +124,18 @@ miClipPictureSrc (pixman_region16_t * pRegion,
*/
pixman_bool_t
-pixman_compute_composite_region (pixman_region16_t * pRegion,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- int16_t xSrc,
- int16_t ySrc,
- int16_t xMask,
- int16_t yMask,
- int16_t xDst,
- int16_t yDst,
- uint16_t width,
- uint16_t height)
+pixman_compute_composite_region32 (pixman_region32_t * pRegion,
+ pixman_image_t * pSrc,
+ pixman_image_t * pMask,
+ pixman_image_t * pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height)
{
int v;
@@ -150,13 +150,13 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
pRegion->extents.y1 >= pRegion->extents.y2)
{
- pixman_region_init (pRegion);
+ pixman_region32_init (pRegion);
return FALSE;
}
/* clip against dst */
if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pDst->common.alpha_map)
@@ -165,14 +165,14 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
-pDst->common.alpha_origin.x,
-pDst->common.alpha_origin.y))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
/* clip against src */
if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pSrc->common.alpha_map)
@@ -181,7 +181,7 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
xDst - (xSrc + pSrc->common.alpha_origin.x),
yDst - (ySrc + pSrc->common.alpha_origin.y)))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
@@ -190,7 +190,7 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
{
if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
if (pMask->common.alpha_map)
@@ -199,7 +199,7 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
xDst - (xMask + pMask->common.alpha_origin.x),
yDst - (yMask + pMask->common.alpha_origin.y)))
{
- pixman_region_fini (pRegion);
+ pixman_region32_fini (pRegion);
return FALSE;
}
}
@@ -207,3 +207,36 @@ pixman_compute_composite_region (pixman_region16_t * pRegion,
return TRUE;
}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_compute_composite_region (pixman_region16_t * pRegion,
+ pixman_image_t * pSrc,
+ pixman_image_t * pMask,
+ pixman_image_t * pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height)
+{
+ pixman_region32_t r32;
+ pixman_bool_t retval;
+
+ pixman_region32_init (&r32);
+
+ retval = pixman_compute_composite_region32 (&r32, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+
+ if (retval)
+ {
+ if (!pixman_region16_copy_from_region32 (pRegion, &r32))
+ retval = FALSE;
+ }
+
+ pixman_region32_fini (&r32);
+ return retval;
+}
diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c
index 717284f..b9246af 100644
--- a/pixman/pixman-edge.c
+++ b/pixman/pixman-edge.c
@@ -315,7 +315,7 @@ PIXMAN_RASTERIZE_EDGES (pixman_image_t *image,
#ifndef PIXMAN_FB_ACCESSORS
-void
+PIXMAN_EXPORT void
pixman_rasterize_edges (pixman_image_t *image,
pixman_edge_t *l,
pixman_edge_t *r,
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index f34053c..487a672 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -81,8 +81,8 @@ allocate_image (void)
{
image_common_t *common = &image->common;
- pixman_region_init (&common->full_region);
- pixman_region_init (&common->clip_region);
+ pixman_region32_init (&common->full_region);
+ pixman_region32_init (&common->clip_region);
common->src_clip = &common->full_region;
common->has_client_clip = FALSE;
common->transform = NULL;
@@ -101,7 +101,7 @@ allocate_image (void)
}
/* Ref Counting */
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_ref (pixman_image_t *image)
{
image->common.ref_count++;
@@ -110,7 +110,7 @@ pixman_image_ref (pixman_image_t *image)
}
/* returns TRUE when the image is freed */
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_image_unref (pixman_image_t *image)
{
image_common_t *common = (image_common_t *)image;
@@ -119,8 +119,8 @@ pixman_image_unref (pixman_image_t *image)
if (common->ref_count == 0)
{
- pixman_region_fini (&common->clip_region);
- pixman_region_fini (&common->full_region);
+ pixman_region32_fini (&common->clip_region);
+ pixman_region32_fini (&common->full_region);
if (common->transform)
free (common->transform);
@@ -158,7 +158,7 @@ pixman_image_unref (pixman_image_t *image)
}
/* Constructors */
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_create_solid_fill (pixman_color_t *color)
{
pixman_image_t *img = allocate_image();
@@ -173,7 +173,7 @@ pixman_image_create_solid_fill (pixman_color_t *color)
return img;
}
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
pixman_point_fixed_t *p2,
const pixman_gradient_stop_t *stops,
@@ -206,7 +206,7 @@ pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
}
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
pixman_point_fixed_t *outer,
pixman_fixed_t inner_radius,
@@ -250,7 +250,7 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
return image;
}
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
pixman_fixed_t angle,
const pixman_gradient_stop_t *stops,
@@ -323,20 +323,20 @@ create_bits (pixman_format_code_t format,
static void
reset_clip_region (pixman_image_t *image)
{
- pixman_region_fini (&image->common.clip_region);
+ pixman_region32_fini (&image->common.clip_region);
if (image->type == BITS)
{
- pixman_region_init_rect (&image->common.clip_region, 0, 0,
- image->bits.width, image->bits.height);
+ pixman_region32_init_rect (&image->common.clip_region, 0, 0,
+ image->bits.width, image->bits.height);
}
else
{
- pixman_region_init (&image->common.clip_region);
+ pixman_region32_init (&image->common.clip_region);
}
}
-pixman_image_t *
+PIXMAN_EXPORT pixman_image_t *
pixman_image_create_bits (pixman_format_code_t format,
int width,
int height,
@@ -378,15 +378,34 @@ pixman_image_create_bits (pixman_format_code_t format,
*/
image->bits.indexed = NULL;
- pixman_region_fini (&image->common.full_region);
- pixman_region_init_rect (&image->common.full_region, 0, 0,
- image->bits.width, image->bits.height);
+ pixman_region32_fini (&image->common.full_region);
+ pixman_region32_init_rect (&image->common.full_region, 0, 0,
+ image->bits.width, image->bits.height);
reset_clip_region (image);
return image;
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
+pixman_image_set_clip_region32 (pixman_image_t *image,
+ pixman_region32_t *region)
+{
+ image_common_t *common = (image_common_t *)image;
+
+ if (region)
+ {
+ return pixman_region32_copy (&common->clip_region, region);
+ }
+ else
+ {
+ reset_clip_region (image);
+
+ return TRUE;
+ }
+}
+
+
+PIXMAN_EXPORT pixman_bool_t
pixman_image_set_clip_region (pixman_image_t *image,
pixman_region16_t *region)
{
@@ -394,7 +413,7 @@ pixman_image_set_clip_region (pixman_image_t *image,
if (region)
{
- return pixman_region_copy (&common->clip_region, region);
+ return pixman_region32_copy_from_region16 (&common->clip_region, region);
}
else
{
@@ -406,14 +425,14 @@ pixman_image_set_clip_region (pixman_image_t *image,
/* Sets whether the clip region includes a clip region set by the client
*/
-void
+PIXMAN_EXPORT void
pixman_image_set_has_client_clip (pixman_image_t *image,
pixman_bool_t client_clip)
{
image->common.has_client_clip = client_clip;
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_image_set_transform (pixman_image_t *image,
const pixman_transform_t *transform)
{
@@ -447,14 +466,14 @@ pixman_image_set_transform (pixman_image_t *image,
return TRUE;
}
-void
+PIXMAN_EXPORT void
pixman_image_set_repeat (pixman_image_t *image,
pixman_repeat_t repeat)
{
image->common.repeat = repeat;
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_image_set_filter (pixman_image_t *image,
pixman_filter_t filter,
const pixman_fixed_t *params,
@@ -487,7 +506,7 @@ pixman_image_set_filter (pixman_image_t *image,
return TRUE;
}
-void
+PIXMAN_EXPORT void
pixman_image_set_source_clipping (pixman_image_t *image,
pixman_bool_t source_clipping)
{
@@ -503,7 +522,7 @@ pixman_image_set_source_clipping (pixman_image_t *image,
* copy the content of indexed. Doing this copying is simply
* way, way too expensive.
*/
-void
+PIXMAN_EXPORT void
pixman_image_set_indexed (pixman_image_t *image,
const pixman_indexed_t *indexed)
{
@@ -512,7 +531,7 @@ pixman_image_set_indexed (pixman_image_t *image,
bits->indexed = indexed;
}
-void
+PIXMAN_EXPORT void
pixman_image_set_alpha_map (pixman_image_t *image,
pixman_image_t *alpha_map,
int16_t x,
@@ -537,7 +556,7 @@ pixman_image_set_alpha_map (pixman_image_t *image,
common->alpha_origin.y = y;
}
-void
+PIXMAN_EXPORT void
pixman_image_set_component_alpha (pixman_image_t *image,
pixman_bool_t component_alpha)
{
@@ -545,7 +564,7 @@ pixman_image_set_component_alpha (pixman_image_t *image,
}
-void
+PIXMAN_EXPORT void
pixman_image_set_accessors (pixman_image_t *image,
pixman_read_memory_func_t read_func,
pixman_write_memory_func_t write_func)
@@ -556,7 +575,7 @@ pixman_image_set_accessors (pixman_image_t *image,
image->common.write_func = write_func;
}
-uint32_t *
+PIXMAN_EXPORT uint32_t *
pixman_image_get_data (pixman_image_t *image)
{
if (image->type == BITS)
@@ -565,7 +584,7 @@ pixman_image_get_data (pixman_image_t *image)
return NULL;
}
-int
+PIXMAN_EXPORT int
pixman_image_get_width (pixman_image_t *image)
{
if (image->type == BITS)
@@ -574,7 +593,7 @@ pixman_image_get_width (pixman_image_t *image)
return 0;
}
-int
+PIXMAN_EXPORT int
pixman_image_get_height (pixman_image_t *image)
{
if (image->type == BITS)
@@ -583,7 +602,7 @@ pixman_image_get_height (pixman_image_t *image)
return 0;
}
-int
+PIXMAN_EXPORT int
pixman_image_get_stride (pixman_image_t *image)
{
if (image->type == BITS)
@@ -592,7 +611,7 @@ pixman_image_get_stride (pixman_image_t *image)
return 0;
}
-int
+PIXMAN_EXPORT int
pixman_image_get_depth (pixman_image_t *image)
{
if (image->type == BITS)
@@ -601,7 +620,7 @@ pixman_image_get_depth (pixman_image_t *image)
return 0;
}
-pixman_bool_t
+static pixman_bool_t
color_to_pixel (pixman_color_t *color,
uint32_t *pixel,
pixman_format_code_t format)
@@ -642,7 +661,7 @@ color_to_pixel (pixman_color_t *color,
return TRUE;
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_image_fill_rectangles (pixman_op_t op,
pixman_image_t *dest,
pixman_color_t *color,
@@ -679,23 +698,23 @@ pixman_image_fill_rectangles (pixman_op_t op,
{
for (i = 0; i < n_rects; ++i)
{
- pixman_region16_t fill_region;
+ pixman_region32_t fill_region;
int n_boxes, j;
- pixman_box16_t *boxes;
+ pixman_box32_t *boxes;
- pixman_region_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
- pixman_region_intersect (&fill_region, &fill_region, &dest->common.clip_region);
+ pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
+ pixman_region32_intersect (&fill_region, &fill_region, &dest->common.clip_region);
- boxes = pixman_region_rectangles (&fill_region, &n_boxes);
+ boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
for (j = 0; j < n_boxes; ++j)
{
- const pixman_box16_t *box = &(boxes[j]);
+ const pixman_box32_t *box = &(boxes[j]);
pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
pixel);
}
- pixman_region_fini (&fill_region);
+ pixman_region32_fini (&fill_region);
}
return TRUE;
}
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index e49a864..7c88a65 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1187,22 +1187,22 @@ pixman_walk_composite_region (pixman_op_t op,
CompositeFunc compositeRect)
{
int n;
- const pixman_box16_t *pbox;
+ const pixman_box32_t *pbox;
int w, h, w_this, h_this;
int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
- pixman_region16_t reg;
- pixman_region16_t *region;
+ pixman_region32_t reg;
+ pixman_region32_t *region;
- pixman_region_init (&reg);
- if (!pixman_compute_composite_region (&reg, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
+ pixman_region32_init (&reg);
+ if (!pixman_compute_composite_region32 (&reg, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
{
return;
}
region = &reg;
- pbox = pixman_region_rectangles (region, &n);
+ pbox = pixman_region32_rectangles (region, &n);
while (n--)
{
h = pbox->y2 - pbox->y1;
@@ -1258,7 +1258,7 @@ pixman_walk_composite_region (pixman_op_t op,
}
pbox++;
}
- pixman_region_fini (&reg);
+ pixman_region32_fini (&reg);
}
static void
@@ -1725,7 +1725,7 @@ pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *p
__attribute__((__force_align_arg_pointer__))
#endif
-void
+PIXMAN_EXPORT void
pixman_image_composite (pixman_op_t op,
pixman_image_t * pSrc,
pixman_image_t * pMask,
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 4a6e045..0ea0cb3 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -262,9 +262,9 @@ struct image_common
{
image_type_t type;
int32_t ref_count;
- pixman_region16_t full_region;
- pixman_region16_t clip_region;
- pixman_region16_t *src_clip;
+ pixman_region32_t full_region;
+ pixman_region32_t clip_region;
+ pixman_region32_t *src_clip;
pixman_bool_t has_client_clip;
pixman_transform_t *transform;
pixman_repeat_t repeat;
@@ -686,6 +686,32 @@ pixman_image_is_opaque(pixman_image_t *image);
pixman_bool_t
pixman_image_can_get_solid (pixman_image_t *image);
+pixman_bool_t
+pixman_compute_composite_region32 (pixman_region32_t * pRegion,
+ pixman_image_t * pSrc,
+ pixman_image_t * pMask,
+ pixman_image_t * pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height);
+
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
+#else
+#define PIXMAN_EXPORT
+#endif
+
+/* Region Helpers */
+pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+ pixman_region16_t *src);
+pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
+ pixman_region32_t *src);
#ifdef PIXMAN_TIMING
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 496ce77..6676b00 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -45,29 +45,19 @@ SOFTWARE.
******************************************************************/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <stdio.h>
-#include "pixman-private.h"
-
-typedef struct pixman_region16_point {
- int x, y;
-} pixman_region16_point_t;
-
#define PIXREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
/* not a region */
#define PIXREGION_NAR(reg) ((reg)->data == pixman_brokendata)
#define PIXREGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
#define PIXREGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
-#define PIXREGION_RECTS(reg) ((reg)->data ? (pixman_box16_t *)((reg)->data + 1) \
+#define PIXREGION_RECTS(reg) ((reg)->data ? (box_type_t *)((reg)->data + 1) \
: &(reg)->extents)
-#define PIXREGION_BOXPTR(reg) ((pixman_box16_t *)((reg)->data + 1))
+#define PIXREGION_BOXPTR(reg) ((box_type_t *)((reg)->data + 1))
#define PIXREGION_BOX(reg,i) (&PIXREGION_BOXPTR(reg)[i])
#define PIXREGION_TOP(reg) PIXREGION_BOX(reg, (reg)->data->numRects)
#define PIXREGION_END(reg) PIXREGION_BOX(reg, (reg)->data->numRects - 1)
@@ -82,20 +72,20 @@ typedef struct pixman_region16_point {
#define assert(expr)
#endif
-#define good(reg) assert(pixman_region_selfcheck(reg))
+#define good(reg) assert(PREFIX(_selfcheck) (reg))
#undef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#undef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
-static const pixman_box16_t _pixman_region_emptyBox = {0, 0, 0, 0};
-static const pixman_region16_data_t _pixman_region_emptyData = {0, 0};
-static const pixman_region16_data_t _pixman_brokendata = {0, 0};
+static const box_type_t PREFIX(_emptyBox_) = {0, 0, 0, 0};
+static const region_data_type_t PREFIX(_emptyData_) = {0, 0};
+static const region_data_type_t PREFIX(_brokendata_) = {0, 0};
-static pixman_box16_t *pixman_region_emptyBox = (pixman_box16_t *)&_pixman_region_emptyBox;
-static pixman_region16_data_t *pixman_region_emptyData = (pixman_region16_data_t *)&_pixman_region_emptyData;
-static pixman_region16_data_t *pixman_brokendata = (pixman_region16_data_t *)&_pixman_brokendata;
+static box_type_t *pixman_region_emptyBox = (box_type_t *)&PREFIX(_emptyBox_);
+static region_data_type_t *pixman_region_emptyData = (region_data_type_t *)&PREFIX(_emptyData_);
+static region_data_type_t *pixman_brokendata = (region_data_type_t *)&PREFIX(_brokendata_);
/* This function exists only to make it possible to preserve the X ABI - it should
* go away at first opportunity.
@@ -105,10 +95,10 @@ static pixman_region16_data_t *pixman_brokendata = (pixman_region16_data_t *)&_p
* the addresses of those structs which makes the existing code continue to
* work.
*/
-void
-pixman_region_set_static_pointers (pixman_box16_t *empty_box,
- pixman_region16_data_t *empty_data,
- pixman_region16_data_t *broken_data)
+PIXMAN_EXPORT void
+PREFIX(_set_static_pointers) (box_type_t *empty_box,
+ region_data_type_t *empty_data,
+ region_data_type_t *broken_data)
{
pixman_region_emptyBox = empty_box;
pixman_region_emptyData = empty_data;
@@ -116,7 +106,7 @@ pixman_region_set_static_pointers (pixman_box16_t *empty_box,
}
static pixman_bool_t
-pixman_break (pixman_region16_t *pReg);
+pixman_break (region_type_t *pReg);
/*
* The functions in this file implement the Region abstraction used extensively
@@ -190,14 +180,14 @@ pixman_break (pixman_region16_t *pReg);
static size_t
PIXREGION_SZOF(size_t n)
{
- size_t size = n * sizeof(pixman_box16_t);
- if (n > UINT32_MAX / sizeof(pixman_box16_t))
+ size_t size = n * sizeof(box_type_t);
+ if (n > UINT32_MAX / sizeof(box_type_t))
return 0;
- if (sizeof(pixman_region16_data_t) > UINT32_MAX - size)
+ if (sizeof(region_data_type_t) > UINT32_MAX - size)
return 0;
- return size + sizeof(pixman_region16_data_t);
+ return size + sizeof(region_data_type_t);
}
static void *
@@ -245,12 +235,12 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
#define DOWNSIZE(reg,numRects) \
if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
{ \
- pixman_region16_data_t * NewData; \
+ region_data_type_t * NewData; \
size_t data_size = PIXREGION_SZOF(numRects); \
if (!data_size) \
NewData = NULL; \
else \
- NewData = (pixman_region16_data_t *)realloc((reg)->data, data_size); \
+ NewData = (region_data_type_t *)realloc((reg)->data, data_size); \
if (NewData) \
{ \
NewData->size = (numRects); \
@@ -259,13 +249,13 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
}
pixman_bool_t
-pixman_region_equal(reg1, reg2)
- pixman_region16_t * reg1;
- pixman_region16_t * reg2;
+PREFIX(_equal) (reg1, reg2)
+ region_type_t * reg1;
+ region_type_t * reg2;
{
int i;
- pixman_box16_t *rects1;
- pixman_box16_t *rects2;
+ box_type_t *rects1;
+ box_type_t *rects2;
if (reg1->extents.x1 != reg2->extents.x1) return FALSE;
if (reg1->extents.x2 != reg2->extents.x2) return FALSE;
@@ -285,12 +275,12 @@ pixman_region_equal(reg1, reg2)
}
int
-pixman_region16_print(rgn)
- pixman_region16_t * rgn;
+PREFIX(_print) (rgn)
+ region_type_t * rgn;
{
int num, size;
int i;
- pixman_box16_t * rects;
+ box_type_t * rects;
num = PIXREGION_NUM_RECTS(rgn);
size = PIXREGION_SIZE(rgn);
@@ -306,16 +296,16 @@ pixman_region16_print(rgn)
}
-void
-pixman_region_init (pixman_region16_t *region)
+PIXMAN_EXPORT void
+PREFIX(_init) (region_type_t *region)
{
region->extents = *pixman_region_emptyBox;
region->data = pixman_region_emptyData;
}
-void
-pixman_region_init_rect (pixman_region16_t *region,
- int x, int y, unsigned int width, unsigned int height)
+PIXMAN_EXPORT void
+PREFIX(_init_rect) (region_type_t *region,
+ int x, int y, unsigned int width, unsigned int height)
{
region->extents.x1 = x;
region->extents.y1 = y;
@@ -324,35 +314,29 @@ pixman_region_init_rect (pixman_region16_t *region,
region->data = NULL;
}
-void
-pixman_region_init_with_extents (pixman_region16_t *region, pixman_box16_t *extents)
+PIXMAN_EXPORT void
+PREFIX(_init_with_extents) (region_type_t *region, box_type_t *extents)
{
region->extents = *extents;
region->data = NULL;
}
-void
-pixman_region_fini (pixman_region16_t *region)
+PIXMAN_EXPORT void
+PREFIX(_fini) (region_type_t *region)
{
good (region);
freeData (region);
}
-int
-pixman_region_n_rects (pixman_region16_t *region)
+PIXMAN_EXPORT int
+PREFIX(_n_rects) (region_type_t *region)
{
return PIXREGION_NUM_RECTS (region);
}
-pixman_box16_t *
-pixman_region_rects (pixman_region16_t *region)
-{
- return PIXREGION_RECTS (region);
-}
-
-pixman_box16_t *
-pixman_region_rectangles (pixman_region16_t *region,
- int *n_rects)
+PIXMAN_EXPORT box_type_t *
+PREFIX(_rectangles) (region_type_t *region,
+ int *n_rects)
{
if (n_rects)
*n_rects = PIXREGION_NUM_RECTS (region);
@@ -361,7 +345,7 @@ pixman_region_rectangles (pixman_region16_t *region,
}
static pixman_bool_t
-pixman_break (pixman_region16_t *region)
+pixman_break (region_type_t *region)
{
freeData (region);
region->extents = *pixman_region_emptyBox;
@@ -370,9 +354,9 @@ pixman_break (pixman_region16_t *region)
}
static pixman_bool_t
-pixman_rect_alloc (pixman_region16_t * region, int n)
+pixman_rect_alloc (region_type_t * region, int n)
{
- pixman_region16_data_t *data;
+ region_data_type_t *data;
if (!region->data)
{
@@ -404,7 +388,7 @@ pixman_rect_alloc (pixman_region16_t * region, int n)
if (!data_size)
data = NULL;
else
- data = (pixman_region16_data_t *)realloc(region->data, PIXREGION_SZOF(n));
+ data = (region_data_type_t *)realloc(region->data, PIXREGION_SZOF(n));
if (!data)
return pixman_break (region);
region->data = data;
@@ -413,8 +397,8 @@ pixman_rect_alloc (pixman_region16_t * region, int n)
return TRUE;
}
-pixman_bool_t
-pixman_region_copy (pixman_region16_t *dst, pixman_region16_t *src)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_copy) (region_type_t *dst, region_type_t *src)
{
good(dst);
good(src);
@@ -437,7 +421,7 @@ pixman_region_copy (pixman_region16_t *dst, pixman_region16_t *src)
}
dst->data->numRects = src->data->numRects;
memmove((char *)PIXREGION_BOXPTR(dst),(char *)PIXREGION_BOXPTR(src),
- dst->data->numRects * sizeof(pixman_box16_t));
+ dst->data->numRects * sizeof(box_type_t));
return TRUE;
}
@@ -465,12 +449,12 @@ pixman_region_copy (pixman_region16_t *dst, pixman_region16_t *src)
*/
static inline int
pixman_coalesce (
- pixman_region16_t * region, /* Region to coalesce */
+ region_type_t * region, /* Region to coalesce */
int prevStart, /* Index of start of previous band */
int curStart) /* Index of start of current band */
{
- pixman_box16_t * pPrevBox; /* Current box in previous band */
- pixman_box16_t * pCurBox; /* Current box in current band */
+ box_type_t * pPrevBox; /* Current box in previous band */
+ box_type_t * pCurBox; /* Current box in current band */
int numRects; /* Number rectangles in both bands */
int y2; /* Bottom of current band */
/*
@@ -548,13 +532,13 @@ pixman_coalesce (
static inline pixman_bool_t
pixman_region_appendNonO (
- pixman_region16_t * region,
- pixman_box16_t * r,
- pixman_box16_t * rEnd,
+ region_type_t * region,
+ box_type_t * r,
+ box_type_t * rEnd,
int y1,
int y2)
{
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
int newRects;
newRects = rEnd - r;
@@ -590,7 +574,7 @@ pixman_region_appendNonO (
if ((newRects = rEnd - r)) { \
RECTALLOC(newReg, newRects); \
memmove((char *)PIXREGION_TOP(newReg),(char *)r, \
- newRects * sizeof(pixman_box16_t)); \
+ newRects * sizeof(box_type_t)); \
newReg->data->numRects += newRects; \
} \
}
@@ -625,20 +609,20 @@ pixman_region_appendNonO (
*/
typedef pixman_bool_t (*OverlapProcPtr)(
- pixman_region16_t *region,
- pixman_box16_t *r1,
- pixman_box16_t *r1End,
- pixman_box16_t *r2,
- pixman_box16_t *r2End,
- short y1,
- short y2,
+ region_type_t *region,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
+ int y1,
+ int y2,
int *pOverlap);
static pixman_bool_t
pixman_op(
- pixman_region16_t *newReg, /* Place to store result */
- pixman_region16_t * reg1, /* First region in operation */
- pixman_region16_t * reg2, /* 2d region in operation */
+ region_type_t *newReg, /* Place to store result */
+ region_type_t * reg1, /* First region in operation */
+ region_type_t * reg2, /* 2d region in operation */
OverlapProcPtr overlapFunc, /* Function to call for over-
* lapping bands */
int appendNon1, /* Append non-overlapping bands */
@@ -647,21 +631,21 @@ pixman_op(
/* in region 2 ? */
int *pOverlap)
{
- pixman_box16_t * r1; /* Pointer into first region */
- pixman_box16_t * r2; /* Pointer into 2d region */
- pixman_box16_t * r1End; /* End of 1st region */
- pixman_box16_t * r2End; /* End of 2d region */
- short ybot; /* Bottom of intersection */
- short ytop; /* Top of intersection */
- pixman_region16_data_t * oldData; /* Old data for newReg */
+ box_type_t * r1; /* Pointer into first region */
+ box_type_t * r2; /* Pointer into 2d region */
+ box_type_t * r1End; /* End of 1st region */
+ box_type_t * r2End; /* End of 2d region */
+ int ybot; /* Bottom of intersection */
+ int ytop; /* Top of intersection */
+ region_data_type_t * oldData; /* Old data for newReg */
int prevBand; /* Index of start of
* previous band in newReg */
int curBand; /* Index of start of current
* band in newReg */
- pixman_box16_t * r1BandEnd; /* End of current band in r1 */
- pixman_box16_t * r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping band */
- short bot; /* Bottom of non-overlapping band*/
+ box_type_t * r1BandEnd; /* End of current band in r1 */
+ box_type_t * r2BandEnd; /* End of current band in r2 */
+ int top; /* Top of non-overlapping band */
+ int bot; /* Bottom of non-overlapping band*/
int r1y1; /* Temps for r1->y1 and r2->y1 */
int r2y1;
int newSize;
@@ -690,7 +674,7 @@ pixman_op(
assert(r1 != r1End);
assert(r2 != r2End);
- oldData = (pixman_region16_data_t *)NULL;
+ oldData = (region_data_type_t *)NULL;
if (((newReg == reg1) && (newSize > 1)) ||
((newReg == reg2) && (numRects > 1)))
{
@@ -848,7 +832,7 @@ pixman_op(
{
newReg->extents = *PIXREGION_BOXPTR(newReg);
freeData(newReg);
- newReg->data = (pixman_region16_data_t *)NULL;
+ newReg->data = (region_data_type_t *)NULL;
}
else
{
@@ -874,9 +858,9 @@ pixman_op(
*-----------------------------------------------------------------------
*/
static void
-pixman_set_extents (pixman_region16_t *region)
+pixman_set_extents (region_type_t *region)
{
- pixman_box16_t *box, *boxEnd;
+ box_type_t *box, *boxEnd;
if (!region->data)
return;
@@ -932,18 +916,18 @@ pixman_set_extents (pixman_region16_t *region)
*/
/*ARGSUSED*/
static pixman_bool_t
-pixman_region_intersectO (pixman_region16_t *region,
- pixman_box16_t *r1,
- pixman_box16_t *r1End,
- pixman_box16_t *r2,
- pixman_box16_t *r2End,
- short y1,
- short y2,
+pixman_region_intersectO (region_type_t *region,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
+ int y1,
+ int y2,
int *pOverlap)
{
int x1;
int x2;
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
pNextRect = PIXREGION_TOP(region);
@@ -977,10 +961,10 @@ pixman_region_intersectO (pixman_region16_t *region,
return TRUE;
}
-pixman_bool_t
-pixman_region_intersect (pixman_region16_t * newReg,
- pixman_region16_t * reg1,
- pixman_region16_t * reg2)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_intersect) (region_type_t * newReg,
+ region_type_t * reg1,
+ region_type_t * reg2)
{
good(reg1);
good(reg2);
@@ -1009,19 +993,19 @@ pixman_region_intersect (pixman_region16_t * newReg,
newReg->extents.x2 = MIN(reg1->extents.x2, reg2->extents.x2);
newReg->extents.y2 = MIN(reg1->extents.y2, reg2->extents.y2);
freeData(newReg);
- newReg->data = (pixman_region16_data_t *)NULL;
+ newReg->data = (region_data_type_t *)NULL;
}
else if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
{
- return pixman_region_copy(newReg, reg1);
+ return PREFIX(_copy) (newReg, reg1);
}
else if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
{
- return pixman_region_copy(newReg, reg2);
+ return PREFIX(_copy) (newReg, reg2);
}
else if (reg1 == reg2)
{
- return pixman_region_copy(newReg, reg1);
+ return PREFIX(_copy) (newReg, reg1);
}
else
{
@@ -1073,16 +1057,16 @@ pixman_region_intersect (pixman_region16_t * newReg,
*/
static pixman_bool_t
pixman_region_unionO (
- pixman_region16_t *region,
- pixman_box16_t *r1,
- pixman_box16_t *r1End,
- pixman_box16_t *r2,
- pixman_box16_t *r2End,
- short y1,
- short y2,
+ region_type_t *region,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
+ int y1,
+ int y2,
int *pOverlap)
{
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
int x1; /* left and right side of current union */
int x2;
@@ -1134,29 +1118,29 @@ pixman_region_unionO (
/* Convenience function for performing union of region with a
* single rectangle
*/
-pixman_bool_t
-pixman_region_union_rect (pixman_region16_t *dest,
- pixman_region16_t *source,
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_union_rect) (region_type_t *dest,
+ region_type_t *source,
int x, int y,
unsigned int width, unsigned int height)
{
- pixman_region16_t region;
+ region_type_t region;
if (!width || !height)
- return pixman_region_copy (dest, source);
+ return PREFIX(_copy) (dest, source);
region.data = NULL;
region.extents.x1 = x;
region.extents.y1 = y;
region.extents.x2 = x + width;
region.extents.y2 = y + height;
- return pixman_region_union (dest, source, &region);
+ return PREFIX(_union) (dest, source, &region);
}
-pixman_bool_t
-pixman_region_union (pixman_region16_t *newReg,
- pixman_region16_t *reg1,
- pixman_region16_t *reg2)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_union) (region_type_t *newReg,
+ region_type_t *reg1,
+ region_type_t *reg2)
{
int overlap; /* result ignored */
@@ -1173,7 +1157,7 @@ pixman_region_union (pixman_region16_t *newReg,
*/
if (reg1 == reg2)
{
- return pixman_region_copy(newReg, reg1);
+ return PREFIX(_copy) (newReg, reg1);
}
/*
@@ -1184,7 +1168,7 @@ pixman_region_union (pixman_region16_t *newReg,
if (PIXREGION_NAR(reg1))
return pixman_break (newReg);
if (newReg != reg2)
- return pixman_region_copy(newReg, reg2);
+ return PREFIX(_copy) (newReg, reg2);
return TRUE;
}
@@ -1196,7 +1180,7 @@ pixman_region_union (pixman_region16_t *newReg,
if (PIXREGION_NAR(reg2))
return pixman_break (newReg);
if (newReg != reg1)
- return pixman_region_copy(newReg, reg1);
+ return PREFIX(_copy) (newReg, reg1);
return TRUE;
}
@@ -1206,7 +1190,7 @@ pixman_region_union (pixman_region16_t *newReg,
if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
{
if (newReg != reg1)
- return pixman_region_copy(newReg, reg1);
+ return PREFIX(_copy) (newReg, reg1);
return TRUE;
}
@@ -1216,7 +1200,7 @@ pixman_region_union (pixman_region16_t *newReg,
if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
{
if (newReg != reg2)
- return pixman_region_copy(newReg, reg2);
+ return PREFIX(_copy) (newReg, reg2);
return TRUE;
}
@@ -1253,12 +1237,12 @@ pixman_region_union (pixman_region16_t *newReg,
* dstrgn is modified if rgn has rectangles.
*
*/
-pixman_bool_t
-pixman_region_append (pixman_region16_t * dstrgn,
- pixman_region16_t * rgn)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_append) (region_type_t * dstrgn,
+ region_type_t * rgn)
{
int numRects, dnumRects, size;
- pixman_box16_t *new, *old;
+ box_type_t *new, *old;
int prepend;
if (PIXREGION_NAR(rgn))
@@ -1267,7 +1251,7 @@ pixman_region_append (pixman_region16_t * dstrgn,
if (!rgn->data && (dstrgn->data == pixman_region_emptyData))
{
dstrgn->extents = rgn->extents;
- dstrgn->data = (pixman_region16_data_t *)NULL;
+ dstrgn->data = (region_data_type_t *)NULL;
return TRUE;
}
@@ -1285,7 +1269,7 @@ pixman_region_append (pixman_region16_t * dstrgn,
dstrgn->extents = rgn->extents;
else if (dstrgn->extents.x2 > dstrgn->extents.x1)
{
- pixman_box16_t *first, *last;
+ box_type_t *first, *last;
first = old;
last = PIXREGION_BOXPTR(dstrgn) + (dnumRects - 1);
@@ -1325,7 +1309,7 @@ pixman_region_append (pixman_region16_t * dstrgn,
*new = *PIXREGION_BOXPTR(dstrgn);
else
memmove((char *)new,(char *)PIXREGION_BOXPTR(dstrgn),
- dnumRects * sizeof(pixman_box16_t));
+ dnumRects * sizeof(box_type_t));
new = PIXREGION_BOXPTR(dstrgn);
}
else
@@ -1333,14 +1317,14 @@ pixman_region_append (pixman_region16_t * dstrgn,
if (numRects == 1)
*new = *old;
else
- memmove((char *)new, (char *)old, numRects * sizeof(pixman_box16_t));
+ memmove((char *)new, (char *)old, numRects * sizeof(box_type_t));
dstrgn->data->numRects += numRects;
return TRUE;
}
#define ExchangeRects(a, b) \
{ \
- pixman_box16_t t; \
+ box_type_t t; \
t = rects[a]; \
rects[a] = rects[b]; \
rects[b] = t; \
@@ -1348,13 +1332,13 @@ pixman_region_append (pixman_region16_t * dstrgn,
static void
QuickSortRects(
- pixman_box16_t rects[],
+ box_type_t rects[],
int numRects)
{
int y1;
int x1;
int i, j;
- pixman_box16_t *r;
+ box_type_t *r;
/* Always called with numRects > 1 */
@@ -1438,13 +1422,13 @@ QuickSortRects(
*-----------------------------------------------------------------------
*/
-pixman_bool_t
-pixman_region_validate(pixman_region16_t * badreg,
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_validate) (region_type_t * badreg,
int *pOverlap)
{
/* Descriptor for regions under construction in Step 2. */
typedef struct {
- pixman_region16_t reg;
+ region_type_t reg;
int prevBand;
int curBand;
} RegionInfo;
@@ -1456,10 +1440,10 @@ pixman_region_validate(pixman_region16_t * badreg,
int i; /* Index into rects */
int j; /* Index into ri */
RegionInfo *rit; /* &ri[j] */
- pixman_region16_t * reg; /* ri[j].reg */
- pixman_box16_t * box; /* Current box in rects */
- pixman_box16_t * riBox; /* Last box in ri[j].reg */
- pixman_region16_t * hreg; /* ri[j_half].reg */
+ region_type_t * reg; /* ri[j].reg */
+ box_type_t * box; /* Current box in rects */
+ box_type_t * riBox; /* Last box in ri[j].reg */
+ region_type_t * hreg; /* ri[j_half].reg */
pixman_bool_t ret = TRUE;
*pOverlap = FALSE;
@@ -1481,7 +1465,7 @@ pixman_region_validate(pixman_region16_t * badreg,
if ((numRects) == 1)
{
freeData(badreg);
- badreg->data = (pixman_region16_data_t *) NULL;
+ badreg->data = (region_data_type_t *) NULL;
}
else
{
@@ -1580,7 +1564,7 @@ pixman_region_validate(pixman_region16_t * badreg,
rit->prevBand = 0;
rit->curBand = 0;
rit->reg.extents = *box;
- rit->reg.data = (pixman_region16_data_t *)NULL;
+ rit->reg.data = (region_data_type_t *)NULL;
if (!pixman_rect_alloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
goto bail;
NextRect: ;
@@ -1599,7 +1583,7 @@ NextRect: ;
if (reg->data->numRects == 1) /* keep unions happy below */
{
freeData(reg);
- reg->data = (pixman_region16_data_t *)NULL;
+ reg->data = (region_data_type_t *)NULL;
}
}
@@ -1660,16 +1644,16 @@ bail:
/*ARGSUSED*/
static pixman_bool_t
pixman_region_subtractO (
- pixman_region16_t * region,
- pixman_box16_t * r1,
- pixman_box16_t * r1End,
- pixman_box16_t * r2,
- pixman_box16_t * r2End,
- short y1,
- short y2,
+ region_type_t * region,
+ box_type_t * r1,
+ box_type_t * r1End,
+ box_type_t * r2,
+ box_type_t * r2End,
+ int y1,
+ int y2,
int *pOverlap)
{
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
int x1;
x1 = r1->x1;
@@ -1781,10 +1765,10 @@ pixman_region_subtractO (
*
*-----------------------------------------------------------------------
*/
-pixman_bool_t
-pixman_region_subtract(pixman_region16_t * regD,
- pixman_region16_t * regM,
- pixman_region16_t * regS)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_subtract) (region_type_t * regD,
+ region_type_t * regM,
+ region_type_t * regS)
{
int overlap; /* result ignored */
@@ -1797,7 +1781,7 @@ pixman_region_subtract(pixman_region16_t * regD,
{
if (PIXREGION_NAR (regS))
return pixman_break (regD);
- return pixman_region_copy(regD, regM);
+ return PREFIX(_copy) (regD, regM);
}
else if (regM == regS)
{
@@ -1846,11 +1830,11 @@ pixman_region_subtract(pixman_region16_t * regD,
*-----------------------------------------------------------------------
*/
pixman_bool_t
-pixman_region_inverse(pixman_region16_t * newReg, /* Destination region */
- pixman_region16_t * reg1, /* Region to invert */
- pixman_box16_t * invRect) /* Bounding box for inversion */
+PIXMAN_EXPORT PREFIX(_inverse) (region_type_t * newReg, /* Destination region */
+ region_type_t * reg1, /* Region to invert */
+ box_type_t * invRect) /* Bounding box for inversion */
{
- pixman_region16_t invReg; /* Quick and dirty region made from the
+ region_type_t invReg; /* Quick and dirty region made from the
* bounding box */
int overlap; /* result ignored */
@@ -1863,7 +1847,7 @@ pixman_region_inverse(pixman_region16_t * newReg, /* Destination region
return pixman_break (newReg);
newReg->extents = *invRect;
freeData(newReg);
- newReg->data = (pixman_region16_data_t *)NULL;
+ newReg->data = (region_data_type_t *)NULL;
return TRUE;
}
@@ -1871,7 +1855,7 @@ pixman_region_inverse(pixman_region16_t * newReg, /* Destination region
do yucky substraction for overlaps, and
just throw away rectangles in region 2 that aren't in region 1 */
invReg.extents = *invRect;
- invReg.data = (pixman_region16_data_t *)NULL;
+ invReg.data = (region_data_type_t *)NULL;
if (!pixman_op(newReg, &invReg, reg1, pixman_region_subtractO, TRUE, FALSE, &overlap))
return FALSE;
@@ -1905,13 +1889,13 @@ pixman_region_inverse(pixman_region16_t * newReg, /* Destination region
*/
pixman_region_overlap_t
-pixman_region_contains_rectangle(pixman_region16_t * region,
- pixman_box16_t * prect)
+PIXMAN_EXPORT PREFIX(_contains_rectangle) (region_type_t * region,
+ box_type_t * prect)
{
int x;
int y;
- pixman_box16_t * pbox;
- pixman_box16_t * pboxEnd;
+ box_type_t * pbox;
+ box_type_t * pboxEnd;
int partIn, partOut;
int numRects;
@@ -2005,16 +1989,16 @@ pixman_region_contains_rectangle(pixman_region16_t * region,
}
}
-/* pixman_region_translate (region, x, y)
+/* PREFIX(_translate) (region, x, y)
translates in place
*/
-void
-pixman_region_translate (pixman_region16_t * region, int x, int y)
+PIXMAN_EXPORT void
+PREFIX(_translate) (region_type_t * region, int x, int y)
{
int x1, x2, y1, y2;
int nbox;
- pixman_box16_t * pbox;
+ box_type_t * pbox;
good(region);
region->extents.x1 = x1 = region->extents.x1 + x;
@@ -2053,7 +2037,7 @@ pixman_region_translate (pixman_region16_t * region, int x, int y)
region->extents.y2 = SHRT_MAX;
if (region->data && (nbox = region->data->numRects))
{
- pixman_box16_t * pboxout;
+ box_type_t * pboxout;
for (pboxout = pbox = PIXREGION_BOXPTR(region); nbox--; pbox++)
{
@@ -2083,7 +2067,7 @@ pixman_region_translate (pixman_region16_t * region, int x, int y)
{
region->extents = *PIXREGION_BOXPTR(region);
freeData(region);
- region->data = (pixman_region16_data_t *)NULL;
+ region->data = (region_data_type_t *)NULL;
}
else
pixman_set_extents(region);
@@ -2091,53 +2075,24 @@ pixman_region_translate (pixman_region16_t * region, int x, int y)
}
}
-/* XXX: Do we need this?
-static pixman_bool_t
-pixman_region16_data_copy(pixman_region16_t * dst, pixman_region16_t * src)
-{
- good(dst);
- good(src);
- if (dst->data)
- return TRUE;
- if (dst == src)
- return TRUE;
- if (!src->data || !src->data->size)
- {
- freeData(dst);
- dst->data = (pixman_region16_data_t *)NULL;
- return TRUE;
- }
- if (!dst->data || (dst->data->size < src->data->numRects))
- {
- freeData(dst);
- dst->data = allocData(src->data->numRects);
- if (!dst->data)
- return pixman_break (dst);
- }
- dst->data->size = src->data->size;
- dst->data->numRects = src->data->numRects;
- return TRUE;
-}
-*/
-
-void
-pixman_region_reset(pixman_region16_t *region, pixman_box16_t *box)
+PIXMAN_EXPORT void
+PREFIX(_reset) (region_type_t *region, box_type_t *box)
{
good(region);
assert(box->x1<=box->x2);
assert(box->y1<=box->y2);
region->extents = *box;
freeData(region);
- region->data = (pixman_region16_data_t *)NULL;
+ region->data = (region_data_type_t *)NULL;
}
/* box is "return" value */
-int
-pixman_region_contains_point(pixman_region16_t * region,
+PIXMAN_EXPORT int
+PREFIX(_contains_point) (region_type_t * region,
int x, int y,
- pixman_box16_t * box)
+ box_type_t * box)
{
- pixman_box16_t *pbox, *pboxEnd;
+ box_type_t *pbox, *pboxEnd;
int numRects;
good(region);
@@ -2165,24 +2120,15 @@ pixman_region_contains_point(pixman_region16_t * region,
return(FALSE);
}
-int
-pixman_region_not_empty(pixman_region16_t * region)
+PIXMAN_EXPORT int
+PREFIX(_not_empty) (region_type_t * region)
{
good(region);
return(!PIXREGION_NIL(region));
}
-/* XXX: Do we need this?
-static int
-pixman_region16_broken(pixman_region16_t * region)
-{
- good(region);
- return (PIXREGION_NAR(region));
-}
-*/
-
-void
-pixman_region_empty(pixman_region16_t * region)
+PIXMAN_EXPORT void
+PREFIX(_empty) (region_type_t * region)
{
good(region);
freeData(region);
@@ -2191,124 +2137,13 @@ pixman_region_empty(pixman_region16_t * region)
region->data = pixman_region_emptyData;
}
-pixman_box16_t *
-pixman_region_extents(pixman_region16_t * region)
+PIXMAN_EXPORT box_type_t *
+PREFIX(_extents) (region_type_t * region)
{
good(region);
return(&region->extents);
}
-#define ExchangeSpans(a, b) \
-{ \
- pixman_region16_point_t tpt; \
- int tw; \
- \
- tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \
- tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \
-}
-
-/* ||| I should apply the merge sort code to rectangle sorting above, and see
- if mapping time can be improved. But right now I've been at work 12 hours,
- so forget it.
-*/
-
-static void QuickSortSpans(
- pixman_region16_point_t spans[],
- int widths[],
- int numSpans)
-{
- int y;
- int i, j, m;
- pixman_region16_point_t *r;
-
- /* Always called with numSpans > 1 */
- /* Sorts only by y, doesn't bother to sort by x */
-
- do
- {
- if (numSpans < 9)
- {
- /* Do insertion sort */
- int yprev;
-
- yprev = spans[0].y;
- i = 1;
- do
- { /* while i != numSpans */
- y = spans[i].y;
- if (yprev > y)
- {
- /* spans[i] is out of order. Move into proper location. */
- pixman_region16_point_t tpt;
- int tw, k;
-
- for (j = 0; y >= spans[j].y; j++) {}
- tpt = spans[i];
- tw = widths[i];
- for (k = i; k != j; k--)
- {
- spans[k] = spans[k-1];
- widths[k] = widths[k-1];
- }
- spans[j] = tpt;
- widths[j] = tw;
- y = spans[i].y;
- } /* if out of order */
- yprev = y;
- i++;
- } while (i != numSpans);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- m = numSpans / 2;
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1);
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- y = spans[0].y;
-
- /* Partition array */
- i = 0;
- j = numSpans;
- do
- {
- r = &(spans[i]);
- do
- {
- r++;
- i++;
- } while (i != numSpans && r->y < y);
- r = &(spans[j]);
- do
- {
- r--;
- j--;
- } while (y < r->y);
- if (i < j)
- ExchangeSpans(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeSpans(0, j);
-
- /* Recurse */
- if (numSpans-j-1 > 1)
- QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1);
- numSpans = j;
- } while (numSpans > 1);
-}
-
-#define NextBand() \
-{ \
- clipy1 = pboxBandStart->y1; \
- clipy2 = pboxBandStart->y2; \
- pboxBandEnd = pboxBandStart + 1; \
- while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \
- pboxBandEnd++; \
- } \
- for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \
-}
-
/*
Clip a list of scanlines to a region. The caller has allocated the
space. FSorted is non-zero if the scanline origins are in ascending
@@ -2316,158 +2151,9 @@ static void QuickSortSpans(
returns the number of new, clipped scanlines.
*/
-#ifdef XXX_DO_WE_NEED_THIS
-static int
-pixman_region16_clip_spans(
- pixman_region16_t *prgnDst,
- pixman_region16_point_t *ppt,
- int *pwidth,
- int nspans,
- pixman_region16_point_t *pptNew,
- int *pwidthNew,
- int fSorted)
-{
- pixman_region16_point_t *pptLast;
- int *pwidthNewStart; /* the vengeance of Xerox! */
- int y, x1, x2;
- int numRects;
-
- good(prgnDst);
- pptLast = ppt + nspans;
- pwidthNewStart = pwidthNew;
-
- if (!prgnDst->data)
- {
- /* Do special fast code with clip boundaries in registers(?) */
- /* It doesn't pay much to make use of fSorted in this case,
- so we lump everything together. */
-
- int clipx1, clipx2, clipy1, clipy2;
-
- clipx1 = prgnDst->extents.x1;
- clipy1 = prgnDst->extents.y1;
- clipx2 = prgnDst->extents.x2;
- clipy2 = prgnDst->extents.y2;
-
- for (; ppt != pptLast; ppt++, pwidth++)
- {
- y = ppt->y;
- x1 = ppt->x;
- if (clipy1 <= y && y < clipy2)
- {
- x2 = x1 + *pwidth;
- if (x1 < clipx1) x1 = clipx1;
- if (x2 > clipx2) x2 = clipx2;
- if (x1 < x2)
- {
- /* part of span in clip rectangle */
- pptNew->x = x1;
- pptNew->y = y;
- *pwidthNew = x2 - x1;
- pptNew++;
- pwidthNew++;
- }
- }
- } /* end for */
-
- }
- else if ((numRects = prgnDst->data->numRects))
- {
- /* Have to clip against many boxes */
- pixman_box16_t *pboxBandStart, *pboxBandEnd;
- pixman_box16_t *pbox;
- pixman_box16_t *pboxLast;
- int clipy1, clipy2;
-
- /* In this case, taking advantage of sorted spans gains more than
- the sorting costs. */
- if ((! fSorted) && (nspans > 1))
- QuickSortSpans(ppt, pwidth, nspans);
-
- pboxBandStart = PIXREGION_BOXPTR(prgnDst);
- pboxLast = pboxBandStart + numRects;
-
- NextBand();
-
- for (; ppt != pptLast; )
- {
- y = ppt->y;
- if (y < clipy2)
- {
- /* span is in the current band */
- pbox = pboxBandStart;
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- do
- { /* For each box in band */
- int newx1, newx2;
-
- newx1 = x1;
- newx2 = x2;
- if (newx1 < pbox->x1) newx1 = pbox->x1;
- if (newx2 > pbox->x2) newx2 = pbox->x2;
- if (newx1 < newx2)
- {
- /* Part of span in clip rectangle */
- pptNew->x = newx1;
- pptNew->y = y;
- *pwidthNew = newx2 - newx1;
- pptNew++;
- pwidthNew++;
- }
- pbox++;
- } while (pbox != pboxBandEnd);
- ppt++;
- pwidth++;
- }
- else
- {
- /* Move to next band, adjust ppt as needed */
- pboxBandStart = pboxBandEnd;
- if (pboxBandStart == pboxLast)
- break; /* We're completely done */
- NextBand();
- }
- }
- }
- return (pwidthNew - pwidthNewStart);
-}
-
-/* find the band in a region with the most rectangles */
-static int
-pixman_region16_find_max_band(pixman_region16_t * prgn)
-{
- int nbox;
- pixman_box16_t * pbox;
- int nThisBand;
- int nMaxBand = 0;
- short yThisBand;
-
- good(prgn);
- nbox = PIXREGION_NUM_RECTS(prgn);
- pbox = PIXREGION_RECTS(prgn);
-
- while(nbox > 0)
- {
- yThisBand = pbox->y1;
- nThisBand = 0;
- while((nbox > 0) && (pbox->y1 == yThisBand))
- {
- nbox--;
- pbox++;
- nThisBand++;
- }
- if (nThisBand > nMaxBand)
- nMaxBand = nThisBand;
- }
- return (nMaxBand);
-}
-#endif /* XXX_DO_WE_NEED_THIS */
-
-
-pixman_bool_t
-pixman_region_selfcheck (reg)
- pixman_region16_t * reg;
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_selfcheck) (reg)
+ region_type_t * reg;
{
int i, numRects;
@@ -2483,8 +2169,8 @@ pixman_region_selfcheck (reg)
return (!reg->data);
else
{
- pixman_box16_t * pboxP, * pboxN;
- pixman_box16_t box;
+ box_type_t * pboxP, * pboxN;
+ box_type_t box;
pboxP = PIXREGION_RECTS(reg);
box = *pboxP;
@@ -2511,16 +2197,16 @@ pixman_region_selfcheck (reg)
}
}
-pixman_bool_t
-pixman_region_init_rects (pixman_region16_t *region,
- pixman_box16_t *boxes, int count)
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_init_rects) (region_type_t *region,
+ box_type_t *boxes, int count)
{
int overlap;
/* if it's 1, then we just want to set the extents, so call
* the existing method. */
if (count == 1) {
- pixman_region_init_rect(region,
+ PREFIX(_init_rect) (region,
boxes[0].x1,
boxes[0].y1,
boxes[0].x2 - boxes[0].x1,
@@ -2528,7 +2214,7 @@ pixman_region_init_rects (pixman_region16_t *region,
return TRUE;
}
- pixman_region_init(region);
+ PREFIX(_init) (region);
/* if it's 0, don't call pixman_rect_alloc -- 0 rectangles is
* a special case, and causing pixman_rect_alloc would cause
@@ -2542,10 +2228,10 @@ pixman_region_init_rects (pixman_region16_t *region,
return FALSE;
/* Copy in the rects */
- memcpy (PIXREGION_RECTS(region), boxes, sizeof(pixman_box16_t) * count);
+ memcpy (PIXREGION_RECTS(region), boxes, sizeof(box_type_t) * count);
region->data->numRects = count;
/* Validate */
region->extents.x1 = region->extents.x2 = 0;
- return pixman_region_validate (region, &overlap);
+ return PREFIX(_validate) (region, &overlap);
}
diff --git a/pixman/pixman-region16.c b/pixman/pixman-region16.c
new file mode 100644
index 0000000..1a0edfe
--- /dev/null
+++ b/pixman/pixman-region16.c
@@ -0,0 +1,70 @@
+/*
+ * 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"
+
+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
+
+pixman_bool_t
+pixman_region16_copy_from_region32 (pixman_region16_t *dst,
+ pixman_region32_t *src)
+{
+ int n_boxes, i;
+ pixman_box32_t *boxes32;
+ pixman_box16_t *boxes16;
+
+ boxes32 = pixman_region32_rectangles (src, &n_boxes);
+
+ boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
+
+ if (!boxes16)
+ return FALSE;
+
+ for (i = 0; i < n_boxes; ++i)
+ {
+ boxes16[i].x1 = boxes32[i].x1;
+ boxes16[i].y1 = boxes32[i].y1;
+ boxes16[i].x2 = boxes32[i].x2;
+ boxes16[i].y2 = boxes32[i].y2;
+ }
+
+ pixman_region_fini (dst);
+ return pixman_region_init_rects (dst, boxes16, n_boxes);
+}
+
+#include "pixman-region.c"
diff --git a/pixman/pixman-region32.c b/pixman/pixman-region32.c
new file mode 100644
index 0000000..4b5598d
--- /dev/null
+++ b/pixman/pixman-region32.c
@@ -0,0 +1,68 @@
+/*
+ * 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"
+
+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
+
+pixman_bool_t
+pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+ pixman_region16_t *src)
+{
+ int n_boxes, i;
+ pixman_box16_t *boxes16;
+ pixman_box32_t *boxes32;
+
+ boxes16 = pixman_region_rectangles (src, &n_boxes);
+
+ boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
+
+ if (!boxes32)
+ return FALSE;
+
+ for (i = 0; i < n_boxes; ++i)
+ {
+ boxes32[i].x1 = boxes16[i].x1;
+ boxes32[i].y1 = boxes16[i].y1;
+ boxes32[i].x2 = boxes16[i].x2;
+ boxes32[i].y2 = boxes16[i].y2;
+ }
+
+ pixman_region32_fini (dst);
+ return pixman_region32_init_rects (dst, boxes32, n_boxes);
+}
+
+#include "pixman-region.c"
diff --git a/pixman/pixman-transformed.c b/pixman/pixman-transformed.c
index 569fcae..cff1ba2 100644
--- a/pixman/pixman-transformed.c
+++ b/pixman/pixman-transformed.c
@@ -39,28 +39,28 @@
/*
* Fetch from region strategies
*/
-typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box);
+typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box);
static inline uint32_t
-fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromNoRegion(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
return fetch (pict, x, y);
}
static uint32_t
-fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromNRectangles(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
- pixman_box16_t box2;
- if (pixman_region_contains_point (pict->common.src_clip, x, y, &box2))
+ pixman_box32_t box2;
+ if (pixman_region32_contains_point (pict->common.src_clip, x, y, &box2))
return fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
else
return 0;
}
static uint32_t
-fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box16_t *box)
+fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box)
{
- pixman_box16_t box2 = *box;
+ pixman_box32_t box2 = *box;
return ((x < box2.x1) | (x >= box2.x2) | (y < box2.y1) | (y >= box2.y2)) ?
0 : fbFetchFromNoRegion(pict, x, y, buffer, fetch, box);
}
@@ -71,7 +71,7 @@ fbFetchFromOneRectangle(bits_image_t *pict, int x, int y, uint32_t *buffer, fetc
static void
fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t* box = NULL;
+ pixman_box32_t* box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
@@ -79,7 +79,7 @@ fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buff
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
@@ -117,7 +117,7 @@ fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buff
static void
fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
@@ -125,7 +125,7 @@ fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer,
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
@@ -164,7 +164,7 @@ fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer,
static void
fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int x, y, i;
@@ -172,7 +172,7 @@ fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buf
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
{
box = &(pict->common.src_clip->extents);
fetchFromRegion = fbFetchFromOneRectangle;
@@ -207,7 +207,7 @@ fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buf
static void
fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
@@ -215,7 +215,7 @@ fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buf
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
@@ -284,7 +284,7 @@ fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buf
static void
fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
@@ -292,7 +292,7 @@ fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
fetchFromRegion = fbFetchFromNoRegion;
else
fetchFromRegion = fbFetchFromNRectangles;
@@ -361,7 +361,7 @@ fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer
static void
fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t *box = NULL;
+ pixman_box32_t *box = NULL;
fetchPixelProc32 fetch;
fetchFromRegionProc fetchFromRegion;
int i;
@@ -369,7 +369,7 @@ fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *bu
/* initialize the two function pointers */
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
- if(pixman_region_n_rects (pict->common.src_clip) == 1)
+ if(pixman_region32_n_rects (pict->common.src_clip) == 1)
{
box = &(pict->common.src_clip->extents);
fetchFromRegion = fbFetchFromOneRectangle;
@@ -440,7 +440,7 @@ fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *bu
static void
fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits, pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
{
- pixman_box16_t dummy;
+ pixman_box32_t dummy;
fetchPixelProc32 fetch;
int i;
@@ -502,7 +502,7 @@ fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer,
default:
tx = x;
}
- if (pixman_region_contains_point (pict->common.src_clip, tx, ty, &dummy)) {
+ if (pixman_region32_contains_point (pict->common.src_clip, tx, ty, &dummy)) {
uint32_t c = fetch(pict, tx, ty);
srtot += Red(c) * *p;
diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index 0dca6cc..28dacaf 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -29,7 +29,7 @@
typedef uint32_t FbBits;
-void
+PIXMAN_EXPORT void
pixman_add_traps (pixman_image_t * image,
int16_t x_off,
int16_t y_off,
@@ -115,12 +115,12 @@ dump_image (pixman_image_t *image,
}
}
-void
-pixman_add_trapezoids (pixman_image_t *image,
- int16_t x_off,
- int y_off,
- int ntraps,
- const pixman_trapezoid_t *traps)
+PIXMAN_EXPORT void
+pixman_add_trapezoids (pixman_image_t *image,
+ int16_t x_off,
+ int y_off,
+ int ntraps,
+ const pixman_trapezoid_t *traps)
{
int i;
@@ -143,7 +143,7 @@ pixman_add_trapezoids (pixman_image_t *image,
#endif
}
-void
+PIXMAN_EXPORT void
pixman_rasterize_trapezoid (pixman_image_t * image,
const pixman_trapezoid_t *trap,
int x_off,
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index b100d09..ee7db25 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -30,7 +30,7 @@
#include "pixman-private.h"
#include "pixman-mmx.h"
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_transform_point_3d (pixman_transform_t *transform,
pixman_vector_t *vector)
{
@@ -62,7 +62,7 @@ pixman_transform_point_3d (pixman_transform_t *transform,
return TRUE;
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_blt (uint32_t *src_bits,
uint32_t *dst_bits,
int src_stride,
@@ -156,7 +156,7 @@ pixman_fill32 (uint32_t *bits,
}
}
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_fill (uint32_t *bits,
int stride,
int bpp,
@@ -204,7 +204,7 @@ pixman_fill (uint32_t *bits,
* grid row
*/
-pixman_fixed_t
+PIXMAN_EXPORT pixman_fixed_t
pixman_sample_ceil_y (pixman_fixed_t y, int n)
{
pixman_fixed_t f = pixman_fixed_frac(y);
@@ -225,7 +225,7 @@ pixman_sample_ceil_y (pixman_fixed_t y, int n)
* Compute the largest value no greater than y which is on a
* grid row
*/
-pixman_fixed_t
+PIXMAN_EXPORT pixman_fixed_t
pixman_sample_floor_y (pixman_fixed_t y, int n)
{
pixman_fixed_t f = pixman_fixed_frac(y);
@@ -243,7 +243,7 @@ pixman_sample_floor_y (pixman_fixed_t y, int n)
/*
* Step an edge by any amount (including negative values)
*/
-void
+PIXMAN_EXPORT void
pixman_edge_step (pixman_edge_t *e, int n)
{
pixman_fixed_48_16_t ne;
@@ -298,7 +298,7 @@ _pixman_edge_tMultiInit (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixma
* Initialize one edge structure given the line endpoints and a
* starting y value
*/
-void
+PIXMAN_EXPORT void
pixman_edge_init (pixman_edge_t *e,
int n,
pixman_fixed_t y_start,
@@ -342,7 +342,7 @@ pixman_edge_init (pixman_edge_t *e,
* Initialize one edge structure given a line, starting y value
* and a pixel offset for the line
*/
-void
+PIXMAN_EXPORT void
pixman_line_fixed_edge_init (pixman_edge_t *e,
int n,
pixman_fixed_t y,
@@ -462,7 +462,7 @@ pixman_version_string (void)
* Currently, all pixman_format_code_t values are supported
* except for the YUV formats.
**/
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_format_supported_destination (pixman_format_code_t format)
{
switch (format) {
@@ -530,7 +530,7 @@ pixman_format_supported_destination (pixman_format_code_t format)
*
* Currently, all pixman_format_code_t values are supported.
**/
-pixman_bool_t
+PIXMAN_EXPORT pixman_bool_t
pixman_format_supported_source (pixman_format_code_t format)
{
switch (format) {
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 1224d2b..8bfbb51 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -92,13 +92,6 @@ typedef unsigned __int64 uint64_t;
# include <stdint.h>
#endif
-/* GCC visibility */
-#if defined(__GNUC__) && __GNUC__ >= 4
-#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
-#else
-#define PIXMAN_EXPORT
-#endif
-
/*
* Boolean
*/
@@ -167,10 +160,6 @@ struct pixman_transform
pixman_fixed_t matrix[3][3];
};
-PIXMAN_EXPORT
-pixman_bool_t pixman_transform_point_3d (pixman_transform_t *transform,
- pixman_vector_t *vector);
-
/* Don't blame me, blame XRender */
typedef enum
{
@@ -274,112 +263,182 @@ typedef enum
PIXMAN_REGION_PART
} pixman_region_overlap_t;
-PIXMAN_EXPORT
-int pixman_version (void);
-
-PIXMAN_EXPORT
-const char* pixman_version_string (void);
-
/* This function exists only to make it possible to preserve the X ABI - it should
* go away at first opportunity.
*/
-PIXMAN_EXPORT
-void pixman_region_set_static_pointers (pixman_box16_t *empty_box,
+void pixman_region_set_static_pointers (pixman_box16_t *empty_box,
pixman_region16_data_t *empty_data,
pixman_region16_data_t *broken_data);
+
+/* creation/destruction */
+void pixman_region_init (pixman_region16_t *region);
+void pixman_region_init_rect (pixman_region16_t *region,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
+ pixman_box16_t *boxes,
+ int count);
+void pixman_region_init_with_extents (pixman_region16_t *region,
+ pixman_box16_t *extents);
+void pixman_region_fini (pixman_region16_t *region);
+
+
+/* manipulation */
+void pixman_region_translate (pixman_region16_t *region,
+ int x,
+ int y);
+pixman_bool_t pixman_region_copy (pixman_region16_t *dest,
+ pixman_region16_t *source);
+pixman_bool_t pixman_region_intersect (pixman_region16_t *newReg,
+ pixman_region16_t *reg1,
+ pixman_region16_t *reg2);
+pixman_bool_t pixman_region_union (pixman_region16_t *newReg,
+ pixman_region16_t *reg1,
+ pixman_region16_t *reg2);
+pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest,
+ pixman_region16_t *source,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+pixman_bool_t pixman_region_subtract (pixman_region16_t *regD,
+ pixman_region16_t *regM,
+ pixman_region16_t *regS);
+pixman_bool_t pixman_region_inverse (pixman_region16_t *newReg,
+ pixman_region16_t *reg1,
+ pixman_box16_t *invRect);
+pixman_bool_t pixman_region_contains_point (pixman_region16_t *region,
+ int x,
+ int y,
+ pixman_box16_t *box);
+pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t,
+ pixman_box16_t *prect);
+pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
+pixman_box16_t * pixman_region_extents (pixman_region16_t *region);
+int pixman_region_n_rects (pixman_region16_t *region);
+pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region,
+ int *n_rects);
+pixman_bool_t pixman_region_equal (pixman_region16_t *region1,
+ pixman_region16_t *region2);
+pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
+void pixman_region_reset (pixman_region16_t *region,
+ pixman_box16_t *box);
+
+/*
+ * 32 bit regions
+ */
+typedef struct pixman_region32_data pixman_region32_data_t;
+typedef struct pixman_box32 pixman_box32_t;
+typedef struct pixman_rectangle32 pixman_rectangle32_t;
+typedef struct pixman_region32 pixman_region32_t;
+
+struct pixman_region32_data {
+ long size;
+ long numRects;
+/* pixman_box32_t rects[size]; in memory but not explicitly declared */
+};
+
+struct pixman_rectangle32
+{
+ int32_t x, y;
+ uint32_t width, height;
+};
+
+struct pixman_box32
+{
+ int32_t x1, y1, x2, y2;
+};
+
+struct pixman_region32
+{
+ pixman_box32_t extents;
+ pixman_region32_data_t *data;
+};
+
/* creation/destruction */
-PIXMAN_EXPORT
-void pixman_region_init (pixman_region16_t *region);
-PIXMAN_EXPORT
-void pixman_region_init_rect (pixman_region16_t *region,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-PIXMAN_EXPORT
-void pixman_region_init_with_extents (pixman_region16_t *region,
- pixman_box16_t *extents);
-PIXMAN_EXPORT
-void pixman_region_fini (pixman_region16_t *region);
+void pixman_region32_init (pixman_region32_t *region);
+void pixman_region32_init_rect (pixman_region32_t *region,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
+ pixman_box32_t *boxes,
+ int count);
+void pixman_region32_init_with_extents (pixman_region32_t *region,
+ pixman_box32_t *extents);
+void pixman_region32_fini (pixman_region32_t *region);
+
/* manipulation */
-PIXMAN_EXPORT
-void pixman_region_translate (pixman_region16_t *region,
- int x,
- int y);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_copy (pixman_region16_t *dest,
- pixman_region16_t *source);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_intersect (pixman_region16_t *newReg,
- pixman_region16_t *reg1,
- pixman_region16_t *reg2);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_union (pixman_region16_t *newReg,
- pixman_region16_t *reg1,
- pixman_region16_t *reg2);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest,
- pixman_region16_t *source,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_subtract (pixman_region16_t *regD,
- pixman_region16_t *regM,
- pixman_region16_t *regS);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_inverse (pixman_region16_t *newReg,
- pixman_region16_t *reg1,
- pixman_box16_t *invRect);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_contains_point (pixman_region16_t *region,
- int x, int y, pixman_box16_t *box);
-PIXMAN_EXPORT
-pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t,
- pixman_box16_t *prect);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
-PIXMAN_EXPORT
-pixman_box16_t * pixman_region_extents (pixman_region16_t *region);
-PIXMAN_EXPORT
-int pixman_region_n_rects (pixman_region16_t *region);
-PIXMAN_EXPORT
-pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region,
- int *n_rects);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_equal (pixman_region16_t *region1,
- pixman_region16_t *region2);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
-PIXMAN_EXPORT
-void pixman_region_reset (pixman_region16_t *region, pixman_box16_t *box);
-PIXMAN_EXPORT
-pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
- pixman_box16_t *boxes, int count);
-
-/* Copy / Fill */
-PIXMAN_EXPORT
-pixman_bool_t pixman_blt (uint32_t *src_bits,
- uint32_t *dst_bits,
- int src_stride,
- int dst_stride,
- int src_bpp,
- int dst_bpp,
- int src_x, int src_y,
- int dst_x, int dst_y,
- int width, int height);
-PIXMAN_EXPORT
+void pixman_region32_translate (pixman_region32_t *region,
+ int x,
+ int y);
+pixman_bool_t pixman_region32_copy (pixman_region32_t *dest,
+ pixman_region32_t *source);
+pixman_bool_t pixman_region32_intersect (pixman_region32_t *newReg,
+ pixman_region32_t *reg1,
+ pixman_region32_t *reg2);
+pixman_bool_t pixman_region32_union (pixman_region32_t *newReg,
+ pixman_region32_t *reg1,
+ pixman_region32_t *reg2);
+pixman_bool_t pixman_region32_union_rect (pixman_region32_t *dest,
+ pixman_region32_t *source,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height);
+pixman_bool_t pixman_region32_subtract (pixman_region32_t *regD,
+ pixman_region32_t *regM,
+ pixman_region32_t *regS);
+pixman_bool_t pixman_region32_inverse (pixman_region32_t *newReg,
+ pixman_region32_t *reg1,
+ pixman_box32_t *invRect);
+pixman_bool_t pixman_region32_contains_point (pixman_region32_t *region,
+ int x,
+ int y,
+ pixman_box32_t *box);
+pixman_region_overlap_t pixman_region32_contains_rectangle (pixman_region32_t *region,
+ pixman_box32_t *prect);
+pixman_bool_t pixman_region32_not_empty (pixman_region32_t *region);
+pixman_box32_t * pixman_region32_extents (pixman_region32_t *region);
+int pixman_region32_n_rects (pixman_region32_t *region);
+pixman_box32_t * pixman_region32_rectangles (pixman_region32_t *region,
+ int *n_rects);
+pixman_bool_t pixman_region32_equal (pixman_region32_t *region1,
+ pixman_region32_t *region2);
+pixman_bool_t pixman_region32_selfcheck (pixman_region32_t *region);
+void pixman_region32_reset (pixman_region32_t *region,
+ pixman_box32_t *box);
+
+
+/* Copy / Fill / Misc */
+pixman_bool_t pixman_blt (uint32_t *src_bits,
+ uint32_t *dst_bits,
+ int src_stride,
+ int dst_stride,
+ int src_bpp,
+ int dst_bpp,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ int width,
+ int height);
pixman_bool_t pixman_fill (uint32_t *bits,
- int stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- uint32_t _xor);
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t _xor);
+pixman_bool_t pixman_transform_point_3d (pixman_transform_t *transform,
+ pixman_vector_t *vector);
+
/*
* Images
*/
@@ -504,33 +563,25 @@ typedef enum {
} pixman_format_code_t;
/* Querying supported format values. */
-PIXMAN_EXPORT
-pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
-
-PIXMAN_EXPORT
-pixman_bool_t pixman_format_supported_source (pixman_format_code_t format);
+pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
+pixman_bool_t pixman_format_supported_source (pixman_format_code_t format);
/* Constructors */
-PIXMAN_EXPORT
pixman_image_t *pixman_image_create_solid_fill (pixman_color_t *color);
-PIXMAN_EXPORT
pixman_image_t *pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
pixman_point_fixed_t *p2,
const pixman_gradient_stop_t *stops,
int n_stops);
-PIXMAN_EXPORT
pixman_image_t *pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
pixman_point_fixed_t *outer,
pixman_fixed_t inner_radius,
pixman_fixed_t outer_radius,
const pixman_gradient_stop_t *stops,
int n_stops);
-PIXMAN_EXPORT
pixman_image_t *pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
pixman_fixed_t angle,
const pixman_gradient_stop_t *stops,
int n_stops);
-PIXMAN_EXPORT
pixman_image_t *pixman_image_create_bits (pixman_format_code_t format,
int width,
int height,
@@ -538,92 +589,74 @@ pixman_image_t *pixman_image_create_bits (pixman_format_code_t
int rowstride_bytes);
/* Destructor */
-PIXMAN_EXPORT
pixman_image_t *pixman_image_ref (pixman_image_t *image);
-PIXMAN_EXPORT
pixman_bool_t pixman_image_unref (pixman_image_t *image);
/* Set properties */
-PIXMAN_EXPORT
pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image,
pixman_region16_t *region);
-PIXMAN_EXPORT
+pixman_bool_t pixman_image_set_clip_region32 (pixman_image_t *image,
+ pixman_region32_t *region);
void pixman_image_set_has_client_clip (pixman_image_t *image,
pixman_bool_t clien_clip);
-PIXMAN_EXPORT
pixman_bool_t pixman_image_set_transform (pixman_image_t *image,
const pixman_transform_t *transform);
-PIXMAN_EXPORT
void pixman_image_set_repeat (pixman_image_t *image,
pixman_repeat_t repeat);
-PIXMAN_EXPORT
pixman_bool_t pixman_image_set_filter (pixman_image_t *image,
pixman_filter_t filter,
const pixman_fixed_t *filter_params,
int n_filter_params);
-PIXMAN_EXPORT
void pixman_image_set_source_clipping (pixman_image_t *image,
pixman_bool_t source_clipping);
-PIXMAN_EXPORT
void pixman_image_set_alpha_map (pixman_image_t *image,
pixman_image_t *alpha_map,
int16_t x,
int16_t y);
-PIXMAN_EXPORT
void pixman_image_set_component_alpha (pixman_image_t *image,
pixman_bool_t component_alpha);
-PIXMAN_EXPORT
void pixman_image_set_accessors (pixman_image_t *image,
pixman_read_memory_func_t read_func,
pixman_write_memory_func_t write_func);
-PIXMAN_EXPORT
void pixman_image_set_indexed (pixman_image_t *image,
const pixman_indexed_t *indexed);
-PIXMAN_EXPORT
uint32_t *pixman_image_get_data (pixman_image_t *image);
-PIXMAN_EXPORT
int pixman_image_get_width (pixman_image_t *image);
-PIXMAN_EXPORT
int pixman_image_get_height (pixman_image_t *image);
-PIXMAN_EXPORT
int pixman_image_get_stride (pixman_image_t *image);
-PIXMAN_EXPORT
int pixman_image_get_depth (pixman_image_t *image);
-PIXMAN_EXPORT
pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op,
pixman_image_t *image,
pixman_color_t *color,
int n_rects,
- const pixman_rectangle16_t *rects);
+ const pixman_rectangle16_t *rects);
/* Composite */
-PIXMAN_EXPORT
-pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- int16_t xSrc,
- int16_t ySrc,
- int16_t xMask,
- int16_t yMask,
- int16_t xDst,
- int16_t yDst,
- uint16_t width,
- uint16_t height);
-PIXMAN_EXPORT
-void pixman_image_composite (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int16_t src_x,
- int16_t src_y,
- int16_t mask_x,
- int16_t mask_y,
- int16_t dest_x,
- int16_t dest_y,
- uint16_t width,
- uint16_t height);
+pixman_bool_t pixman_compute_composite_region (pixman_region16_t *pRegion,
+ pixman_image_t *pSrc,
+ pixman_image_t *pMask,
+ pixman_image_t *pDst,
+ int16_t xSrc,
+ int16_t ySrc,
+ int16_t xMask,
+ int16_t yMask,
+ int16_t xDst,
+ int16_t yDst,
+ uint16_t width,
+ uint16_t height);
+void pixman_image_composite (pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int16_t src_x,
+ int16_t src_y,
+ int16_t mask_x,
+ int16_t mask_y,
+ int16_t dest_x,
+ int16_t dest_y,
+ uint16_t width,
+ uint16_t height);
/*
* Trapezoids
@@ -676,52 +709,44 @@ struct pixman_trap
pixman_span_fix_t top, bot;
};
-PIXMAN_EXPORT
-pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y,
- int bpp);
-PIXMAN_EXPORT
-pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y,
- int bpp);
-PIXMAN_EXPORT
-void pixman_edge_step (pixman_edge_t *e,
- int n);
-PIXMAN_EXPORT
-void pixman_edge_init (pixman_edge_t *e,
- int bpp,
- pixman_fixed_t y_start,
- pixman_fixed_t x_top,
- pixman_fixed_t y_top,
- pixman_fixed_t x_bot,
- pixman_fixed_t y_bot);
-PIXMAN_EXPORT
-void pixman_line_fixed_edge_init (pixman_edge_t *e,
- int bpp,
- pixman_fixed_t y,
+pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y,
+ int bpp);
+pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y,
+ int bpp);
+void pixman_edge_step (pixman_edge_t *e,
+ int n);
+void pixman_edge_init (pixman_edge_t *e,
+ int bpp,
+ pixman_fixed_t y_start,
+ pixman_fixed_t x_top,
+ pixman_fixed_t y_top,
+ pixman_fixed_t x_bot,
+ pixman_fixed_t y_bot);
+void pixman_line_fixed_edge_init (pixman_edge_t *e,
+ int bpp,
+ pixman_fixed_t y,
const pixman_line_fixed_t *line,
- int x_off,
- int y_off);
-PIXMAN_EXPORT
-void pixman_rasterize_edges (pixman_image_t *image,
- pixman_edge_t *l,
- pixman_edge_t *r,
- pixman_fixed_t t,
- pixman_fixed_t b);
-PIXMAN_EXPORT
-void pixman_add_traps (pixman_image_t *image,
- int16_t x_off,
- int16_t y_off,
- int ntrap,
- pixman_trap_t *traps);
-PIXMAN_EXPORT
-void pixman_add_trapezoids (pixman_image_t *image,
- int16_t x_off,
- int y_off,
- int ntraps,
+ int x_off,
+ int y_off);
+void pixman_rasterize_edges (pixman_image_t *image,
+ pixman_edge_t *l,
+ pixman_edge_t *r,
+ pixman_fixed_t t,
+ pixman_fixed_t b);
+void pixman_add_traps (pixman_image_t *image,
+ int16_t x_off,
+ int16_t y_off,
+ int ntrap,
+ pixman_trap_t *traps);
+void pixman_add_trapezoids (pixman_image_t *image,
+ int16_t x_off,
+ int y_off,
+ int ntraps,
const pixman_trapezoid_t *traps);
-PIXMAN_EXPORT
-void pixman_rasterize_trapezoid (pixman_image_t *image,
+void pixman_rasterize_trapezoid (pixman_image_t *image,
const pixman_trapezoid_t *trap,
- int x_off,
- int y_off);
+ int x_off,
+ int y_off);
+
#endif /* PIXMAN_H__ */
diff --git a/test/Makefile.am b/test/Makefile.am
index d0a21c4..ced0579 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,6 +2,7 @@ if HAVE_GTK
TESTPROGRAMS = \
composite-test \
gradient-test \
+ region-test \
fetch-test
noinst_PROGRAMS = $(TESTPROGRAMS)
@@ -11,5 +12,6 @@ INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS)
composite_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS)
gradient_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS)
fetch_test_LDADD = $(top_builddir)/pixman/libpixman-1.la
+region_test_LDADD = $(top_builddir)/pixman/libpixman-1.la
endif
diff --git a/test/region-test.c b/test/region-test.c
new file mode 100644
index 0000000..e214e9b
--- /dev/null
+++ b/test/region-test.c
@@ -0,0 +1,23 @@
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "pixman.h"
+
+/* This used to go into an infinite loop before pixman-region.c
+ * was fixed to not use explict "short" variables
+ */
+int
+main ()
+{
+ pixman_region32_t r1;
+ pixman_region32_t r2;
+ pixman_region32_t r3;
+
+ pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
+
+ pixman_region32_subtract (&r1, &r2, &r3);
+
+}
+