actor: Return a valid paint volume by default
authorEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 12 Apr 2012 16:24:37 +0000 (17:24 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 12 Apr 2012 16:50:43 +0000 (17:50 +0100)
It's been a year and change, and two stable releases, since we
introduced the paint volume mechanism to allow actors to paint outside
their allocation safely in environments that support clipped redraws.

The time has come to flip the switch, and return a valid paint volume,
matching the actor's allocation, by default - at least for Actor
instances from classes that do not override paint() and
get_paint_volume().

If an actor has a paint signal handler then it's the user responsability
not to paint outside the allocation - and to suffer the consequences of
doing so; in an ideal world, paint() would not be a signal in the first
place anyway. Plus, the idea that painting can happen at any time and
still have a valid surface greatly conflicts with the design goal of
making Clutter's rendering operations fully retained into a render tree.

We can still revert this commit before spinning 1.12, if need be.

clutter/clutter-actor.c

index 5ac4814..33095c6 100644 (file)
@@ -5153,7 +5153,7 @@ clutter_actor_update_default_paint_volume (ClutterActor       *self,
                                            ClutterPaintVolume *volume)
 {
   ClutterActorPrivate *priv = self->priv;
-  gboolean res = FALSE;
+  gboolean res = TRUE;
 
   /* we start from the allocation */
   clutter_paint_volume_set_width (volume,
@@ -5253,10 +5253,13 @@ clutter_actor_real_get_paint_volume (ClutterActor       *self,
       res = FALSE;
     }
 
-  if (clutter_actor_update_default_paint_volume (self, volume))
-    return res;
+  /* update_default_paint_volume() should only fail if one of the children
+   * reported an invalid, or no, paint volume
+   */
+  if (!clutter_actor_update_default_paint_volume (self, volume))
+    return FALSE;
 
-  return FALSE;
+  return res;
 }
 
 /**