[Pixman] [PATCH] region: Add pixman_region{, 32}_clear() functions.

Søren Sandmann sandmann at cs.au.dk
Tue Dec 13 13:52:48 PST 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

These functions simply reset the region to empty. They are equivalent
to

      pixman_region_fini (&region);
      pixman_region_init (&region);
---
 pixman/pixman-region.c |   10 ++++++++++
 pixman/pixman.h        |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 80219c6..70c282d 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2356,6 +2356,16 @@ PREFIX (_reset) (region_type_t *region, box_type_t *box)
     region->data = NULL;
 }
 
+PIXMAN_EXPORT void
+PREFIX (_clear) (region_type_t *region)
+{
+    GOOD (region);
+    FREE_DATA (region);
+
+    region->extents = *pixman_region_empty_box;
+    region->data = pixman_region_empty_data;
+}
+
 /* box is "return" value */
 PIXMAN_EXPORT int
 PREFIX (_contains_point) (region_type_t * region,
diff --git a/pixman/pixman.h b/pixman/pixman.h
index c57092a..18d9513 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -466,6 +466,7 @@ pixman_bool_t           pixman_region_equal              (pixman_region16_t *reg
 pixman_bool_t           pixman_region_selfcheck          (pixman_region16_t *region);
 void                    pixman_region_reset              (pixman_region16_t *region,
 							  pixman_box16_t    *box);
+void			pixman_region_clear		 (pixman_region16_t *region);
 /*
  * 32 bit regions
  */
@@ -560,6 +561,7 @@ pixman_bool_t           pixman_region32_equal              (pixman_region32_t *r
 pixman_bool_t           pixman_region32_selfcheck          (pixman_region32_t *region);
 void                    pixman_region32_reset              (pixman_region32_t *region,
 							    pixman_box32_t    *box);
+void			pixman_region32_clear		   (pixman_region32_t *region);
 
 
 /* Copy / Fill / Misc */
-- 
1.6.0.6



More information about the Pixman mailing list