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 <gbeauchesne@splitted-desktop.org>
This commit is contained in:
Emmanuele Bassi 2009-01-22 15:55:43 +00:00
parent e1ab6f972e
commit a1e493fadb

View File

@ -610,13 +610,20 @@ clutter_actor_real_pick (ClutterActor *self,
*/ */
if (clutter_actor_should_pick_paint (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, cogl_set_source_color4ub (color->red,
color->green, color->green,
color->blue, color->blue,
color->alpha); color->alpha);
cogl_rectangle (0, 0,
clutter_actor_get_width (self), cogl_rectangle (0, 0, width, height);
clutter_actor_get_height (self));
} }
} }