[cairo-commit] libpixman/src pixregion.c,1.5,1.6

Dave Beckett commit at pdx.freedesktop.org
Wed Dec 10 15:24:28 PST 2003


Committed by: dajobe

Update of /cvs/cairo/libpixman/src
In directory pdx:/tmp/cvs-serv13373

Modified Files:
	pixregion.c 
Log Message:
Correct over-eager renames of the form pixman_thing_tName into
pixman_thing_name.  It was inevitable really this would happen!


Index: pixregion.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/pixregion.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pixregion.c	10 Dec 2003 22:22:03 -0000	1.5
--- pixregion.c	10 Dec 2003 23:24:26 -0000	1.6
***************
*** 77,91 ****
  static pixman_region16_tData pixman_region_emptyData = {0, 0};
  
! static pixman_region16_tData  pixman_region16_tBrokenData = {0, 0};
! static pixman_region16_t   pixman_region16_tBrokenRegion = { { 0, 0, 0, 0 }, &pixman_region16_tBrokenData };
  
  static pixman_region_status_t
! pixman_region16_tBreak (pixman_region16_t *pReg);
  
  static void
! pixman_region16_tInit (pixman_region16_t *region, pixman_box16_t *rect);
  
  static void
! pixman_region16_tUninit (pixman_region16_t *region);
  
  slim_hidden_proto(pixman_region_createSimple)
--- 77,91 ----
  static pixman_region16_tData pixman_region_emptyData = {0, 0};
  
! static pixman_region16_tData  pixman_brokendata = {0, 0};
! static pixman_region16_t   pixman_brokenregion = { { 0, 0, 0, 0 }, &pixman_brokendata };
  
  static pixman_region_status_t
! pixman_break (pixman_region16_t *pReg);
  
  static void
! pixman_init (pixman_region16_t *region, pixman_box16_t *rect);
  
  static void
! pixman_uninit (pixman_region16_t *region);
  
  slim_hidden_proto(pixman_region_createSimple)
***************
*** 167,175 ****
  #define RECTALLOC_BAIL(pReg,n,bail) \
  if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
!     if (!pixman_region16_tRectAlloc(pReg, n)) { goto bail; }
  
  #define RECTALLOC(pReg,n) \
  if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
!     if (!pixman_region16_tRectAlloc(pReg, n)) { return PIXMAN_REGION_STATUS_FAILURE; }
  
  #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2)	\
--- 167,175 ----
  #define RECTALLOC_BAIL(pReg,n,bail) \
  if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
!     if (!pixman_rect_alloc(pReg, n)) { goto bail; }
  
  #define RECTALLOC(pReg,n) \
  if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
!     if (!pixman_rect_alloc(pReg, n)) { return PIXMAN_REGION_STATUS_FAILURE; }
  
  #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2)	\
