[gnome-shell] shell-generic-container: Exclude skip_paint actors from the paint volume



commit 37595ff3e72ad618037d595235c6ccc17523bb7c
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Fri Mar 1 18:43:34 2013 +0100

    shell-generic-container: Exclude skip_paint actors from the paint volume
    
    We are not painting them so there is no reason to redraw a bigger
    area because of them.

 src/shell-generic-container.c |   55 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c
index 48b8b3c..7bca9c7 100644
--- a/src/shell-generic-container.c
+++ b/src/shell-generic-container.c
@@ -236,6 +236,60 @@ shell_generic_container_set_skip_paint (ShellGenericContainer  *self,
   clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
 }
 
+static gboolean
+shell_generic_container_get_paint_volume (ClutterActor *self,
+                                          ClutterPaintVolume *volume)
+{
+  ClutterActorBox paint_box, alloc_box;
+  StThemeNode *theme_node;
+  ClutterVertex origin;
+
+  /* Setting the paint volume does not make sense when we don't have any allocation */
+  if (!clutter_actor_has_allocation (self))
+    return FALSE;
+
+  theme_node = st_widget_get_theme_node (ST_WIDGET (self));
+  clutter_actor_get_allocation_box (self, &alloc_box);
+
+  st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box);
+
+  origin.x = paint_box.x1 - alloc_box.x1;
+  origin.y = paint_box.y1 - alloc_box.y1;
+  origin.z = 0.0f;
+
+  clutter_paint_volume_set_origin (volume, &origin);
+  clutter_paint_volume_set_width (volume, paint_box.x2 - paint_box.x1);
+  clutter_paint_volume_set_height (volume, paint_box.y2 - paint_box.y1);
+
+  if (!clutter_actor_get_clip_to_allocation (self))
+    {
+      ClutterActor *child;
+      /* Based on ClutterGroup/ClutterBox; include the children's
+       * paint volumes, since they may paint outside our allocation.
+       */
+      for (child = clutter_actor_get_first_child (self);
+           child != NULL;
+           child = clutter_actor_get_next_sibling (child))
+        {
+          const ClutterPaintVolume *child_volume;
+
+          if (!CLUTTER_ACTOR_IS_VISIBLE (child))
+            continue;
+
+          if (shell_generic_container_get_skip_paint (SHELL_GENERIC_CONTAINER  (self), child))
+            continue;
+
+          child_volume = clutter_actor_get_transformed_paint_volume (child, self);
+          if (!child_volume)
+            return FALSE;
+
+          clutter_paint_volume_union (volume, child_volume);
+        }
+    }
+
+  return TRUE;
+}
+
 static void
 shell_generic_container_finalize (GObject *object)
 {
@@ -260,6 +314,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
   actor_class->allocate = shell_generic_container_allocate;
   actor_class->paint = shell_generic_container_paint;
   actor_class->pick = shell_generic_container_pick;
+  actor_class->get_paint_volume = shell_generic_container_get_paint_volume;
 
   widget_class->get_focus_chain = shell_generic_container_get_focus_chain;
 


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