[mutter/gbsneto/pick-culling: 4/5] clutter/paint-volume: Add new API to convert to graphene_box_t




commit 606ef814ba66eb50816ff4d7d50996a6044e8064
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 22 21:11:48 2020 -0300

    clutter/paint-volume: Add new API to convert to graphene_box_t

 clutter/clutter/clutter-paint-volume-private.h |  3 +++
 clutter/clutter/clutter-paint-volume.c         | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
---
diff --git a/clutter/clutter/clutter-paint-volume-private.h b/clutter/clutter/clutter-paint-volume-private.h
index 5d51e5bf31..76bd7e8632 100644
--- a/clutter/clutter/clutter-paint-volume-private.h
+++ b/clutter/clutter/clutter-paint-volume-private.h
@@ -133,6 +133,9 @@ void                _clutter_paint_volume_get_stage_paint_box  (ClutterPaintVolu
 void                _clutter_paint_volume_transform_relative   (ClutterPaintVolume *pv,
                                                                 ClutterActor *relative_to_ancestor);
 
+void                _clutter_paint_volume_to_box               (ClutterPaintVolume *pv,
+                                                                graphene_box_t     *box);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_PAINT_VOLUME_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c
index 97077f7d1d..2cafa58887 100644
--- a/clutter/clutter/clutter-paint-volume.c
+++ b/clutter/clutter/clutter-paint-volume.c
@@ -1131,3 +1131,25 @@ _clutter_paint_volume_transform_relative (ClutterPaintVolume *pv,
 
   _clutter_paint_volume_transform (pv, &matrix);
 }
+
+void
+_clutter_paint_volume_to_box (ClutterPaintVolume *pv,
+                              graphene_box_t     *box)
+{
+  int vertex_count;
+
+  if (pv->is_empty)
+    {
+      graphene_box_init_from_box (box, graphene_box_empty ());
+      return;
+    }
+
+  _clutter_paint_volume_complete (pv);
+
+  if (G_LIKELY (pv->is_2d))
+    vertex_count = 4;
+  else
+    vertex_count = 8;
+
+  graphene_box_init_from_points (box, vertex_count, pv->vertices);
+}


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