From a1e493fadb2a16ec7755c16c2a32276519a06d00 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 22 Jan 2009 15:55:43 +0000 Subject: [PATCH] Use the allocation to get the pick area 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 --- clutter/clutter-actor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index d53247180..c8b90c82c 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -610,13 +610,20 @@ clutter_actor_real_pick (ClutterActor *self, */ 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); } }