paint-volume: Add a union method for boxes
Creating PaintVolume instances is not possible, and it's not recommended anyway. It is, though, necessary to union paint volumes, especially with 2D boxes, in some cases. Clutter should provide a simple convenience function that allows unioning volumes to boxes in a moderately efficient way. https://bugzilla.gnome.org/show_bug.cgi?id=670021
This commit is contained in:
parent
618e04e9cc
commit
6a09bf5b52
@ -640,6 +640,42 @@ done:
|
||||
pv->is_complete = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_volume_union_box:
|
||||
* @pv: a #ClutterPaintVolume
|
||||
* @box: a #ClutterActorBox to union to @pv
|
||||
*
|
||||
* Unions the 2D region represented by @box to a #ClutterPaintVolume.
|
||||
*
|
||||
* This function is similar to clutter_paint_volume_union(), but it is
|
||||
* specific for 2D regions.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_paint_volume_union_box (ClutterPaintVolume *pv,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterPaintVolume volume;
|
||||
ClutterVertex origin;
|
||||
|
||||
g_return_if_fail (pv != NULL);
|
||||
g_return_if_fail (box != NULL);
|
||||
|
||||
_clutter_paint_volume_init_static (&volume, pv->actor);
|
||||
|
||||
origin.x = box->x1;
|
||||
origin.y = box->y1;
|
||||
origin.z = 0.f;
|
||||
clutter_paint_volume_set_origin (&volume, &origin);
|
||||
clutter_paint_volume_set_width (&volume, box->x2 - box->x1);
|
||||
clutter_paint_volume_set_height (&volume, box->y2 - box->y1);
|
||||
|
||||
clutter_paint_volume_union (pv, &volume);
|
||||
|
||||
clutter_paint_volume_free (&volume);
|
||||
}
|
||||
|
||||
/* The paint_volume setters only update vertices 0, 1, 3 and
|
||||
* 4 since the others can be drived from them.
|
||||
*
|
||||
|
@ -279,6 +279,8 @@ void clutter_paint_volume_set_depth (ClutterPaintVolume
|
||||
gfloat clutter_paint_volume_get_depth (const ClutterPaintVolume *pv);
|
||||
void clutter_paint_volume_union (ClutterPaintVolume *pv,
|
||||
const ClutterPaintVolume *another_pv);
|
||||
void clutter_paint_volume_union_box (ClutterPaintVolume *pv,
|
||||
const ClutterActorBox *box);
|
||||
|
||||
gboolean clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv,
|
||||
ClutterActor *actor);
|
||||
|
@ -900,6 +900,7 @@ clutter_paint_volume_set_from_allocation
|
||||
clutter_paint_volume_set_height
|
||||
clutter_paint_volume_set_origin
|
||||
clutter_paint_volume_set_width
|
||||
clutter_paint_volume_union_box
|
||||
clutter_paint_volume_union
|
||||
clutter_param_color_get_type
|
||||
clutter_param_fixed_get_type
|
||||
|
@ -547,6 +547,7 @@ clutter_paint_volume_set_depth
|
||||
clutter_paint_volume_get_depth
|
||||
clutter_paint_volume_set_from_allocation
|
||||
clutter_paint_volume_union
|
||||
clutter_paint_volume_union_box
|
||||
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_GEOMETRY
|
||||
|
Loading…
Reference in New Issue
Block a user