Since a pick is really a paint operation, we can safely get
the allocation box, instead of using get_width() and get_height().
This should help cutting down the function calls. If we were
feeling adventurous, we could even use the allocation directly
from the private data structure.
Based on a patch by Gwenole Beauchesne <gbeauchesne@splitted-desktop.org>
*/
if (clutter_actor_should_pick_paint (self))
{
+ ClutterActorBox box = { 0, };
+ float width, height;
+
+ clutter_actor_get_allocation_box (self, &box);
+
+ width = CLUTTER_UNITS_TO_FLOAT (box.x2 - box.x1);
+ height = CLUTTER_UNITS_TO_FLOAT (box.y2 - box.y1);
+
cogl_set_source_color4ub (color->red,
color->green,
color->blue,
color->alpha);
- cogl_rectangle (0, 0,
- clutter_actor_get_width (self),
- clutter_actor_get_height (self));
+
+ cogl_rectangle (0, 0, width, height);
}
}