***************
*** 186,190 ****
      if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
      {									\
! 	if (!pixman_region16_tRectAlloc(pReg, 1))					\
  	    return PIXMAN_REGION_STATUS_FAILURE;						\
  	pNextRect = PIXREGION_TOP(pReg);					\
--- 186,190 ----
      if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
      {									\
! 	if (!pixman_rect_alloc(pReg, 1))					\
  	    return PIXMAN_REGION_STATUS_FAILURE;						\
  	pNextRect = PIXREGION_TOP(pReg);					\
***************
*** 325,331 ****
      region = malloc (sizeof (pixman_region16_t));
      if (region == NULL)
! 	return &pixman_region16_tBrokenRegion;
  
!     pixman_region16_tInit (region, extents);
  
      return region;
--- 325,331 ----
      region = malloc (sizeof (pixman_region16_t));
      if (region == NULL)
! 	return &pixman_brokenregion;
  
!     pixman_init (region, extents);
  
      return region;
***************
*** 339,343 ****
  
  static void
! pixman_region16_tInit(pixman_region16_t *region, pixman_box16_t *extents)
  {
      if (extents)
--- 339,343 ----
  
  static void
! pixman_init(pixman_region16_t *region, pixman_box16_t *extents)
  {
      if (extents)
***************
*** 354,358 ****
  
  static void
! pixman_region16_tUninit (pixman_region16_t *region)
  {
      good (region);
--- 354,358 ----
  
  static void
! pixman_uninit (pixman_region16_t *region)
  {
      good (region);
***************
*** 363,369 ****
  pixman_region_destroy (pixman_region16_t *region)
  {
!     pixman_region16_tUninit (region);
  
!     if (region != &pixman_region16_tBrokenRegion)
  	free (region);
  }
--- 363,369 ----
  pixman_region_destroy (pixman_region16_t *region)
  {
!     pixman_uninit (region);
  
!     if (region != &pixman_brokenregion)
  	free (region);
  }
***************
*** 382,395 ****
  
  static pixman_region_status_t
! pixman_region16_tBreak (pixman_region16_t *region)
  {
      freeData (region);
      region->extents = pixman_region_emptyBox;
!     region->data = &pixman_region16_tBrokenData;
      return PIXMAN_REGION_STATUS_FAILURE;
  }
  
  static pixman_region_status_t
! pixman_region16_tRectAlloc(pixman_region16_t * region, int n)
  {
      pixman_region16_tData *data;
--- 382,395 ----
  
  static pixman_region_status_t
! pixman_break (pixman_region16_t *region)
  {
      freeData (region);
      region->extents = pixman_region_emptyBox;
!     region->data = &pixman_brokendata;
      return PIXMAN_REGION_STATUS_FAILURE;
  }
  
  static pixman_region_status_t
! pixman_rect_alloc(pixman_region16_t * region, int n)
  {
      pixman_region16_tData *data;
***************
*** 400,404 ****
  	region->data = allocData(n);
  	if (!region->data)
! 	    return pixman_region16_tBreak (region);
  	region->data->numRects = 1;
  	*PIXREGION_BOXPTR(region) = region->extents;
--- 400,404 ----
  	region->data = allocData(n);
  	if (!region->data)
! 	    return pixman_break (region);
  	region->data->numRects = 1;
  	*PIXREGION_BOXPTR(region) = region->extents;
***************
*** 408,412 ****
  	region->data = allocData(n);
  	if (!region->data)
! 	    return pixman_region16_tBreak (region);
  	region->data->numRects = 0;
      }
--- 408,412 ----
  	region->data = allocData(n);
  	if (!region->data)
! 	    return pixman_break (region);
  	region->data->numRects = 0;
      }
***************
*** 422,426 ****
  	data = (pixman_region16_tData *)realloc(region->data, PIXREGION_SZOF(n));
  	if (!data)
! 	    return pixman_region16_tBreak (region);
  	region->data = data;
      }
--- 422,426 ----
  	data = (pixman_region16_tData *)realloc(region->data, PIXREGION_SZOF(n));
  	if (!data)
! 	    return pixman_break (region);
  	region->data = data;
      }
***************
*** 448,452 ****
  	dst->data = allocData(src->data->numRects);
  	if (!dst->data)
! 	    return pixman_region16_tBreak (dst);
  	dst->data->size = src->data->numRects;
      }
--- 448,452 ----
  	dst->data = allocData(src->data->numRects);
  	if (!dst->data)
! 	    return pixman_break (dst);
  	dst->data->size = src->data->numRects;
      }
***************
*** 465,472 ****
  /*-
   *-----------------------------------------------------------------------
!  * pixman_region16_tCoalesce --
   *	Attempt to merge the boxes in the current band with those in the
   *	previous one.  We are guaranteed that the current band extends to
!  *      the end of the rects array.  Used only by pixman_region16_tOp.
   *
   * Results:
--- 465,472 ----
  /*-
   *-----------------------------------------------------------------------
!  * pixman_coalesce --
   *	Attempt to merge the boxes in the current band with those in the
   *	previous one.  We are guaranteed that the current band extends to
!  *      the end of the rects array.  Used only by pixman_op.
   *
   * Results:
***************
*** 482,486 ****
   */
  INLINE static int
! pixman_region16_tCoalesce (
      pixman_region16_t *	region,	    	/* Region to coalesce		     */
      int	    	  	prevStart,  	/* Index of start of previous band   */
--- 482,486 ----
   */
  INLINE static int
! pixman_coalesce (
      pixman_region16_t *	region,	    	/* Region to coalesce		     */
      int	    	  	prevStart,  	/* Index of start of previous band   */
***************
*** 539,547 ****
  
  
! /* Quicky macro to avoid trivial reject procedure calls to pixman_region16_tCoalesce */
  
  #define Coalesce(newReg, prevBand, curBand)				\
      if (curBand - prevBand == newReg->data->numRects - curBand) {	\
! 	prevBand = pixman_region16_tCoalesce(newReg, prevBand, curBand);		\
      } else {								\
  	prevBand = curBand;						\
--- 539,547 ----
  
  
! /* Quicky macro to avoid trivial reject procedure calls to pixman_coalesce */
  
  #define Coalesce(newReg, prevBand, curBand)				\
      if (curBand - prevBand == newReg->data->numRects - curBand) {	\
! 	prevBand = pixman_coalesce(newReg, prevBand, curBand);		\
      } else {								\
  	prevBand = curBand;						\
***************
*** 616,620 ****
  /*-
   *-----------------------------------------------------------------------
!  * pixman_region16_tOp --
   *	Apply an operation to two regions. Called by pixman_region_union, pixman_region_inverse,
   *	pixman_region_subtract, pixman_region_intersect....  Both regions MUST have at least one
--- 616,620 ----
  /*-
   *-----------------------------------------------------------------------
!  * pixman_op --
   *	Apply an operation to two regions. Called by pixman_region_union, pixman_region_inverse,
   *	pixman_region_subtract, pixman_region_intersect....  Both regions MUST have at least one
***************
*** 654,658 ****
  
  static pixman_region_status_t
! pixman_region16_tOp(
      pixman_region16_t *       newReg,		    /* Place to store result	     */
      pixman_region16_t *       reg1,		    /* First region in operation     */
--- 654,658 ----
  
  static pixman_region_status_t
! pixman_op(
      pixman_region16_t *       newReg,		    /* Place to store result	     */
      pixman_region16_t *       reg1,		    /* First region in operation     */
***************
*** 690,694 ****
       */
      if (PIXREGION_NAR (reg1) || PIXREGION_NAR(reg2))
! 	return pixman_region16_tBreak (newReg);
      
      /*
--- 690,694 ----
       */
      if (PIXREGION_NAR (reg1) || PIXREGION_NAR(reg2))
! 	return pixman_break (newReg);
      
      /*
***************
*** 725,729 ****
  	newReg->data->numRects = 0;
      if (newSize > newReg->data->size)
! 	if (!pixman_region16_tRectAlloc(newReg, newSize))
  	    return PIXMAN_REGION_STATUS_FAILURE;
  
--- 725,729 ----
  	newReg->data->numRects = 0;
      if (newSize > newReg->data->size)
! 	if (!pixman_rect_alloc(newReg, newSize))
  	    return PIXMAN_REGION_STATUS_FAILURE;
  
***************
*** 746,750 ****
      /*
       * prevBand serves to mark the start of the previous band so rectangles
!      * can be coalesced into larger rectangles. qv. pixman_region16_tCoalesce, above.
       * In the beginning, there is no previous band, so prevBand == curBand
       * (curBand is set later on, of course, but the first band will always
--- 746,750 ----
      /*
       * prevBand serves to mark the start of the previous band so rectangles
!      * can be coalesced into larger rectangles. qv. pixman_coalesce, above.
       * In the beginning, there is no previous band, so prevBand == curBand
       * (curBand is set later on, of course, but the first band will always
***************
*** 875,879 ****
  /*-
   *-----------------------------------------------------------------------
!  * pixman_region16_tSetExtents --
   *	Reset the extents of a region to what they should be. Called by
   *	pixman_region_subtract and pixman_region_intersect as they can't figure it out along the
--- 875,879 ----
  /*-
   *-----------------------------------------------------------------------
!  * pixman_set_extents --
   *	Reset the extents of a region to what they should be. Called by
   *	pixman_region_subtract and pixman_region_intersect as they can't figure it out along the
***************
*** 889,893 ****
   */
  static void
! pixman_region16_tSetExtents (pixman_region16_t *region)
  {
      pixman_box16_t *box, *boxEnd;
--- 889,893 ----
   */
  static void
! pixman_set_extents (pixman_region16_t *region)
  {
      pixman_box16_t *box, *boxEnd;
***************
*** 1013,1017 ****
  	if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2))
  	{
! 	    newReg->data = &pixman_region16_tBrokenData;
  	    return PIXMAN_REGION_STATUS_FAILURE;
  	}
--- 1013,1017 ----
  	if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2))
  	{
! 	    newReg->data = &pixman_brokendata;
  	    return PIXMAN_REGION_STATUS_FAILURE;
  	}
***************
*** 1045,1052 ****
  	/* General purpose intersection */
  	int overlap; /* result ignored */
! 	if (!pixman_region16_tOp(newReg, reg1, reg2, pixman_region_intersectO, PIXMAN_REGION_STATUS_FAILURE, PIXMAN_REGION_STATUS_FAILURE,
  			&overlap))
  	    return PIXMAN_REGION_STATUS_FAILURE;
! 	pixman_region16_tSetExtents(newReg);
      }
  
--- 1045,1052 ----
  	/* General purpose intersection */
  	int overlap; /* result ignored */
! 	if (!pixman_op(newReg, reg1, reg2, pixman_region_intersectO, PIXMAN_REGION_STATUS_FAILURE, PIXMAN_REGION_STATUS_FAILURE,
  			&overlap))
  	    return PIXMAN_REGION_STATUS_FAILURE;
! 	pixman_set_extents(newReg);
      }
  
***************
*** 1192,1196 ****
      {
  	if (PIXREGION_NAR(reg1))
! 	    return pixman_region16_tBreak (newReg);
          if (newReg != reg2)
  	    return pixman_region_copy(newReg, reg2);
--- 1192,1196 ----
      {
  	if (PIXREGION_NAR(reg1))
! 	    return pixman_break (newReg);
          if (newReg != reg2)
  	    return pixman_region_copy(newReg, reg2);
***************
*** 1204,1208 ****
      {
  	if (PIXREGION_NAR(reg2))
! 	    return pixman_region16_tBreak (newReg);
          if (newReg != reg1)
  	    return pixman_region_copy(newReg, reg1);
--- 1204,1208 ----
      {
  	if (PIXREGION_NAR(reg2))
! 	    return pixman_break (newReg);
          if (newReg != reg1)
  	    return pixman_region_copy(newReg, reg1);
***************
*** 1230,1234 ****
      }
  
!     if (!pixman_region16_tOp(newReg, reg1, reg2, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
--- 1230,1234 ----
      }
  
!     if (!pixman_op(newReg, reg1, reg2, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
***************
*** 1274,1278 ****
  
      if (PIXREGION_NAR(rgn))
! 	return pixman_region16_tBreak (dstrgn);
      
      if (!rgn->data && (dstrgn->data == &pixman_region_emptyData))
--- 1274,1278 ----
  
      if (PIXREGION_NAR(rgn))
! 	return pixman_break (dstrgn);
      
      if (!rgn->data && (dstrgn->data == &pixman_region_emptyData))
***************
*** 1513,1517 ****
      ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
      if (!ri)
! 	return pixman_region16_tBreak (badreg);
      sizeRI = 4;
      numRI = 1;
--- 1513,1517 ----
      ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
      if (!ri)
! 	return pixman_break (badreg);
      sizeRI = 4;
      numRI = 1;
***************
*** 1586,1590 ****
  	rit->reg.extents = *box;
  	rit->reg.data = (pixman_region16_tData *)NULL;
! 	if (!pixman_region16_tRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
  	    goto bail;
  NextRect: ;
--- 1586,1590 ----
  	rit->reg.extents = *box;
  	rit->reg.data = (pixman_region16_tData *)NULL;
! 	if (!pixman_rect_alloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
  	    goto bail;
  NextRect: ;
***************
*** 1616,1620 ****
  	    reg = &ri[j].reg;
  	    hreg = &ri[j+half].reg;
! 	    if (!pixman_region16_tOp(reg, reg, hreg, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, pOverlap))
  		ret = PIXMAN_REGION_STATUS_FAILURE;
  	    if (hreg->extents.x1 < reg->extents.x1)
--- 1616,1620 ----
  	    reg = &ri[j].reg;
  	    hreg = &ri[j+half].reg;
! 	    if (!pixman_op(reg, reg, hreg, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, pOverlap))
  		ret = PIXMAN_REGION_STATUS_FAILURE;
  	    if (hreg->extents.x1 < reg->extents.x1)
***************
*** 1638,1642 ****
  	freeData(&ri[i].reg);
      free (ri);
!     return pixman_region16_tBreak (badreg);
  }
  
--- 1638,1642 ----
  	freeData(&ri[i].reg);
      free (ri);
!     return pixman_break (badreg);
  }
  
***************
*** 1680,1684 ****
      if (!pData)
      {
! 	pixman_region16_tBreak (region);
  	return region;
      }
--- 1680,1684 ----
      if (!pData)
      {
! 	pixman_break (region);
  	return region;
      }
***************
*** 1713,1717 ****
      	}
      	else
! 	    pixman_region16_tSetExtents(region);
      	good(region);
      }
--- 1713,1717 ----
      	}
      	else
! 	    pixman_set_extents(region);
      	good(region);
      }
***************
*** 1884,1888 ****
      {
  	if (PIXREGION_NAR (regS))
! 	    return pixman_region16_tBreak (regD);
  	return pixman_region_copy(regD, regM);
      }
--- 1884,1888 ----
      {
  	if (PIXREGION_NAR (regS))
! 	    return pixman_break (regD);
  	return pixman_region_copy(regD, regM);
      }
***************
*** 1899,1913 ****
         do yucky substraction for overlaps, and
         just throw away rectangles in region 2 that aren't in region 1 */
!     if (!pixman_region16_tOp(regD, regM, regS, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
      /*
!      * Can't alter RegD's extents before we call pixman_region16_tOp because
!      * it might be one of the source regions and pixman_region16_tOp depends
       * on the extents of those regions being unaltered. Besides, this
       * way there's no checking against rectangles that will be nuked
       * due to coalescing, so we have to examine fewer rectangles.
       */
!     pixman_region16_tSetExtents(regD);
      good(regD);
      return PIXMAN_REGION_STATUS_SUCCESS;
--- 1899,1913 ----
         do yucky substraction for overlaps, and
         just throw away rectangles in region 2 that aren't in region 1 */
!     if (!pixman_op(regD, regM, regS, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
      /*
!      * Can't alter RegD's extents before we call pixman_op because
!      * it might be one of the source regions and pixman_op depends
       * on the extents of those regions being unaltered. Besides, this
       * way there's no checking against rectangles that will be nuked
       * due to coalescing, so we have to examine fewer rectangles.
       */
!     pixman_set_extents(regD);
      good(regD);
      return PIXMAN_REGION_STATUS_SUCCESS;
***************
*** 1949,1953 ****
      {
  	if (PIXREGION_NAR(reg1))
! 	    return pixman_region16_tBreak (newReg);
  	newReg->extents = *invRect;
  	freeData(newReg);
--- 1949,1953 ----
      {
  	if (PIXREGION_NAR(reg1))
! 	    return pixman_break (newReg);
  	newReg->extents = *invRect;
  	freeData(newReg);
***************
*** 1961,1975 ****
      invReg.extents = *invRect;
      invReg.data = (pixman_region16_tData *)NULL;
!     if (!pixman_region16_tOp(newReg, &invReg, reg1, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
      /*
!      * Can't alter newReg's extents before we call pixman_region16_tOp because
!      * it might be one of the source regions and pixman_region16_tOp depends
       * on the extents of those regions being unaltered. Besides, this
       * way there's no checking against rectangles that will be nuked
       * due to coalescing, so we have to examine fewer rectangles.
       */
!     pixman_region16_tSetExtents(newReg);
      good(newReg);
      return PIXMAN_REGION_STATUS_SUCCESS;
--- 1961,1975 ----
      invReg.extents = *invRect;
      invReg.data = (pixman_region16_tData *)NULL;
!     if (!pixman_op(newReg, &invReg, reg1, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
  	return PIXMAN_REGION_STATUS_FAILURE;
  
      /*
!      * Can't alter newReg's extents before we call pixman_op because
!      * it might be one of the source regions and pixman_op depends
       * on the extents of those regions being unaltered. Besides, this
       * way there's no checking against rectangles that will be nuked
       * due to coalescing, so we have to examine fewer rectangles.
       */
!     pixman_set_extents(newReg);
      good(newReg);
      return PIXMAN_REGION_STATUS_SUCCESS;
***************
*** 2166,2170 ****
  	    }
  	    else
! 		pixman_region16_tSetExtents(region);
  	}
      }
--- 2166,2170 ----
  	    }
  	    else
! 		pixman_set_extents(region);
  	}
      }
***************
*** 2192,2196 ****
  	dst->data = allocData(src->data->numRects);
  	if (!dst->data)
! 	    return pixman_region16_tBreak (dst);
      }
      dst->data->size = src->data->size;
--- 2192,2196 ----
  	dst->data = allocData(src->data->numRects);
  	if (!dst->data)
! 	    return pixman_break (dst);
      }
      dst->data->size = src->data->size;





More information about the cairo-commit mailing list