[mutter/gbsneto/pick-culling: 55/56] clutter/actor: Add projected paint volume




commit a024880526793ce669359318a4d930267dc17c09
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 22 21:36:53 2020 -0300

    clutter/actor: Add projected paint volume
    
    We'll need an eye-coordinate paint volume to cull out when picking,
    and even if last_paint_volume is in eye coordinates, we can't use
    it because it's used strictly to redraw the last visible region
    the actor painted. That means last_paint_volume is still valid,
    even a parent changes its transform.
    
    Add a new projected_paint_volume, which is invalidated when the absolute
    geometry of any parent actor changes.

 clutter/clutter/clutter-actor.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 66a0968514..4f549025eb 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -773,6 +773,7 @@ struct _ClutterActorPrivate
   /* NB: This volume isn't relative to this actor, it is in eye
    * coordinates so that it can remain valid after the actor changes.
    */
+  ClutterPaintVolume projected_paint_volume;
   ClutterPaintVolume last_paint_volume;
 
   ClutterStageQueueRedrawEntry *queue_redraw_entry;
@@ -829,6 +830,7 @@ struct _ClutterActorPrivate
   guint propagated_one_redraw       : 1;
   guint paint_volume_valid          : 1;
   guint last_paint_volume_valid     : 1;
+  guint projected_paint_volume_valid : 1;
   guint in_clone_paint              : 1;
   guint transform_valid             : 1;
   /* This is TRUE if anything has queued a redraw since we were last
@@ -2444,6 +2446,7 @@ clutter_actor_notify_if_geometry_changed (ClutterActor          *self,
 static void
 absolute_geometry_changed (ClutterActor *actor)
 {
+  actor->priv->projected_paint_volume_valid = FALSE;
   queue_update_stage_views (actor);
 }
 
@@ -3409,6 +3412,12 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self)
   ClutterActorPrivate *priv = self->priv;
   const ClutterPaintVolume *pv;
 
+  if (priv->projected_paint_volume_valid)
+    {
+      clutter_paint_volume_free (&priv->projected_paint_volume);
+      priv->projected_paint_volume_valid = FALSE;
+    }
+
   if (priv->last_paint_volume_valid)
     {
       clutter_paint_volume_free (&priv->last_paint_volume);
@@ -3424,11 +3433,15 @@ _clutter_actor_update_last_paint_volume (ClutterActor *self)
       return;
     }
 
-  _clutter_paint_volume_copy_static (pv, &priv->last_paint_volume);
+  _clutter_paint_volume_copy_static (pv, &priv->projected_paint_volume);
 
-  _clutter_paint_volume_transform_relative (&priv->last_paint_volume,
+  _clutter_paint_volume_transform_relative (&priv->projected_paint_volume,
                                             NULL); /* eye coordinates */
 
+  priv->projected_paint_volume_valid = TRUE;
+
+  _clutter_paint_volume_set_from_volume (&priv->last_paint_volume,
+                                         &priv->projected_paint_volume);
   priv->last_paint_volume_valid = TRUE;
 }
 


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