clutter/paint-volume: Cleanup private API
Following previous commit, rename _clutter_paint_volume_init_static() to clutter_paint_volume_init_from_actor(), and also _clutter_paint_volume_copy_static() to clutter_paint_volume_init_from_paint_volume(). Make clutter_paint_volume_init_from_paint_volume() follow the dst/src semantic in its arguments, which also allows removing _clutter_paint_volume_set_from_volume() which is exactly the same now. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4175>
This commit is contained in:
parent
7e24b9696a
commit
3c4ec122b5
@ -3131,7 +3131,7 @@ _clutter_actor_draw_paint_volume (ClutterActor *self,
|
|||||||
ClutterPaintVolume fake_pv;
|
ClutterPaintVolume fake_pv;
|
||||||
|
|
||||||
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
|
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
|
||||||
_clutter_paint_volume_init_static (&fake_pv, stage);
|
clutter_paint_volume_init_from_actor (&fake_pv, stage);
|
||||||
|
|
||||||
clutter_actor_get_size (self, &width, &height);
|
clutter_actor_get_size (self, &width, &height);
|
||||||
clutter_paint_volume_set_width (&fake_pv, width);
|
clutter_paint_volume_set_width (&fake_pv, width);
|
||||||
@ -7774,7 +7774,7 @@ clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&volume, self);
|
clutter_paint_volume_init_from_actor (&volume, self);
|
||||||
|
|
||||||
origin.x = clip->x;
|
origin.x = clip->x;
|
||||||
origin.y = clip->y;
|
origin.y = clip->y;
|
||||||
@ -14280,7 +14280,7 @@ _clutter_actor_get_paint_volume_real (ClutterActor *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (pv, self);
|
clutter_paint_volume_init_from_actor (pv, self);
|
||||||
|
|
||||||
if (!CLUTTER_ACTOR_GET_CLASS (self)->get_paint_volume (self, pv))
|
if (!CLUTTER_ACTOR_GET_CLASS (self)->get_paint_volume (self, pv))
|
||||||
{
|
{
|
||||||
@ -14866,8 +14866,8 @@ clutter_actor_finish_layout (ClutterActor *self,
|
|||||||
|
|
||||||
if (priv->has_paint_volume)
|
if (priv->has_paint_volume)
|
||||||
{
|
{
|
||||||
_clutter_paint_volume_copy_static (&priv->paint_volume,
|
clutter_paint_volume_init_from_paint_volume (&priv->visible_paint_volume,
|
||||||
&priv->visible_paint_volume);
|
&priv->paint_volume);
|
||||||
_clutter_paint_volume_transform_relative (&priv->visible_paint_volume,
|
_clutter_paint_volume_transform_relative (&priv->visible_paint_volume,
|
||||||
NULL); /* eye coordinates */
|
NULL); /* eye coordinates */
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ clutter_clone_get_paint_volume (ClutterActor *actor,
|
|||||||
if (source_volume == NULL)
|
if (source_volume == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
_clutter_paint_volume_set_from_volume (volume, source_volume);
|
clutter_paint_volume_init_from_paint_volume (volume, source_volume);
|
||||||
_clutter_paint_volume_set_reference_actor (volume, actor);
|
_clutter_paint_volume_set_reference_actor (volume, actor);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -348,7 +348,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
|||||||
{
|
{
|
||||||
ClutterPaintVolume mutable_volume;
|
ClutterPaintVolume mutable_volume;
|
||||||
|
|
||||||
_clutter_paint_volume_copy_static (volume, &mutable_volume);
|
clutter_paint_volume_init_from_paint_volume (&mutable_volume, volume);
|
||||||
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
|
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
|
||||||
|
|
||||||
box = raw_box;
|
box = raw_box;
|
||||||
|
@ -96,12 +96,10 @@ struct _ClutterPaintVolume
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
void _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
|
void clutter_paint_volume_init_from_actor (ClutterPaintVolume *pv,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
void _clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv,
|
void clutter_paint_volume_init_from_paint_volume (ClutterPaintVolume *dst_pv,
|
||||||
ClutterPaintVolume *dst_pv);
|
const ClutterPaintVolume *src_pv);
|
||||||
void _clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv,
|
|
||||||
const ClutterPaintVolume *src);
|
|
||||||
|
|
||||||
void _clutter_paint_volume_complete (ClutterPaintVolume *pv);
|
void _clutter_paint_volume_complete (ClutterPaintVolume *pv);
|
||||||
void _clutter_paint_volume_transform (ClutterPaintVolume *pv,
|
void _clutter_paint_volume_transform (ClutterPaintVolume *pv,
|
||||||
|
@ -54,8 +54,8 @@ G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
|
|||||||
* this is an easy way to basically drop that to 0%.
|
* this is an easy way to basically drop that to 0%.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_clutter_paint_volume_init_static (ClutterPaintVolume *pv,
|
clutter_paint_volume_init_from_actor (ClutterPaintVolume *pv,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
pv->actor = actor;
|
pv->actor = actor;
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv,
|
clutter_paint_volume_init_from_paint_volume (ClutterPaintVolume *dst_pv,
|
||||||
ClutterPaintVolume *dst_pv)
|
const ClutterPaintVolume *src_pv)
|
||||||
{
|
{
|
||||||
|
|
||||||
g_return_if_fail (src_pv != NULL && dst_pv != NULL);
|
g_return_if_fail (src_pv != NULL && dst_pv != NULL);
|
||||||
@ -97,13 +97,6 @@ clutter_paint_volume_copy (const ClutterPaintVolume *pv)
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv,
|
|
||||||
const ClutterPaintVolume *src)
|
|
||||||
{
|
|
||||||
memcpy (pv, src, sizeof (ClutterPaintVolume));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_paint_volume_free:
|
* clutter_paint_volume_free:
|
||||||
* @pv: a #ClutterPaintVolume
|
* @pv: a #ClutterPaintVolume
|
||||||
@ -263,7 +256,7 @@ clutter_paint_volume_get_width (const ClutterPaintVolume *pv)
|
|||||||
{
|
{
|
||||||
ClutterPaintVolume tmp;
|
ClutterPaintVolume tmp;
|
||||||
float width;
|
float width;
|
||||||
_clutter_paint_volume_copy_static (pv, &tmp);
|
clutter_paint_volume_init_from_paint_volume (&tmp, pv);
|
||||||
_clutter_paint_volume_axis_align (&tmp);
|
_clutter_paint_volume_axis_align (&tmp);
|
||||||
width = tmp.vertices[1].x - tmp.vertices[0].x;
|
width = tmp.vertices[1].x - tmp.vertices[0].x;
|
||||||
return width;
|
return width;
|
||||||
@ -350,7 +343,7 @@ clutter_paint_volume_get_height (const ClutterPaintVolume *pv)
|
|||||||
{
|
{
|
||||||
ClutterPaintVolume tmp;
|
ClutterPaintVolume tmp;
|
||||||
float height;
|
float height;
|
||||||
_clutter_paint_volume_copy_static (pv, &tmp);
|
clutter_paint_volume_init_from_paint_volume (&tmp, pv);
|
||||||
_clutter_paint_volume_axis_align (&tmp);
|
_clutter_paint_volume_axis_align (&tmp);
|
||||||
height = tmp.vertices[3].y - tmp.vertices[0].y;
|
height = tmp.vertices[3].y - tmp.vertices[0].y;
|
||||||
return height;
|
return height;
|
||||||
@ -438,7 +431,7 @@ clutter_paint_volume_get_depth (const ClutterPaintVolume *pv)
|
|||||||
{
|
{
|
||||||
ClutterPaintVolume tmp;
|
ClutterPaintVolume tmp;
|
||||||
float depth;
|
float depth;
|
||||||
_clutter_paint_volume_copy_static (pv, &tmp);
|
clutter_paint_volume_init_from_paint_volume (&tmp, pv);
|
||||||
_clutter_paint_volume_axis_align (&tmp);
|
_clutter_paint_volume_axis_align (&tmp);
|
||||||
depth = tmp.vertices[4].z - tmp.vertices[0].z;
|
depth = tmp.vertices[4].z - tmp.vertices[0].z;
|
||||||
return depth;
|
return depth;
|
||||||
@ -484,7 +477,7 @@ clutter_paint_volume_union (ClutterPaintVolume *pv,
|
|||||||
|
|
||||||
if (pv->is_empty)
|
if (pv->is_empty)
|
||||||
{
|
{
|
||||||
_clutter_paint_volume_set_from_volume (pv, another_pv);
|
clutter_paint_volume_init_from_paint_volume (pv, another_pv);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +488,7 @@ clutter_paint_volume_union (ClutterPaintVolume *pv,
|
|||||||
|
|
||||||
if (!another_pv->is_axis_aligned || !another_pv->is_complete)
|
if (!another_pv->is_axis_aligned || !another_pv->is_complete)
|
||||||
{
|
{
|
||||||
_clutter_paint_volume_copy_static (another_pv, &aligned_pv);
|
clutter_paint_volume_init_from_paint_volume (&aligned_pv, another_pv);
|
||||||
_clutter_paint_volume_axis_align (&aligned_pv);
|
_clutter_paint_volume_axis_align (&aligned_pv);
|
||||||
_clutter_paint_volume_complete (&aligned_pv);
|
_clutter_paint_volume_complete (&aligned_pv);
|
||||||
another_pv = &aligned_pv;
|
another_pv = &aligned_pv;
|
||||||
@ -550,7 +543,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume *pv,
|
|||||||
g_return_if_fail (pv != NULL);
|
g_return_if_fail (pv != NULL);
|
||||||
g_return_if_fail (box != NULL);
|
g_return_if_fail (box != NULL);
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&volume, pv->actor);
|
clutter_paint_volume_init_from_actor (&volume, pv->actor);
|
||||||
|
|
||||||
origin.x = box->x1;
|
origin.x = box->x1;
|
||||||
origin.y = box->y1;
|
origin.y = box->y1;
|
||||||
@ -990,7 +983,7 @@ _clutter_paint_volume_get_stage_paint_box (const ClutterPaintVolume *pv,
|
|||||||
graphene_matrix_t projection;
|
graphene_matrix_t projection;
|
||||||
float viewport[4];
|
float viewport[4];
|
||||||
|
|
||||||
_clutter_paint_volume_copy_static (pv, &projected_pv);
|
clutter_paint_volume_init_from_paint_volume (&projected_pv, pv);
|
||||||
|
|
||||||
graphene_matrix_init_identity (&modelview);
|
graphene_matrix_init_identity (&modelview);
|
||||||
|
|
||||||
|
@ -2854,7 +2854,7 @@ add_selection_to_paint_volume (ClutterText *text,
|
|||||||
ClutterPaintVolume rect_volume;
|
ClutterPaintVolume rect_volume;
|
||||||
graphene_point3d_t vertex;
|
graphene_point3d_t vertex;
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
|
clutter_paint_volume_init_from_actor (&rect_volume, CLUTTER_ACTOR (text));
|
||||||
|
|
||||||
vertex.x = box->x1;
|
vertex.x = box->x1;
|
||||||
vertex.y = box->y1;
|
vertex.y = box->y1;
|
||||||
@ -2931,7 +2931,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
|
|||||||
|
|
||||||
resource_scale = clutter_actor_get_resource_scale (self);
|
resource_scale = clutter_actor_get_resource_scale (self);
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (volume, self);
|
clutter_paint_volume_init_from_actor (volume, self);
|
||||||
|
|
||||||
layout = clutter_text_get_layout (text);
|
layout = clutter_text_get_layout (text);
|
||||||
pango_layout_get_extents (layout, &ink_rect, NULL);
|
pango_layout_get_extents (layout, &ink_rect, NULL);
|
||||||
@ -2953,7 +2953,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
ClutterPaintVolume cursor_paint_volume;
|
ClutterPaintVolume cursor_paint_volume;
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&cursor_paint_volume, self);
|
clutter_paint_volume_init_from_actor (&cursor_paint_volume, self);
|
||||||
|
|
||||||
clutter_text_get_paint_volume_for_cursor (text, resource_scale,
|
clutter_text_get_paint_volume_for_cursor (text, resource_scale,
|
||||||
&cursor_paint_volume);
|
&cursor_paint_volume);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user