static void rsvg_cairo_render_free (RsvgRender * self) { RsvgCairoRender *me = RSVG_CAIRO_RENDER (self); /* TODO */ g_free (me); }
static void _rsvg_node_text_type_text_path (RsvgNodeTextPath * self, RsvgDrawingCtx * ctx, gdouble * x, gdouble * y, gboolean * lastwasspace, gboolean usetextonly) { if (self->link && self->link->type == RSVG_NODE_TYPE_PATH) { guint i; // Resolve the xlink:href id and get its cairo path object cairo_path_t *path = ((RsvgNodePath *)self->link)->path; // Get the cairo_t context RsvgCairoRender *render = RSVG_CAIRO_RENDER (ctx->render); cairo_t *cr = render->cr; // Flatten path cairo_save(cr); cairo_new_path(cr); cairo_append_path(cr, path); path = cairo_copy_path_flat (cr); cairo_restore(cr); // TODO recursively draw children rsvg_push_discrete_layer (ctx); for (i = 0; i < self->super.children->len; i++) { RsvgNode *node = g_ptr_array_index (self->super.children, i); RsvgNodeType type = RSVG_NODE_TYPE (node); if (type == RSVG_NODE_TYPE_CHARS) { RsvgNodeChars *chars = (RsvgNodeChars *) node; GString *str = _rsvg_text_chomp (rsvg_current_state (ctx), chars->contents, lastwasspace); double offset = 0; // Factor in start offset // Handle percentages as percent of path length if (self->startOffset.factor == 'p') { offset = self->startOffset.length *_rsvg_path_length(path); } else { offset = _rsvg_css_normalize_length (&self->startOffset, ctx, 'h'); } if (PANGO_GRAVITY_IS_VERTICAL (rsvg_current_state(ctx)->text_gravity)) *y += offset; else *x += offset; draw_twisted (ctx, cr, path, x, y, str->str); g_string_free (str, TRUE); } } rsvg_pop_discrete_layer (ctx); cairo_path_destroy (path); } }
void rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgClipPath * clip, RsvgBbox * bbox) { RsvgCairoClipRender *clip_render; RsvgCairoRender *save = RSVG_CAIRO_RENDER (ctx->render); cairo_t *cr; cairo_matrix_t affinesave; cr = save->cr; clip_render = RSVG_CAIRO_CLIP_RENDER (rsvg_cairo_clip_render_new (cr, save)); ctx->render = &clip_render->super.super; /* Horribly dirty hack to have the bbox premultiplied to everything */ if (clip->units == objectBoundingBox) { cairo_matrix_t bbtransform; cairo_matrix_init (&bbtransform, bbox->rect.width, 0, 0, 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); } rsvg_state_push (ctx); _rsvg_node_draw_children ((RsvgNode *) clip, ctx, 0); rsvg_state_pop (ctx); if (clip->units == objectBoundingBox) clip->super.state->affine = affinesave; g_assert (clip_render->super.cr_stack == NULL); g_assert (clip_render->super.bb_stack == NULL); g_assert (clip_render->super.surfaces_stack == NULL); g_free (ctx->render); cairo_clip (cr); ctx->render = &save->super; }