[clutter/master-next: 14/51] Add a rect-contains-rect function



commit bd302b7fca8db469fbf8a9e32265ff32ba41779c
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Apr 19 12:32:07 2012 +0100

    Add a rect-contains-rect function
    
    Similar to the contains-point one.

 clutter/clutter-base-types.c |   28 ++++++++++++++++++++++++++++
 clutter/clutter-types.h      |    2 ++
 clutter/clutter.symbols      |    1 +
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-base-types.c b/clutter/clutter-base-types.c
index 06b1980..0dec712 100644
--- a/clutter/clutter-base-types.c
+++ b/clutter/clutter-base-types.c
@@ -910,6 +910,34 @@ clutter_rect_contains_point (ClutterRect  *rect,
 }
 
 /**
+ * clutter_rect_contains_rect:
+ * @a: a #ClutterRect
+ * @b: a #ClutterRect
+ *
+ * Checks whether @a contains @b.
+ *
+ * The first rectangle contains the second if the union of the
+ * two #ClutterRect is equal to the first rectangle.
+ *
+ * Return value: %TRUE if the first rectangle contains the second.
+ *
+ * Since: 1.12
+ */
+gboolean
+clutter_rect_contains_rect (ClutterRect *a,
+                            ClutterRect *b)
+{
+  ClutterRect res;
+
+  g_return_val_if_fail (a != NULL, FALSE);
+  g_return_val_if_fail (b != NULL, FALSE);
+
+  clutter_rect_union (a, b, &res);
+
+  return clutter_rect_equals (a, &res);
+}
+
+/**
  * clutter_rect_union:
  * @a: a #ClutterRect
  * @b: a #ClutterRect
diff --git a/clutter/clutter-types.h b/clutter/clutter-types.h
index c9c3e0b..e6f8327 100644
--- a/clutter/clutter-types.h
+++ b/clutter/clutter-types.h
@@ -221,6 +221,8 @@ void            clutter_rect_get_center         (ClutterRect       *rect,
                                                  ClutterPoint      *center);
 gboolean        clutter_rect_contains_point     (ClutterRect       *rect,
                                                  ClutterPoint      *point);
+gboolean        clutter_rect_contains_rect      (ClutterRect       *a,
+                                                 ClutterRect       *b);
 void            clutter_rect_union              (ClutterRect       *a,
                                                  ClutterRect       *b,
                                                  ClutterRect       *res);
diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols
index 2349829..75a5388 100644
--- a/clutter/clutter.symbols
+++ b/clutter/clutter.symbols
@@ -998,6 +998,7 @@ clutter_property_transition_set_property_name
 clutter_rect_alloc
 clutter_rect_clamp_to_pixel
 clutter_rect_contains_point
+clutter_rect_contains_rect
 clutter_rect_copy
 clutter_rect_equals
 clutter_rect_free



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]