[mutter] clutter/util: Add function to build a ClutterRect from a cairo rectangle



commit 789a3ef029cd02aa421b2e94b139fcf356e5c1b2
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Fri Mar 1 15:43:14 2019 +0100

    clutter/util: Add function to build a ClutterRect from a cairo rectangle
    
    Utility functions to easily convert a cairo rectangle into a ClutterRect.
    
    And add ability to offset a cairo rect.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/3

 clutter/clutter/clutter-private.h |  3 +++
 clutter/clutter/clutter-util.c    | 15 +++++++++++++++
 2 files changed, 18 insertions(+)
---
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
index 5c4b9651e..891a5612b 100644
--- a/clutter/clutter/clutter-private.h
+++ b/clutter/clutter/clutter-private.h
@@ -241,6 +241,9 @@ void  _clutter_util_fully_transform_vertices (const CoglMatrix    *modelview,
                                               ClutterVertex       *vertices_out,
                                               int                  n_vertices);
 
+void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
+                                        ClutterRect                 *dest);
+
 void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
                                     const cairo_rectangle_int_t *src2,
                                     cairo_rectangle_int_t       *dest);
diff --git a/clutter/clutter/clutter-util.c b/clutter/clutter/clutter-util.c
index 83e15c041..49423e802 100644
--- a/clutter/clutter/clutter-util.c
+++ b/clutter/clutter/clutter-util.c
@@ -105,6 +105,21 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
     }
 }
 
+void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
+                                        ClutterRect                 *dest)
+{
+  *dest = (ClutterRect) {
+    .origin = {
+      .x = src->x,
+      .y = src->y
+    },
+    .size = {
+      .width = src->width,
+      .height = src->height
+    }
+  };
+}
+
 /*< private >
  * _clutter_util_rectangle_union:
  * @src1: first rectangle to union


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