[Spice-devel] [PATCH spice-common 4/5] region: add region_extents

Yonit Halperin yhalperi at redhat.com
Wed May 2 06:55:56 PDT 2012


---
 common/region.c |   11 +++++++++++
 common/region.h |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/common/region.c b/common/region.c
index 30a11e3..cd9ade0 100644
--- a/common/region.c
+++ b/common/region.c
@@ -386,6 +386,17 @@ void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects)
     }
 }
 
+void region_extents(const QRegion *rgn, SpiceRect *r)
+{
+    pixman_box32_t *extents;
+
+    extents = pixman_region32_extents((pixman_region32_t *)rgn);
+
+    r->left = extents->x1;
+    r->top = extents->y1;
+    r->right = extents->x2;
+    r->bottom = extents->y2;
+}
 
 int region_is_equal(const QRegion *rgn1, const QRegion *rgn2)
 {
diff --git a/common/region.h b/common/region.h
index 3eed547..4619406 100644
--- a/common/region.h
+++ b/common/region.h
@@ -41,6 +41,7 @@ void region_destroy(QRegion *rgn);
 void region_clone(QRegion *dest, const QRegion *src);
 SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects);
 void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects);
+void region_extents(const QRegion *rgn, SpiceRect *r);
 
 int region_test(const QRegion *rgn, const QRegion *other_rgn, int query);
 int region_is_valid(const QRegion *rgn);
@@ -61,6 +62,7 @@ void region_remove(QRegion *rgn, const SpiceRect *r);
 
 void region_offset(QRegion *rgn, int32_t dx, int32_t dy);
 
+
 void region_dump(const QRegion *rgn, const char *prefix);
 
 SPICE_END_DECLS
-- 
1.7.7.6



More information about the Spice-devel mailing list