actor: Only care about a child's paint volume when clip_to_allocation isn't set
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 13 Feb 2012 17:43:08 +0000 (12:43 -0500)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 13 Feb 2012 18:04:12 +0000 (18:04 +0000)
If we're clipping to the allocation, then the child can paint wherever it
wants, and we don't care. The paint volume is the allocation here.

clutter/clutter-actor.c

index df495fb..61ec219 100644 (file)
@@ -4705,46 +4705,49 @@ clutter_actor_real_get_paint_volume (ClutterActor       *self,
        */
       res = TRUE;
     }
-  else if (priv->has_clip &&
-           priv->clip.width >= 0 &&
-           priv->clip.height >= 0)
+  else
     {
-      ClutterVertex origin;
-
-      origin.x = priv->clip.x;
-      origin.y = priv->clip.y;
-      origin.z = 0;
+      if (priv->has_clip &&
+          priv->clip.width >= 0 &&
+          priv->clip.height >= 0)
+        {
+          ClutterVertex origin;
 
-      clutter_paint_volume_set_origin (volume, &origin);
-      clutter_paint_volume_set_width (volume, priv->clip.width);
-      clutter_paint_volume_set_height (volume, priv->clip.height);
+          origin.x = priv->clip.x;
+          origin.y = priv->clip.y;
+          origin.z = 0;
 
-      res = TRUE;
-    }
+          clutter_paint_volume_set_origin (volume, &origin);
+          clutter_paint_volume_set_width (volume, priv->clip.width);
+          clutter_paint_volume_set_height (volume, priv->clip.height);
 
-  /* if we don't have children we just bail out here... */
-  if (priv->n_children == 0)
-    return res;
+          res = TRUE;
+        }
 
-  /* ...but if we have children then we ask for their paint volume in
-   * our coordinates. if any of our children replies that it doesn't
-   * have a paint volume, we bail out
-   */
-  for (child = priv->first_child;
-       child != NULL;
-       child = child->priv->next_sibling)
-    {
-      const ClutterPaintVolume *child_volume;
+      /* if we don't have children we just bail out here... */
+      if (priv->n_children == 0)
+        return res;
 
-      child_volume = clutter_actor_get_transformed_paint_volume (child, self);
-      if (child_volume == NULL)
+      /* ...but if we have children then we ask for their paint volume in
+       * our coordinates. if any of our children replies that it doesn't
+       * have a paint volume, we bail out
+       */
+      for (child = priv->first_child;
+           child != NULL;
+           child = child->priv->next_sibling)
         {
-          res = FALSE;
-          break;
-        }
+          const ClutterPaintVolume *child_volume;
 
-      clutter_paint_volume_union (volume, child_volume);
-      res = TRUE;
+          child_volume = clutter_actor_get_transformed_paint_volume (child, self);
+          if (child_volume == NULL)
+            {
+              res = FALSE;
+              break;
+            }
+
+          clutter_paint_volume_union (volume, child_volume);
+          res = TRUE;
+        }
     }
 
   return res;