Don't try to access a node->state directly, use rsvg_node_get_state() instead

parent 190b9c27
......@@ -143,12 +143,15 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
RsvgClipPath *clip;
RsvgCairoRender *save = RSVG_CAIRO_RENDER (ctx->render);
cairo_matrix_t affinesave;
RsvgState *clip_path_state;
g_assert (rsvg_node_get_type (node_clip_path) == RSVG_NODE_TYPE_CLIP_PATH);
clip = rsvg_rust_cnode_get_impl (node_clip_path);
ctx->render = rsvg_cairo_clip_render_new (save->cr, save);
clip_path_state = rsvg_node_get_state (node_clip_path);
/* Horribly dirty hack to have the bbox premultiplied to everything */
if (clip->units == objectBoundingBox) {
cairo_matrix_t bbtransform;
......@@ -159,8 +162,8 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
bbox->rect.height,
bbox->rect.x,
bbox->rect.y);
affinesave = clip->super.state->affine;
cairo_matrix_multiply (&clip->super.state->affine, &bbtransform, &clip->super.state->affine);
affinesave = clip_path_state->affine;
cairo_matrix_multiply (&clip_path_state->affine, &bbtransform, &clip_path_state->affine);
}
rsvg_state_push (ctx);
......@@ -168,7 +171,7 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
rsvg_state_pop (ctx);
if (clip->units == objectBoundingBox)
clip->super.state->affine = affinesave;
clip_path_state->affine = affinesave;
g_free (ctx->render);
cairo_clip (save->cr);
......
......@@ -671,6 +671,8 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgNode *node_mask, RsvgDrawingCtx *ctx
/* Horribly dirty hack to have the bbox premultiplied to everything */
if (self->contentunits == objectBoundingBox) {
cairo_matrix_t bbtransform;
RsvgState *mask_state;
cairo_matrix_init (&bbtransform,
bbox->rect.width,
0,
......@@ -678,8 +680,11 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgNode *node_mask, RsvgDrawingCtx *ctx
bbox->rect.height,
bbox->rect.x,
bbox->rect.y);
affinesave = self->super.state->affine;
cairo_matrix_multiply (&self->super.state->affine, &bbtransform, &self->super.state->affine);
mask_state = rsvg_node_get_state (node_mask);
affinesave = mask_state->affine;
cairo_matrix_multiply (&mask_state->affine, &bbtransform, &mask_state->affine);
rsvg_drawing_ctx_push_view_box (ctx, 1, 1);
}
......@@ -688,12 +693,12 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgNode *node_mask, RsvgDrawingCtx *ctx
rsvg_state_pop (ctx);
if (self->contentunits == objectBoundingBox) {
RsvgState *state;
RsvgState *mask_state;
rsvg_drawing_ctx_pop_view_box (ctx);
state = rsvg_node_get_state (node_mask);
state->affine = affinesave;
mask_state = rsvg_node_get_state (node_mask);
mask_state->affine = affinesave;
}
render->cr = save_cr;
......
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