******************************************************************/
-#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_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)
#define assert(expr)
#endif
-#define PREFIX(x) x
-
#define good(reg) assert(PREFIX(pixman_region_selfcheck) (reg))
#undef MIN
#undef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
-static const pixman_box16_t _pixman_region_emptyBox = {0, 0, 0, 0};
+static const box_type_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 pixman_box16_t *pixman_region_emptyBox = (pixman_box16_t *)&_pixman_region_emptyBox;
+static box_type_t *pixman_region_emptyBox = (box_type_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;
* work.
*/
void
-PREFIX(pixman_region_set_static_pointers) (pixman_box16_t *empty_box,
+PREFIX(pixman_region_set_static_pointers) (box_type_t *empty_box,
pixman_region16_data_t *empty_data,
pixman_region16_data_t *broken_data)
{
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)
pixman_region16_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;
{
int num, size;
int i;
- pixman_box16_t * rects;
+ box_type_t * rects;
num = PIXREGION_NUM_RECTS(rgn);
size = PIXREGION_SIZE(rgn);
}
void
-PREFIX(pixman_region_init_with_extents) (pixman_region16_t *region, pixman_box16_t *extents)
+PREFIX(pixman_region_init_with_extents) (pixman_region16_t *region, box_type_t *extents)
{
region->extents = *extents;
region->data = NULL;
return PIXREGION_NUM_RECTS (region);
}
-pixman_box16_t *
+box_type_t *
PREFIX(pixman_region_rects) (pixman_region16_t *region)
{
return PIXREGION_RECTS (region);
}
-pixman_box16_t *
+box_type_t *
PREFIX(pixman_region_rectangles) (pixman_region16_t *region,
int *n_rects)
{
}
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;
}
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 */
/*
static inline pixman_bool_t
pixman_region_appendNonO (
pixman_region16_t * region,
- pixman_box16_t * r,
- pixman_box16_t * rEnd,
+ 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;
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; \
} \
}
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,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
short y1,
short y2,
int *pOverlap);
/* 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 */
+ 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 */
short ybot; /* Bottom of intersection */
short ytop; /* Top of intersection */
pixman_region16_data_t * oldData; /* Old data for newReg */
* 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 */
+ box_type_t * r1BandEnd; /* End of current band in r1 */
+ box_type_t * r2BandEnd; /* End of current band in r2 */
short top; /* Top of non-overlapping band */
short bot; /* Bottom of non-overlapping band*/
int r1y1; /* Temps for r1->y1 and r2->y1 */
static void
pixman_set_extents (pixman_region16_t *region)
{
- pixman_box16_t *box, *boxEnd;
+ box_type_t *box, *boxEnd;
if (!region->data)
return;
/*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,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
short y1,
short y2,
int *pOverlap)
{
int x1;
int x2;
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
pNextRect = PIXREGION_TOP(region);
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,
+ box_type_t *r1,
+ box_type_t *r1End,
+ box_type_t *r2,
+ box_type_t *r2End,
short y1,
short y2,
int *pOverlap)
{
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
int x1; /* left and right side of current union */
int x2;
pixman_region16_t * rgn)
{
int numRects, dnumRects, size;
- pixman_box16_t *new, *old;
+ box_type_t *new, *old;
int prepend;
if (PIXREGION_NAR(rgn))
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);
*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
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; \
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 */
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 */
+ box_type_t * box; /* Current box in rects */
+ box_type_t * riBox; /* Last box in ri[j].reg */
pixman_region16_t * hreg; /* ri[j_half].reg */
pixman_bool_t ret = TRUE;
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,
+ box_type_t * r1,
+ box_type_t * r1End,
+ box_type_t * r2,
+ box_type_t * r2End,
short y1,
short y2,
int *pOverlap)
{
- pixman_box16_t * pNextRect;
+ box_type_t * pNextRect;
int x1;
x1 = r1->x1;
pixman_bool_t
PREFIX(pixman_region_inverse) (pixman_region16_t * newReg, /* Destination region */
pixman_region16_t * reg1, /* Region to invert */
- pixman_box16_t * invRect) /* Bounding box for inversion */
+ box_type_t * invRect) /* Bounding box for inversion */
{
pixman_region16_t invReg; /* Quick and dirty region made from the
* bounding box */
pixman_region_overlap_t
PREFIX(pixman_region_contains_rectangle) (pixman_region16_t * region,
- pixman_box16_t * prect)
+ 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;
{
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;
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++)
{
*/
void
-PREFIX(pixman_region_reset) (pixman_region16_t *region, pixman_box16_t *box)
+PREFIX(pixman_region_reset) (pixman_region16_t *region, box_type_t *box)
{
good(region);
assert(box->x1<=box->x2);
int
PREFIX(pixman_region_contains_point) (pixman_region16_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);
region->data = pixman_region_emptyData;
}
-pixman_box16_t *
+box_type_t *
PREFIX(pixman_region_extents) (pixman_region16_t * region)
{
good(region);
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;
+ box_type_t *pboxBandStart, *pboxBandEnd;
+ box_type_t *pbox;
+ box_type_t *pboxLast;
int clipy1, clipy2;
/* In this case, taking advantage of sorted spans gains more than
pixman_region16_find_max_band(pixman_region16_t * prgn)
{
int nbox;
- pixman_box16_t * pbox;
+ box_type_t * pbox;
int nThisBand;
int nMaxBand = 0;
short yThisBand;
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;
pixman_bool_t
PREFIX(pixman_region_init_rects) (pixman_region16_t *region,
- pixman_box16_t *boxes, int count)
+ box_type_t *boxes, int count)
{
int overlap;
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 */