Commit bb0e9316 authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe

[PATCH 2/3] Follow up fix of RsvgState change.

rsvg_state_current -> rsvg_current_state.
parent 1f859f2b
......@@ -63,7 +63,7 @@ static void
rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
{
RsvgCairoClipRender *render = (RsvgCairoClipRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
cairo_t *cr;
RsvgBpath *bpath;
int i;
......@@ -72,7 +72,7 @@ rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_de
rsvg_cairo_clip_apply_affine (render, state->affine);
if (rsvg_state_current (ctx)->clip_rule == FILL_RULE_EVENODD)
if (rsvg_current_state (ctx)->clip_rule == FILL_RULE_EVENODD)
cairo_set_fill_rule (((RsvgCairoRender *) ctx->render)->cr, CAIRO_FILL_RULE_EVEN_ODD);
else /* state->fill_rule == FILL_RULE_NONZERO */
cairo_set_fill_rule (((RsvgCairoRender *) ctx->render)->cr, CAIRO_FILL_RULE_WINDING);
......
......@@ -320,7 +320,7 @@ _set_source_rsvg_pattern (RsvgDrawingCtx * ctx,
bbhscale = 1.0;
}
_rsvg_affine_multiply (taffine, rsvg_pattern->affine, rsvg_state_current (ctx)->affine);
_rsvg_affine_multiply (taffine, rsvg_pattern->affine, rsvg_current_state (ctx)->affine);
scwscale = sqrt (taffine[0] * taffine[0] + taffine[2] * taffine[2]);
schscale = sqrt (taffine[1] * taffine[1] + taffine[3] * taffine[3]);
......@@ -388,8 +388,8 @@ _set_source_rsvg_pattern (RsvgDrawingCtx * ctx,
/* Set up transformations to be determined by the contents units */
rsvg_state_push (ctx);
for (i = 0; i < 6; i++)
rsvg_state_current (ctx)->personal_affine[i] =
rsvg_state_current (ctx)->affine[i] = caffine[i];
rsvg_current_state (ctx)->personal_affine[i] =
rsvg_current_state (ctx)->affine[i] = caffine[i];
/* Draw everything */
_rsvg_node_draw_children ((RsvgNode *) rsvg_pattern, ctx, 2);
......@@ -474,7 +474,7 @@ void
rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, double x, double y)
{
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
PangoRectangle ink;
RsvgBbox bbox;
......@@ -498,7 +498,7 @@ rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, doub
state->current_color,
state->fill,
state->fill_opacity,
bbox, rsvg_state_current (ctx)->current_color);
bbox, rsvg_current_state (ctx)->current_color);
pango_cairo_show_layout (render->cr, layout);
}
......@@ -512,7 +512,7 @@ rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, doub
state->current_color,
state->stroke,
state->stroke_opacity,
bbox, rsvg_state_current (ctx)->current_color);
bbox, rsvg_current_state (ctx)->current_color);
cairo_set_line_width (render->cr, _rsvg_css_normalize_length (&state->stroke_width, ctx, 'h'));
cairo_stroke (render->cr);
......@@ -523,7 +523,7 @@ void
rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
{
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
cairo_t *cr;
RsvgBpath *bpath;
int i;
......@@ -612,7 +612,7 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
_set_source_rsvg_paint_server (ctx,
state->current_color,
state->fill,
opacity, bbox, rsvg_state_current (ctx)->current_color);
opacity, bbox, rsvg_current_state (ctx)->current_color);
if (state->stroke != NULL)
cairo_fill_preserve (cr);
......@@ -630,7 +630,7 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
_set_source_rsvg_paint_server (ctx,
state->current_color,
state->stroke,
opacity, bbox, rsvg_state_current (ctx)->current_color);
opacity, bbox, rsvg_current_state (ctx)->current_color);
cairo_stroke (cr);
}
......@@ -644,7 +644,7 @@ rsvg_cairo_render_image (RsvgDrawingCtx * ctx, const GdkPixbuf * pixbuf,
double pixbuf_x, double pixbuf_y, double w, double h)
{
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
gint width = gdk_pixbuf_get_width (pixbuf);
gint height = gdk_pixbuf_get_height (pixbuf);
......@@ -769,7 +769,7 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgMask * self, RsvgDrawingCtx * ctx, R
cairo_surface_t *surface;
cairo_t *mask_cr, *save_cr;
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
guint8 *pixels;
guint32 width = render->width, height = render->height;
guint32 rowstride = width * 4, row, i;
......@@ -854,9 +854,9 @@ static void
rsvg_cairo_push_early_clips (RsvgDrawingCtx * ctx)
{
cairo_save (((RsvgCairoRender *) ctx->render)->cr);
if (rsvg_state_current (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_state_current (ctx)->clip_path_ref)->units == userSpaceOnUse)
rsvg_cairo_clip (ctx, rsvg_state_current (ctx)->clip_path_ref, NULL);
if (rsvg_current_state (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_current_state (ctx)->clip_path_ref)->units == userSpaceOnUse)
rsvg_cairo_clip (ctx, rsvg_current_state (ctx)->clip_path_ref, NULL);
}
......@@ -869,11 +869,11 @@ rsvg_cairo_push_render_stack (RsvgDrawingCtx * ctx)
cairo_surface_t *surface;
cairo_t *child_cr;
RsvgBbox *bbox;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
gboolean lateclip = FALSE;
if (rsvg_state_current (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_state_current (ctx)->clip_path_ref)->units == objectBoundingBox)
if (rsvg_current_state (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_current_state (ctx)->clip_path_ref)->units == objectBoundingBox)
lateclip = TRUE;
if (state->opacity == 0xFF
......@@ -968,11 +968,11 @@ rsvg_cairo_pop_render_stack (RsvgDrawingCtx * ctx)
gboolean lateclip = FALSE;
GdkPixbuf *output = NULL;
cairo_surface_t *surface = NULL;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
gboolean nest;
if (rsvg_state_current (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_state_current (ctx)->clip_path_ref)->units == objectBoundingBox)
if (rsvg_current_state (ctx)->clip_path_ref)
if (((RsvgClipPath *) rsvg_current_state (ctx)->clip_path_ref)->units == objectBoundingBox)
lateclip = TRUE;
if (state->opacity == 0xFF
......@@ -1009,7 +1009,7 @@ rsvg_cairo_pop_render_stack (RsvgDrawingCtx * ctx)
nest ? 0 : render->offset_y);
if (lateclip)
rsvg_cairo_clip (ctx, rsvg_state_current (ctx)->clip_path_ref, &render->bbox);
rsvg_cairo_clip (ctx, rsvg_current_state (ctx)->clip_path_ref, &render->bbox);
_rsvg_cairo_set_operator (render->cr, state->comp_op);
......@@ -1048,7 +1048,7 @@ rsvg_cairo_add_clipping_rect (RsvgDrawingCtx * ctx, double x, double y, double w
RsvgCairoRender *render = (RsvgCairoRender *) ctx->render;
cairo_t *cr = render->cr;
_set_rsvg_affine (render, rsvg_state_current (ctx)->affine);
_set_rsvg_affine (render, rsvg_current_state (ctx)->affine);
cairo_rectangle (cr, x, y, w, h);
cairo_clip (cr);
......
......@@ -155,7 +155,7 @@ rsvg_cairo_new_drawing_ctx (cairo_t * cr, RsvgHandle * handle)
draw->ptrs = NULL;
rsvg_state_push (draw);
state = rsvg_state_current (draw);
state = rsvg_current_state (draw);
/* apply cairo transformation to our affine transform */
affine[0] = cairo_transform.xx;
......
......@@ -213,7 +213,7 @@ _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx, char di
if (dir == 'o')
return in->length * rsvg_viewport_percentage (ctx->vb.w, ctx->vb.h);
} else if (in->factor == 'm' || in->factor == 'x') {
double font = _rsvg_css_hand_normalize_length (&rsvg_state_current (ctx)->font_size,
double font = _rsvg_css_hand_normalize_length (&rsvg_current_state (ctx)->font_size,
ctx->dpi_y, ctx->vb.h, 1);
if (in->factor == 'm')
return in->length * font;
......
......@@ -469,7 +469,7 @@ rsvg_filter_render (RsvgFilter * self, GdkPixbuf * source,
g_object_ref (source);
rsvg_filter_fix_coordinate_system (ctx, rsvg_state_current (context), *bounds);
rsvg_filter_fix_coordinate_system (ctx, rsvg_current_state (context), *bounds);
ctx->lastresult.result = source;
ctx->lastresult.Rused = 1;
......@@ -3284,7 +3284,7 @@ rsvg_filter_primitive_image_render_in (RsvgFilterPrimitive * self, RsvgFilterCon
return NULL;
for (i = 0; i < 6; i++)
rsvg_state_current (ctx)->affine[i] = context->paffine[i];
rsvg_current_state (ctx)->affine[i] = context->paffine[i];
return rsvg_get_image_of_node (ctx, drawable, context->width, context->height);
}
......
......@@ -499,7 +499,7 @@ rsvg_node_image_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_push_discrete_layer (ctx);
if (!rsvg_state_current (ctx)->overflow && (aspect_ratio & RSVG_ASPECT_RATIO_SLICE)) {
if (!rsvg_current_state (ctx)->overflow && (aspect_ratio & RSVG_ASPECT_RATIO_SLICE)) {
rsvg_add_clipping_rect (ctx, x, y, w, h);
}
......
......@@ -104,7 +104,7 @@ rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y, gdouble orient, gdo
gdouble taffine[6];
unsigned int i;
gdouble rotation;
RsvgState *state = rsvg_state_current (ctx);
RsvgState *state = rsvg_current_state (ctx);
_rsvg_affine_translate (taffine, x, y);
_rsvg_affine_multiply (affine, taffine, state->affine);
......@@ -151,7 +151,7 @@ rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y, gdouble orient, gdo
rsvg_state_push (ctx);
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
rsvg_state_reinit (state);
......@@ -162,7 +162,7 @@ rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y, gdouble orient, gdo
rsvg_push_discrete_layer (ctx);
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
if (!state->overflow) {
if (self->vbox.active)
......@@ -220,7 +220,7 @@ rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
RsvgMarker *middlemarker;
RsvgMarker *endmarker;
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
linewidth = _rsvg_css_normalize_length (&state->stroke_width, ctx, 'o');
startmarker = (RsvgMarker *) state->startMarker;
......
......@@ -217,7 +217,7 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
else if (rsvg_node_is_ancestor (child, self)) /* or, if we're <use>'ing ourself */
return;
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
if (strcmp (child->type->str, "symbol")) {
_rsvg_affine_translate (affine, x, y);
_rsvg_affine_multiply (state->affine, affine, state->affine);
......@@ -279,7 +279,7 @@ rsvg_node_svg_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
rsvg_state_reinherit_top (ctx, self->state, dominate);
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
for (i = 0; i < 6; i++)
affine_old[i] = state->affine[i];
......
......@@ -1504,7 +1504,7 @@ rsvg_parse_style_attrs (RsvgHandle * ctx,
}
RsvgState *
rsvg_state_current (RsvgDrawingCtx * ctx)
rsvg_current_state (RsvgDrawingCtx * ctx)
{
return ctx->state;
}
......@@ -1625,7 +1625,7 @@ rsvg_state_reinherit_top (RsvgDrawingCtx * ctx, RsvgState * state, int dominate)
if (dominate == 3)
return;
current = rsvg_state_current (ctx);
current = rsvg_current_state (ctx);
/*This is a special domination mode for patterns, the transform
is simply left as is, wheras the style is totally overridden */
if (dominate == 2) {
......
......@@ -268,8 +268,9 @@ gboolean rsvg_parse_transform (double dst[6], const char *src);
RsvgState *rsvg_state_parent (RsvgState * state);
RsvgState *rsvg_state_current (RsvgDrawingCtx * ctx);
void rsvg_state_pop (RsvgDrawingCtx * ctx);
void rsvg_state_push (RsvgDrawingCtx * ctx);
void rsvg_state_pop (RsvgDrawingCtx * ctx);
void rsvg_state_push (RsvgDrawingCtx * ctx);
RsvgState *rsvg_current_state (RsvgDrawingCtx * ctx);
void rsvg_state_reinherit_top (RsvgDrawingCtx * ctx, RsvgState * state, int dominate);
......
......@@ -183,7 +183,7 @@ _rsvg_node_text_type_children (RsvgNode * self, RsvgDrawingCtx * ctx,
RsvgNode *node = g_ptr_array_index (self->children, i);
if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) {
RsvgNodeChars *chars = (RsvgNodeChars *) node;
GString *str = _rsvg_text_chomp (rsvg_state_current (ctx), chars->contents, lastwasspace);
GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace);
rsvg_text_render_text (ctx, str->str, x, y);
g_string_free (str, TRUE);
} else if (!strcmp (node->type->str, "tspan")) {
......@@ -221,7 +221,7 @@ _rsvg_node_text_length_children (RsvgNode * self, RsvgDrawingCtx * ctx,
rsvg_state_reinherit_top (ctx, node->state, 0);
if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) {
RsvgNodeChars *chars = (RsvgNodeChars *) node;
GString *str = _rsvg_text_chomp (rsvg_state_current (ctx), chars->contents, lastwasspace);
GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace);
*x += rsvg_text_length_text_as_string (ctx, str->str);
g_string_free (str, TRUE);
} else if (!strcmp (node->type->str, "tspan")) {
......@@ -252,12 +252,12 @@ _rsvg_node_text_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
x += _rsvg_css_normalize_length (&text->dx, ctx, 'h');
y += _rsvg_css_normalize_length (&text->dy, ctx, 'v');
if (rsvg_state_current (ctx)->text_anchor != TEXT_ANCHOR_START) {
if (rsvg_current_state (ctx)->text_anchor != TEXT_ANCHOR_START) {
double length = 0;
_rsvg_node_text_length_children (self, ctx, &length, &lastwasspace);
if (rsvg_state_current (ctx)->text_anchor == TEXT_ANCHOR_END)
if (rsvg_current_state (ctx)->text_anchor == TEXT_ANCHOR_END)
x -= length;
if (rsvg_state_current (ctx)->text_anchor == TEXT_ANCHOR_MIDDLE)
if (rsvg_current_state (ctx)->text_anchor == TEXT_ANCHOR_MIDDLE)
x -= length / 2;
}
......@@ -285,13 +285,13 @@ _rsvg_node_text_type_tspan (RsvgNodeText * self, RsvgDrawingCtx * ctx,
if (self->x.factor != 'n') {
*x = _rsvg_css_normalize_length (&self->x, ctx, 'h');
if (rsvg_state_current (ctx)->text_anchor != TEXT_ANCHOR_START) {
if (rsvg_current_state (ctx)->text_anchor != TEXT_ANCHOR_START) {
double length = 0;
gboolean lws = *lastwasspace;
_rsvg_node_text_length_children (&self->super, ctx, &length, &lws);
if (rsvg_state_current (ctx)->text_anchor == TEXT_ANCHOR_END)
if (rsvg_current_state (ctx)->text_anchor == TEXT_ANCHOR_END)
*x -= length;
if (rsvg_state_current (ctx)->text_anchor == TEXT_ANCHOR_MIDDLE)
if (rsvg_current_state (ctx)->text_anchor == TEXT_ANCHOR_MIDDLE)
*x -= length / 2;
}
}
......@@ -900,7 +900,7 @@ rsvg_text_render_text_as_string (RsvgDrawingCtx * ctx, const char *text, gdouble
RenderCtx *render;
RsvgState *state;
GString *output;
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
state->fill_rule = FILL_RULE_EVENODD;
state->has_fill_rule = TRUE;
......@@ -908,8 +908,8 @@ rsvg_text_render_text_as_string (RsvgDrawingCtx * ctx, const char *text, gdouble
layout = rsvg_text_layout_new (ctx, state, text);
layout->x = *x;
layout->y = *y;
layout->orientation = rsvg_state_current (ctx)->text_dir == PANGO_DIRECTION_TTB_LTR ||
rsvg_state_current (ctx)->text_dir == PANGO_DIRECTION_TTB_RTL;
layout->orientation = rsvg_current_state (ctx)->text_dir == PANGO_DIRECTION_TTB_LTR ||
rsvg_current_state (ctx)->text_dir == PANGO_DIRECTION_TTB_RTL;
render = rsvg_render_ctx_new ();
rsvg_text_layout_render (layout, rsvg_text_render_vectors, (gpointer) render);
......@@ -936,7 +936,7 @@ rsvg_text_render_text (RsvgDrawingCtx * ctx, const char *text, gdouble * x, gdou
RsvgState *state;
gint w, h, baseline;
state = rsvg_state_current (ctx);
state = rsvg_current_state (ctx);
/* Do not render the text if the font size is zero. See bug #581491. */
if (state->font_size.length == 0)
......@@ -976,10 +976,10 @@ rsvg_text_length_text_as_string (RsvgDrawingCtx * ctx, const char *text)
RsvgTextLayout *layout;
gdouble x;
layout = rsvg_text_layout_new (ctx, rsvg_state_current (ctx), text);
layout = rsvg_text_layout_new (ctx, rsvg_current_state (ctx), text);
layout->x = layout->y = 0;
layout->orientation = rsvg_state_current (ctx)->text_dir == PANGO_DIRECTION_TTB_LTR ||
rsvg_state_current (ctx)->text_dir == PANGO_DIRECTION_TTB_RTL;
layout->orientation = rsvg_current_state (ctx)->text_dir == PANGO_DIRECTION_TTB_LTR ||
rsvg_current_state (ctx)->text_dir == PANGO_DIRECTION_TTB_RTL;
x = rsvg_text_layout_width (layout);
......
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