From 3c4ec122b51c2a78bb40c99a3e78755aaffa7a08 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 10 Dec 2024 14:12:58 -0300 Subject: [PATCH] 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: --- clutter/clutter/clutter-actor.c | 10 +++---- clutter/clutter/clutter-clone.c | 2 +- clutter/clutter/clutter-offscreen-effect.c | 2 +- .../clutter/clutter-paint-volume-private.h | 10 +++---- clutter/clutter/clutter-paint-volume.c | 29 +++++++------------ clutter/clutter/clutter-text.c | 6 ++-- 6 files changed, 25 insertions(+), 34 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 69629cbb0..20db23308 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -3131,7 +3131,7 @@ _clutter_actor_draw_paint_volume (ClutterActor *self, ClutterPaintVolume fake_pv; 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_paint_volume_set_width (&fake_pv, width); @@ -7774,7 +7774,7 @@ clutter_actor_queue_redraw_with_clip (ClutterActor *self, return; } - _clutter_paint_volume_init_static (&volume, self); + clutter_paint_volume_init_from_actor (&volume, self); origin.x = clip->x; origin.y = clip->y; @@ -14280,7 +14280,7 @@ _clutter_actor_get_paint_volume_real (ClutterActor *self, 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)) { @@ -14866,8 +14866,8 @@ clutter_actor_finish_layout (ClutterActor *self, if (priv->has_paint_volume) { - _clutter_paint_volume_copy_static (&priv->paint_volume, - &priv->visible_paint_volume); + clutter_paint_volume_init_from_paint_volume (&priv->visible_paint_volume, + &priv->paint_volume); _clutter_paint_volume_transform_relative (&priv->visible_paint_volume, NULL); /* eye coordinates */ } diff --git a/clutter/clutter/clutter-clone.c b/clutter/clutter/clutter-clone.c index 6080159bd..c71304fd0 100644 --- a/clutter/clutter/clutter-clone.c +++ b/clutter/clutter/clutter-clone.c @@ -201,7 +201,7 @@ clutter_clone_get_paint_volume (ClutterActor *actor, if (source_volume == NULL) 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); return TRUE; diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index 22dafbc65..8a046e5ca 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -348,7 +348,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect, { 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); box = raw_box; diff --git a/clutter/clutter/clutter-paint-volume-private.h b/clutter/clutter/clutter-paint-volume-private.h index 34788e400..83b36548a 100644 --- a/clutter/clutter/clutter-paint-volume-private.h +++ b/clutter/clutter/clutter-paint-volume-private.h @@ -96,12 +96,10 @@ struct _ClutterPaintVolume */ }; -void _clutter_paint_volume_init_static (ClutterPaintVolume *pv, - ClutterActor *actor); -void _clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv, - ClutterPaintVolume *dst_pv); -void _clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv, - const ClutterPaintVolume *src); +void clutter_paint_volume_init_from_actor (ClutterPaintVolume *pv, + ClutterActor *actor); +void clutter_paint_volume_init_from_paint_volume (ClutterPaintVolume *dst_pv, + const ClutterPaintVolume *src_pv); void _clutter_paint_volume_complete (ClutterPaintVolume *pv); void _clutter_paint_volume_transform (ClutterPaintVolume *pv, diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c index 2cdabc425..71d73d595 100644 --- a/clutter/clutter/clutter-paint-volume.c +++ b/clutter/clutter/clutter-paint-volume.c @@ -54,8 +54,8 @@ G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume, * this is an easy way to basically drop that to 0%. */ void -_clutter_paint_volume_init_static (ClutterPaintVolume *pv, - ClutterActor *actor) +clutter_paint_volume_init_from_actor (ClutterPaintVolume *pv, + ClutterActor *actor) { pv->actor = actor; @@ -68,8 +68,8 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv, } void -_clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv, - ClutterPaintVolume *dst_pv) +clutter_paint_volume_init_from_paint_volume (ClutterPaintVolume *dst_pv, + const ClutterPaintVolume *src_pv) { g_return_if_fail (src_pv != NULL && dst_pv != NULL); @@ -97,13 +97,6 @@ clutter_paint_volume_copy (const ClutterPaintVolume *pv) return copy; } -void -_clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv, - const ClutterPaintVolume *src) -{ - memcpy (pv, src, sizeof (ClutterPaintVolume)); -} - /** * clutter_paint_volume_free: * @pv: a #ClutterPaintVolume @@ -263,7 +256,7 @@ clutter_paint_volume_get_width (const ClutterPaintVolume *pv) { ClutterPaintVolume tmp; float width; - _clutter_paint_volume_copy_static (pv, &tmp); + clutter_paint_volume_init_from_paint_volume (&tmp, pv); _clutter_paint_volume_axis_align (&tmp); width = tmp.vertices[1].x - tmp.vertices[0].x; return width; @@ -350,7 +343,7 @@ clutter_paint_volume_get_height (const ClutterPaintVolume *pv) { ClutterPaintVolume tmp; float height; - _clutter_paint_volume_copy_static (pv, &tmp); + clutter_paint_volume_init_from_paint_volume (&tmp, pv); _clutter_paint_volume_axis_align (&tmp); height = tmp.vertices[3].y - tmp.vertices[0].y; return height; @@ -438,7 +431,7 @@ clutter_paint_volume_get_depth (const ClutterPaintVolume *pv) { ClutterPaintVolume tmp; float depth; - _clutter_paint_volume_copy_static (pv, &tmp); + clutter_paint_volume_init_from_paint_volume (&tmp, pv); _clutter_paint_volume_axis_align (&tmp); depth = tmp.vertices[4].z - tmp.vertices[0].z; return depth; @@ -484,7 +477,7 @@ clutter_paint_volume_union (ClutterPaintVolume *pv, 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; } @@ -495,7 +488,7 @@ clutter_paint_volume_union (ClutterPaintVolume *pv, 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_complete (&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 (box != NULL); - _clutter_paint_volume_init_static (&volume, pv->actor); + clutter_paint_volume_init_from_actor (&volume, pv->actor); origin.x = box->x1; origin.y = box->y1; @@ -990,7 +983,7 @@ _clutter_paint_volume_get_stage_paint_box (const ClutterPaintVolume *pv, graphene_matrix_t projection; 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); diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 6a2ac84ff..afa6a2c2f 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -2854,7 +2854,7 @@ add_selection_to_paint_volume (ClutterText *text, ClutterPaintVolume rect_volume; 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.y = box->y1; @@ -2931,7 +2931,7 @@ clutter_text_get_paint_volume (ClutterActor *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); pango_layout_get_extents (layout, &ink_rect, NULL); @@ -2953,7 +2953,7 @@ clutter_text_get_paint_volume (ClutterActor *self, { 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, &cursor_paint_volume);