[Pixman] [PATCH 2/7] Add pixman_region{,32}_intersect_rect()

Søren Sandmann sandmann at daimi.au.dk
Sat Apr 24 13:48:53 PDT 2010


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

---
 pixman/pixman-region.c |   18 ++++++++++++++++++
 pixman/pixman.h        |   13 ++++++++++++-
 2 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index a6a4005..3ea88a0 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -1329,6 +1329,24 @@ pixman_region_union_o (region_type_t *region,
     return TRUE;
 }
 
+PIXMAN_EXPORT pixman_bool_t
+PREFIX(_intersect_rect) (region_type_t *dest,
+			 region_type_t *source,
+			 int x, int y,
+			 unsigned int width,
+			 unsigned int height)
+{
+    region_type_t region;
+
+    region.data = NULL;
+    region.extents.x1 = x;
+    region.extents.y1 = y;
+    region.extents.x2 = x + width;
+    region.extents.y2 = y + height;
+
+    return PREFIX(_intersect) (dest, source, &region);
+}
+
 /* Convenience function for performing union of region with a
  * single rectangle
  */
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 7b95fed..8df5813 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -420,7 +420,6 @@ void                    pixman_region_init_from_image    (pixman_region16_t *reg
 void                    pixman_region_fini               (pixman_region16_t *region);
 
 
-
 /* manipulation */
 void                    pixman_region_translate          (pixman_region16_t *region,
 							  int                x,
@@ -439,6 +438,12 @@ pixman_bool_t           pixman_region_union_rect         (pixman_region16_t *des
 							  int                y,
 							  unsigned int       width,
 							  unsigned int       height);
+pixman_bool_t		pixman_region_intersect_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 *reg_d,
 							  pixman_region16_t *reg_m,
 							  pixman_region16_t *reg_s);
@@ -521,6 +526,12 @@ pixman_bool_t           pixman_region32_intersect          (pixman_region32_t *n
 pixman_bool_t           pixman_region32_union              (pixman_region32_t *new_reg,
 							    pixman_region32_t *reg1,
 							    pixman_region32_t *reg2);
+pixman_bool_t		pixman_region32_intersect_rect     (pixman_region32_t *dest,
+							    pixman_region32_t *source,
+							    int                x,
+							    int                y,
+							    unsigned int       width,
+							    unsigned int       height);
 pixman_bool_t           pixman_region32_union_rect         (pixman_region32_t *dest,
 							    pixman_region32_t *source,
 							    int                x,
-- 
1.7.0.1



More information about the Pixman mailing list