[librsvg/rustification] Use an accessor function rsvg_node_get_state() throughout
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] Use an accessor function rsvg_node_get_state() throughout
- Date: Fri, 25 Nov 2016 22:38:29 +0000 (UTC)
commit 9e579213b88028cf9f9cc03127328e0008ad5afe
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 22 14:18:36 2016 -0600
Use an accessor function rsvg_node_get_state() throughout
rsvg-base.c | 8 +++++++-
rsvg-paint-server.c | 4 ++--
rsvg-private.h | 3 +++
rsvg-shapes.c | 24 ++++++++++++------------
rsvg-structure.c | 14 +++++++-------
rsvg-styles.c | 2 +-
rsvg-text.c | 4 ++--
7 files changed, 34 insertions(+), 25 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index ae65311..f259c58 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -396,7 +396,7 @@ node_set_atts (RsvgNode * node, RsvgHandle * ctx, const NodeCreator *creator, Rs
else
klazz = NULL;
- rsvg_parse_style_attrs (ctx, node->state, creator->element_name, klazz, id, atts);
+ rsvg_parse_style_attrs (ctx, rsvg_node_get_state (node), creator->element_name, klazz, id, atts);
}
}
}
@@ -433,6 +433,12 @@ rsvg_standard_element_start (RsvgHandle * ctx, const char *name, RsvgPropertyBag
}
}
+RsvgState *
+rsvg_node_get_state (RsvgNode *node)
+{
+ return node->state;
+}
+
/* extra (title, desc, metadata) */
static void
diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c
index d956170..0871ec9 100644
--- a/rsvg-paint-server.c
+++ b/rsvg-paint-server.c
@@ -182,7 +182,7 @@ rsvg_stop_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
}
}
if ((value = rsvg_property_bag_lookup (atts, "style")))
- rsvg_parse_style (ctx, self->state, value);
+ rsvg_parse_style (ctx, rsvg_node_get_state (self), value);
if ((value = rsvg_property_bag_lookup (atts, "stop-color"))) {
has_stop_color = TRUE;
@@ -195,7 +195,7 @@ rsvg_stop_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts)
has_stop_opacity = TRUE;
}
- rsvg_parse_style_pairs (ctx, self->state, atts);
+ rsvg_parse_style_pairs (ctx, rsvg_node_get_state (self), atts);
self->parent = ctx->priv->currentnode;
diff --git a/rsvg-private.h b/rsvg-private.h
index 6ca51d9..b51c9e3 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -340,6 +340,9 @@ struct _RsvgNode {
#define RSVG_NODE_TYPE(node) ((node)->type)
+G_GNUC_INTERNAL
+RsvgState *rsvg_node_get_state (RsvgNode *node);
+
struct _RsvgNodeChars {
RsvgNode super;
GString *contents;
diff --git a/rsvg-shapes.c b/rsvg-shapes.c
index 4419cf0..9e69726 100644
--- a/rsvg-shapes.c
+++ b/rsvg-shapes.c
@@ -65,7 +65,7 @@ rsvg_node_path_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
if (!path->builder)
return;
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, path->builder);
}
@@ -178,7 +178,7 @@ _rsvg_node_poly_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
if (poly->builder == NULL)
return;
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, poly->builder);
}
@@ -243,23 +243,23 @@ _rsvg_node_line_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
}
static void
-_rsvg_node_line_draw (RsvgNode * overself, RsvgDrawingCtx * ctx, int dominate)
+_rsvg_node_line_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
{
RsvgPathBuilder *builder;
- RsvgNodeLine *self = (RsvgNodeLine *) overself;
+ RsvgNodeLine *line = (RsvgNodeLine *) self;
double x1, y1, x2, y2;
builder = rsvg_path_builder_new ();
- x1 = rsvg_length_normalize (&self->x1, ctx);
- y1 = rsvg_length_normalize (&self->y1, ctx);
- x2 = rsvg_length_normalize (&self->x2, ctx);
- y2 = rsvg_length_normalize (&self->y2, ctx);
+ x1 = rsvg_length_normalize (&line->x1, ctx);
+ y1 = rsvg_length_normalize (&line->y1, ctx);
+ x2 = rsvg_length_normalize (&line->x2, ctx);
+ y2 = rsvg_length_normalize (&line->y2, ctx);
rsvg_path_builder_move_to (builder, x1, y1);
rsvg_path_builder_line_to (builder, x2, y2);
- rsvg_state_reinherit_top (ctx, overself->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, builder);
@@ -443,7 +443,7 @@ _rsvg_node_rect_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_path_builder_close_path (builder);
}
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, builder);
@@ -526,7 +526,7 @@ _rsvg_node_circle_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_path_builder_close_path (builder);
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, builder);
@@ -611,7 +611,7 @@ _rsvg_node_ellipse_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_path_builder_close_path (builder);
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_render_path_builder (ctx, builder);
diff --git a/rsvg-structure.c b/rsvg-structure.c
index fcf020a..43e396c 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -40,7 +40,7 @@ rsvg_node_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
RsvgState *state;
GSList *stacksave;
- state = self->state;
+ state = rsvg_node_get_state (self);
stacksave = ctx->drawsub_stack;
if (stacksave) {
@@ -61,7 +61,7 @@ _rsvg_node_draw_children (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
{
guint i;
if (dominate != -1) {
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_push_discrete_layer (ctx);
}
@@ -207,7 +207,7 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_drawing_ctx_push_view_box (ctx, symbol->vbox.rect.width, symbol->vbox.rect.height);
rsvg_push_discrete_layer (ctx);
- if (!state->overflow || (!state->has_overflow && child->state->overflow))
+ if (!state->overflow || (!state->has_overflow && rsvg_node_get_state (child)->overflow))
rsvg_add_clipping_rect (ctx, symbol->vbox.rect.x, symbol->vbox.rect.y,
symbol->vbox.rect.width, symbol->vbox.rect.height);
} else {
@@ -242,7 +242,7 @@ rsvg_node_svg_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
nw = rsvg_length_normalize (&sself->w, ctx);
nh = rsvg_length_normalize (&sself->h, ctx);
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
state = rsvg_current_state (ctx);
@@ -330,7 +330,7 @@ _rsvg_node_svg_apply_atts (RsvgNodeSvg * self, RsvgHandle * ctx)
klazz = value;
if ((value = rsvg_property_bag_lookup (self->atts, "id")))
id = value;
- rsvg_parse_style_attrs (ctx, ((RsvgNode *)self)->state, "svg", klazz, id, self->atts);
+ rsvg_parse_style_attrs (ctx, rsvg_node_get_state ((RsvgNode *) self), "svg", klazz, id, self->atts);
}
}
@@ -455,14 +455,14 @@ _rsvg_node_switch_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
{
guint i;
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
rsvg_push_discrete_layer (ctx);
for (i = 0; i < self->children->len; i++) {
RsvgNode *drawable = g_ptr_array_index (self->children, i);
- if (drawable->state->cond_true) {
+ if (rsvg_node_get_state (drawable)->cond_true) {
rsvg_state_push (ctx);
rsvg_node_draw (g_ptr_array_index (self->children, i), ctx, 0);
rsvg_state_pop (ctx);
diff --git a/rsvg-styles.c b/rsvg-styles.c
index c5bdef4..4401936 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -1726,5 +1726,5 @@ rsvg_state_reconstruct (RsvgState * state, RsvgNode * current)
if (current == NULL)
return;
rsvg_state_reconstruct (state, current->parent);
- rsvg_state_inherit (state, current->state);
+ rsvg_state_inherit (state, rsvg_node_get_state (current));
}
diff --git a/rsvg-text.c b/rsvg-text.c
index 7d8a98d..ee81ebf 100644
--- a/rsvg-text.c
+++ b/rsvg-text.c
@@ -231,7 +231,7 @@ _rsvg_node_text_length_children (RsvgNode * self, RsvgDrawingCtx * ctx,
RsvgNodeType type = RSVG_NODE_TYPE (node);
rsvg_state_push (ctx);
- rsvg_state_reinherit_top (ctx, node->state, 0);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (node), 0);
if (type == RSVG_NODE_TYPE_CHARS) {
RsvgNodeChars *chars = (RsvgNodeChars *) node;
GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace);
@@ -270,7 +270,7 @@ _rsvg_node_text_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
double x, y, dx, dy, length = 0;
gboolean lastwasspace = TRUE;
RsvgNodeText *text = (RsvgNodeText *) self;
- rsvg_state_reinherit_top (ctx, self->state, dominate);
+ rsvg_state_reinherit_top (ctx, rsvg_node_get_state (self), dominate);
x = rsvg_length_normalize (&text->x, ctx);
y = rsvg_length_normalize (&text->y, ctx);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]