shaped-texture: Remove silly ClutterPaintVolume code with slightly less silly ClutterActorBox code

This commit is contained in:
Jasper St. Pierre 2014-07-30 17:00:11 +02:00
parent a15042b7e5
commit 626e4965b1

View File

@ -499,32 +499,23 @@ meta_shaped_texture_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume) ClutterPaintVolume *volume)
{ {
MetaShapedTexture *self = META_SHAPED_TEXTURE (actor); MetaShapedTexture *self = META_SHAPED_TEXTURE (actor);
ClutterActorBox box;
cairo_rectangle_int_t unobscured_bounds; cairo_rectangle_int_t unobscured_bounds;
if (!clutter_paint_volume_set_from_allocation (volume, actor)) if (!clutter_actor_has_allocation (actor))
return FALSE; return FALSE;
clutter_actor_get_allocation_box (actor, &box);
if (meta_shaped_texture_get_unobscured_bounds (self, &unobscured_bounds)) if (meta_shaped_texture_get_unobscured_bounds (self, &unobscured_bounds))
{ {
ClutterVertex origin; box.x1 = MAX (unobscured_bounds.x, box.x1);
cairo_rectangle_int_t bounds; box.x2 = MIN (unobscured_bounds.x + unobscured_bounds.width, box.x2);
box.y1 = MAX (unobscured_bounds.y, box.y1);
/* I hate ClutterPaintVolume so much... */ box.y2 = MIN (unobscured_bounds.y + unobscured_bounds.height, box.y2);
clutter_paint_volume_get_origin (volume, &origin);
bounds.x = origin.x;
bounds.y = origin.y;
bounds.width = clutter_paint_volume_get_width (volume);
bounds.height = clutter_paint_volume_get_height (volume);
gdk_rectangle_intersect (&bounds, &unobscured_bounds, &bounds);
origin.x = bounds.x;
origin.y = bounds.y;
clutter_paint_volume_set_origin (volume, &origin);
clutter_paint_volume_set_width (volume, bounds.width);
clutter_paint_volume_set_height (volume, bounds.height);
} }
clutter_paint_volume_union_box (volume, &box);
return TRUE; return TRUE;
} }