More data types; remove unused stuff
authorSøren Sandmann <sandmann@redhat.com>
Sun, 8 Jun 2008 23:15:41 +0000 (19:15 -0400)
committerSøren Sandmann <sandmann@redhat.com>
Sun, 8 Jun 2008 23:15:41 +0000 (19:15 -0400)
pixman/pixman-region.c
pixman/pixman-region16.c

index 7ae3bcf..42371ad 100644 (file)
@@ -80,12 +80,12 @@ SOFTWARE.
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 
 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 const region_data_type_t _pixman_region_emptyData = {0, 0};
+static const region_data_type_t _pixman_brokendata = {0, 0};
 
 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;
+static region_data_type_t *pixman_region_emptyData = (region_data_type_t *)&_pixman_region_emptyData;
+static region_data_type_t *pixman_brokendata = (region_data_type_t *)&_pixman_brokendata;
 
 /* This function exists only to make it possible to preserve the X ABI - it should
  * go away at first opportunity.
@@ -97,8 +97,8 @@ static pixman_region16_data_t *pixman_brokendata = (pixman_region16_data_t *)&_p
  */
 void
 PREFIX(pixman_region_set_static_pointers) (box_type_t *empty_box,
-                                  pixman_region16_data_t *empty_data,
-                                  pixman_region16_data_t *broken_data)
+                                  region_data_type_t *empty_data,
+                                  region_data_type_t *broken_data)
 {
     pixman_region_emptyBox = empty_box;
     pixman_region_emptyData = empty_data;
@@ -106,7 +106,7 @@ PREFIX(pixman_region_set_static_pointers) (box_type_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
@@ -184,10 +184,10 @@ PIXREGION_SZOF(size_t n)
     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 *
@@ -235,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);                                 \
@@ -250,8 +250,8 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
 
 pixman_bool_t
 PREFIX(pixman_region_equal) (reg1, reg2)
-    pixman_region16_t * reg1;
-    pixman_region16_t * reg2;
+    region_type_t * reg1;
+    region_type_t * reg2;
 {
     int i;
     box_type_t *rects1;
@@ -276,7 +276,7 @@ PREFIX(pixman_region_equal) (reg1, reg2)
 
 int
 PREFIX(pixman_region16_print) (rgn)
-    pixman_region16_t * rgn;
+    region_type_t * rgn;
 {
     int num, size;
     int i;
@@ -297,14 +297,14 @@ PREFIX(pixman_region16_print) (rgn)
 
 
 void
-PREFIX(pixman_region_init) (pixman_region16_t *region)
+PREFIX(pixman_region_init) (region_type_t *region)
 {
     region->extents = *pixman_region_emptyBox;
     region->data = pixman_region_emptyData;
 }
 
 void
-PREFIX(pixman_region_init_rect) (pixman_region16_t *region,
+PREFIX(pixman_region_init_rect) (region_type_t *region,
                         int x, int y, unsigned int width, unsigned int height)
 {
     region->extents.x1 = x;
@@ -315,33 +315,33 @@ PREFIX(pixman_region_init_rect) (pixman_region16_t *region,
 }
 
 void
-PREFIX(pixman_region_init_with_extents) (pixman_region16_t *region, box_type_t *extents)
+PREFIX(pixman_region_init_with_extents) (region_type_t *region, box_type_t *extents)
 {
     region->extents = *extents;
     region->data = NULL;
 }
 
 void
-PREFIX(pixman_region_fini) (pixman_region16_t *region)
+PREFIX(pixman_region_fini) (region_type_t *region)
 {
     good (region);
     freeData (region);
 }
 
 int
-PREFIX(pixman_region_n_rects) (pixman_region16_t *region)
+PREFIX(pixman_region_n_rects) (region_type_t *region)
 {
     return PIXREGION_NUM_RECTS (region);
 }
 
 box_type_t *
-PREFIX(pixman_region_rects) (pixman_region16_t *region)
+PREFIX(pixman_region_rects) (region_type_t *region)
 {
     return PIXREGION_RECTS (region);
 }
 
 box_type_t *
-PREFIX(pixman_region_rectangles) (pixman_region16_t *region,
+PREFIX(pixman_region_rectangles) (region_type_t *region,
                                  int               *n_rects)
 {
     if (n_rects)
@@ -351,7 +351,7 @@ PREFIX(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;
@@ -360,9 +360,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)
     {
@@ -394,7 +394,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;
@@ -404,7 +404,7 @@ pixman_rect_alloc (pixman_region16_t * region, int n)
 }
 
 pixman_bool_t
-PREFIX(pixman_region_copy) (pixman_region16_t *dst, pixman_region16_t *src)
+PREFIX(pixman_region_copy) (region_type_t *dst, region_type_t *src)
 {
     good(dst);
     good(src);
@@ -455,7 +455,7 @@ PREFIX(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    */
 {
@@ -538,7 +538,7 @@ pixman_coalesce (
 
 static inline pixman_bool_t
 pixman_region_appendNonO (
-    pixman_region16_t *        region,
+    region_type_t *    region,
     box_type_t *       r,
     box_type_t *               rEnd,
     int        y1,
@@ -615,7 +615,7 @@ pixman_region_appendNonO (
  */
 
 typedef pixman_bool_t (*OverlapProcPtr)(
-    pixman_region16_t   *region,
+    region_type_t       *region,
     box_type_t *r1,
     box_type_t *r1End,
     box_type_t *r2,
@@ -626,9 +626,9 @@ typedef pixman_bool_t (*OverlapProcPtr)(
 
 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  */
@@ -643,7 +643,7 @@ pixman_op(
     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           */
+    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
@@ -680,7 +680,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)))
     {
@@ -838,7 +838,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
     {
@@ -864,7 +864,7 @@ pixman_op(
  *-----------------------------------------------------------------------
  */
 static void
-pixman_set_extents (pixman_region16_t *region)
+pixman_set_extents (region_type_t *region)
 {
     box_type_t *box, *boxEnd;
 
@@ -922,7 +922,7 @@ pixman_set_extents (pixman_region16_t *region)
  */
 /*ARGSUSED*/
 static pixman_bool_t
-pixman_region_intersectO (pixman_region16_t *region,
+pixman_region_intersectO (region_type_t *region,
                          box_type_t    *r1,
                          box_type_t    *r1End,
                          box_type_t    *r2,
@@ -968,9 +968,9 @@ pixman_region_intersectO (pixman_region16_t *region,
 }
 
 pixman_bool_t
-PREFIX(pixman_region_intersect) (pixman_region16_t *   newReg,
-                        pixman_region16_t *    reg1,
-                        pixman_region16_t *    reg2)
+PREFIX(pixman_region_intersect) (region_type_t *       newReg,
+                        region_type_t *        reg1,
+                        region_type_t *        reg2)
 {
     good(reg1);
     good(reg2);
@@ -999,7 +999,7 @@ PREFIX(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))
     {
@@ -1063,7 +1063,7 @@ PREFIX(pixman_region_intersect) (pixman_region16_t *      newReg,
  */
 static pixman_bool_t
 pixman_region_unionO (
-    pixman_region16_t   *region,
+    region_type_t       *region,
     box_type_t *r1,
     box_type_t *r1End,
     box_type_t *r2,
@@ -1125,12 +1125,12 @@ pixman_region_unionO (
  * single rectangle
  */
 pixman_bool_t
-PREFIX(pixman_region_union_rect) (pixman_region16_t *dest,
-                         pixman_region16_t *source,
+PREFIX(pixman_region_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 PREFIX(pixman_region_copy) (dest, source);
@@ -1144,9 +1144,9 @@ PREFIX(pixman_region_union_rect) (pixman_region16_t *dest,
 }
 
 pixman_bool_t
-PREFIX(pixman_region_union) (pixman_region16_t *newReg,
-                    pixman_region16_t *reg1,
-                    pixman_region16_t *reg2)
+PREFIX(pixman_region_union) (region_type_t *newReg,
+                    region_type_t *reg1,
+                    region_type_t *reg2)
 {
     int overlap; /* result ignored */
 
@@ -1244,8 +1244,8 @@ PREFIX(pixman_region_union) (pixman_region16_t *newReg,
  *
  */
 pixman_bool_t
-PREFIX(pixman_region_append) (pixman_region16_t * dstrgn,
-                     pixman_region16_t * rgn)
+PREFIX(pixman_region_append) (region_type_t * dstrgn,
+                     region_type_t * rgn)
 {
     int numRects, dnumRects, size;
     box_type_t *new, *old;
@@ -1257,7 +1257,7 @@ PREFIX(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;
     }
 
@@ -1429,12 +1429,12 @@ QuickSortRects(
  */
 
 pixman_bool_t
-PREFIX(pixman_region_validate) (pixman_region16_t * badreg,
+PREFIX(pixman_region_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;
@@ -1446,10 +1446,10 @@ PREFIX(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                          */
+    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                */
-    pixman_region16_t *  hreg;       /* ri[j_half].reg                     */
+    region_type_t *  hreg;       /* ri[j_half].reg                         */
     pixman_bool_t ret = TRUE;
 
     *pOverlap = FALSE;
@@ -1471,7 +1471,7 @@ PREFIX(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
        {
@@ -1570,7 +1570,7 @@ PREFIX(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: ;
@@ -1589,7 +1589,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;
        }
     }
 
@@ -1650,7 +1650,7 @@ bail:
 /*ARGSUSED*/
 static pixman_bool_t
 pixman_region_subtractO (
-    pixman_region16_t *        region,
+    region_type_t *    region,
     box_type_t *       r1,
     box_type_t *               r1End,
     box_type_t *       r2,
@@ -1772,9 +1772,9 @@ pixman_region_subtractO (
  *-----------------------------------------------------------------------
  */
 pixman_bool_t
-PREFIX(pixman_region_subtract) (pixman_region16_t *    regD,
-                      pixman_region16_t *      regM,
-                      pixman_region16_t *      regS)
+PREFIX(pixman_region_subtract) (region_type_t *        regD,
+                      region_type_t *  regM,
+                      region_type_t *  regS)
 {
     int overlap; /* result ignored */
 
@@ -1836,11 +1836,11 @@ PREFIX(pixman_region_subtract) (pixman_region16_t *     regD,
  *-----------------------------------------------------------------------
  */
 pixman_bool_t
-PREFIX(pixman_region_inverse) (pixman_region16_t *       newReg,       /* Destination region */
-                     pixman_region16_t *         reg1,         /* Region to invert */
+PREFIX(pixman_region_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 */
 
@@ -1853,7 +1853,7 @@ PREFIX(pixman_region_inverse) (pixman_region16_t *          newReg,       /* Destinati
            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;
     }
 
@@ -1861,7 +1861,7 @@ PREFIX(pixman_region_inverse) (pixman_region16_t *          newReg,       /* Destinati
        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;
 
@@ -1895,7 +1895,7 @@ PREFIX(pixman_region_inverse) (pixman_region16_t *          newReg,       /* Destinati
  */
 
 pixman_region_overlap_t
-PREFIX(pixman_region_contains_rectangle) (pixman_region16_t *  region,
+PREFIX(pixman_region_contains_rectangle) (region_type_t *  region,
                                 box_type_t *     prect)
 {
     int        x;
@@ -2000,7 +2000,7 @@ PREFIX(pixman_region_contains_rectangle) (pixman_region16_t *  region,
 */
 
 void
-PREFIX(pixman_region_translate) (pixman_region16_t * region, int x, int y)
+PREFIX(pixman_region_translate) (region_type_t * region, int x, int y)
 {
     int x1, x2, y1, y2;
     int nbox;
@@ -2073,7 +2073,7 @@ PREFIX(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);
@@ -2083,7 +2083,7 @@ PREFIX(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)
+pixman_region16_data_copy(region_type_t * dst, region_type_t * src)
 {
     good(dst);
     good(src);
@@ -2094,7 +2094,7 @@ pixman_region16_data_copy(pixman_region16_t * dst, pixman_region16_t * src)
     if (!src->data || !src->data->size)
     {
        freeData(dst);
-       dst->data = (pixman_region16_data_t *)NULL;
+       dst->data = (region_data_type_t *)NULL;
        return TRUE;
     }
     if (!dst->data || (dst->data->size < src->data->numRects))
@@ -2111,19 +2111,19 @@ pixman_region16_data_copy(pixman_region16_t * dst, pixman_region16_t * src)
 */
 
 void
-PREFIX(pixman_region_reset) (pixman_region16_t *region, box_type_t *box)
+PREFIX(pixman_region_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
-PREFIX(pixman_region_contains_point) (pixman_region16_t * region,
+PREFIX(pixman_region_contains_point) (region_type_t * region,
                             int x, int y,
                             box_type_t * box)
 {
@@ -2156,7 +2156,7 @@ PREFIX(pixman_region_contains_point) (pixman_region16_t * region,
 }
 
 int
-PREFIX(pixman_region_not_empty) (pixman_region16_t * region)
+PREFIX(pixman_region_not_empty) (region_type_t * region)
 {
     good(region);
     return(!PIXREGION_NIL(region));
@@ -2164,7 +2164,7 @@ PREFIX(pixman_region_not_empty) (pixman_region16_t * region)
 
 /* XXX: Do we need this?
 static int
-pixman_region16_broken(pixman_region16_t * region)
+pixman_region16_broken(region_type_t * region)
 {
     good(region);
     return (PIXREGION_NAR(region));
@@ -2172,7 +2172,7 @@ pixman_region16_broken(pixman_region16_t * region)
 */
 
 void
-PREFIX(pixman_region_empty) (pixman_region16_t * region)
+PREFIX(pixman_region_empty) (region_type_t * region)
 {
     good(region);
     freeData(region);
@@ -2182,7 +2182,7 @@ PREFIX(pixman_region_empty) (pixman_region16_t * region)
 }
 
 box_type_t *
-PREFIX(pixman_region_extents) (pixman_region16_t * region)
+PREFIX(pixman_region_extents) (region_type_t * region)
 {
     good(region);
     return(&region->extents);
@@ -2306,158 +2306,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,
-    point_type_t       *ppt,
-    int                        *pwidth,
-    int                        nspans,
-    point_type_t       *pptNew,
-    int                        *pwidthNew,
-    int                        fSorted)
-{
-    point_type_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 */
-       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
-          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;
-    box_type_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
 PREFIX(pixman_region_selfcheck) (reg)
-    pixman_region16_t * reg;
+    region_type_t * reg;
 {
     int i, numRects;
 
@@ -2502,7 +2353,7 @@ PREFIX(pixman_region_selfcheck) (reg)
 }
 
 pixman_bool_t
-PREFIX(pixman_region_init_rects) (pixman_region16_t *region,
+PREFIX(pixman_region_init_rects) (region_type_t *region,
                          box_type_t *boxes, int count)
 {
     int overlap;
index 3ad6b80..e18c7ac 100644 (file)
@@ -28,7 +28,9 @@
 
 #include "pixman-private.h"
 
-typedef pixman_box16_t box_type_t;
+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;