Use an accessor function rsvg_node_get_state() throughout

parent ce69346a
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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));
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment