mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
stroke: Turn stroke copy intialization into a macro
That way I can use it in static initializers.
This commit is contained in:
parent
ea5768cb42
commit
0c3c8a6a85
@ -4829,7 +4829,7 @@ gsk_stroke_node_new (GskRenderNode *child,
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->path = gsk_path_ref (path);
|
||||
gsk_stroke_init_copy (&self->stroke, stroke);
|
||||
self->stroke = GSK_STROKE_INIT_COPY (stroke);
|
||||
|
||||
if (gsk_path_get_stroke_bounds (self->path, &self->stroke, &stroke_bounds))
|
||||
gsk_rect_intersection (&stroke_bounds, &child->bounds, &node->bounds);
|
||||
|
@ -79,7 +79,7 @@ gsk_stroke_copy (const GskStroke *other)
|
||||
|
||||
self = g_new (GskStroke, 1);
|
||||
|
||||
gsk_stroke_init_copy (self, other);
|
||||
*self = GSK_STROKE_INIT_COPY (other);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -37,14 +37,16 @@ struct _GskStroke
|
||||
float dash_offset;
|
||||
};
|
||||
|
||||
static inline void
|
||||
gsk_stroke_init_copy (GskStroke *stroke,
|
||||
const GskStroke *other)
|
||||
{
|
||||
*stroke = *other;
|
||||
|
||||
stroke->dash = g_memdup (other->dash, stroke->n_dash * sizeof (float));
|
||||
}
|
||||
#define GSK_STROKE_INIT_COPY(_stroke) ((GskStroke) {\
|
||||
.line_width = _stroke->line_width, \
|
||||
.line_cap = _stroke->line_cap, \
|
||||
.line_join = _stroke->line_join, \
|
||||
.miter_limit = _stroke->miter_limit, \
|
||||
.dash = g_memdup (_stroke->dash, _stroke->n_dash * sizeof (float)), \
|
||||
.n_dash = _stroke->n_dash, \
|
||||
.dash_length = _stroke->dash_length, \
|
||||
.dash_offset = _stroke->dash_offset, \
|
||||
})
|
||||
|
||||
static inline void
|
||||
gsk_stroke_clear (GskStroke *stroke)
|
||||
|
@ -1301,7 +1301,7 @@ gtk_snapshot_push_stroke (GtkSnapshot *snapshot,
|
||||
gtk_snapshot_clear_stroke);
|
||||
|
||||
state->data.stroke.path = gsk_path_ref (path);
|
||||
gsk_stroke_init_copy (&state->data.stroke.stroke, stroke);
|
||||
state->data.stroke.stroke = GSK_STROKE_INIT_COPY (stroke);
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
|
Loading…
Reference in New Issue
Block a user