Commit 0963ceb7 authored by Caleb Michael Moore's avatar Caleb Michael Moore

multi plugins

parent 37a84c4f
......@@ -64,6 +64,8 @@ librsvg_2_la_SOURCES = \
rsvg-art-draw.h \
rsvg-art-composite.c \
rsvg-art-composite.h \
rsvg-art-render.c \
rsvg-art-render.h \
librsvg-enum-types.c
librsvg_2_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -export-dynamic
......
......@@ -29,6 +29,7 @@
#include <string.h>
#include "rsvg-art-composite.h"
#include "rsvg-art-render.h"
#include "rsvg-styles.h"
#include "rsvg-structure.h"
#include "rsvg-filter.h"
......@@ -43,15 +44,16 @@ rsvg_pixmap_destroy (gchar *pixels, gpointer data)
}
void
rsvg_push_discrete_layer (RsvgDrawingCtx *ctx)
rsvg_art_push_discrete_layer (RsvgDrawingCtx *ctx)
{
RsvgState *state;
GdkPixbuf *pixbuf;
RsvgArtRender *render = (RsvgArtRender *)ctx->render;
art_u8 *pixels;
int width, height, rowstride;
state = rsvg_state_current(ctx);
pixbuf = ctx->pixbuf;
pixbuf = render->pixbuf;
rsvg_state_clip_path_assure(ctx);
......@@ -93,7 +95,7 @@ rsvg_push_discrete_layer (RsvgDrawingCtx *ctx)
rowstride,
(GdkPixbufDestroyNotify)rsvg_pixmap_destroy,
NULL);
ctx->pixbuf = pixbuf;
render->pixbuf = pixbuf;
}
static void
......@@ -175,6 +177,7 @@ get_next_out(gint * operationsleft, GdkPixbuf * in, GdkPixbuf * tos,
static GdkPixbuf *
rsvg_compile_bg(RsvgDrawingCtx *ctx, RsvgState *topstate)
{
RsvgArtRender *render = (RsvgArtRender *)ctx->render;
int i, foundstate;
GdkPixbuf *intermediate, *lastintermediate;
RsvgState *state, *lastvalid;
......@@ -190,8 +193,8 @@ rsvg_compile_bg(RsvgDrawingCtx *ctx, RsvgState *topstate)
ctx->bbox.x0 = 0;
ctx->bbox.y0 = 0;
ctx->bbox.x1 = gdk_pixbuf_get_width(ctx->pixbuf);
ctx->bbox.y1 = gdk_pixbuf_get_height(ctx->pixbuf);
ctx->bbox.x1 = gdk_pixbuf_get_width(render->pixbuf);
ctx->bbox.y1 = gdk_pixbuf_get_height(render->pixbuf);
for (i = 0; (state = g_slist_nth_data(ctx->state, i)) != NULL; i++)
{
......@@ -307,10 +310,11 @@ rsvg_composite_layer(RsvgDrawingCtx *ctx, RsvgState *state, GdkPixbuf *tos, GdkP
**/
void
rsvg_pop_discrete_layer(RsvgDrawingCtx *ctx)
rsvg_art_pop_discrete_layer(RsvgDrawingCtx *ctx)
{
GdkPixbuf *tos, *nos;
RsvgState *state;
RsvgArtRender *render = (RsvgArtRender *)ctx->render;
state = rsvg_state_current(ctx);
......@@ -318,19 +322,19 @@ rsvg_pop_discrete_layer(RsvgDrawingCtx *ctx)
!state->backgroundnew && state->mask == NULL && !state->adobe_blend)
return;
tos = ctx->pixbuf;
tos = render->pixbuf;
nos = state->save_pixbuf;
if (nos != NULL)
rsvg_composite_layer(ctx, state, tos, nos);
g_object_unref (tos);
ctx->pixbuf = nos;
render->pixbuf = nos;
art_irect_union(&ctx->bbox, &ctx->bbox, &state->underbbox);
}
gboolean
rsvg_needs_discrete_layer(RsvgState *state)
rsvg_art_needs_discrete_layer(RsvgState *state)
{
return state->filter || state->mask || state->adobe_blend || state->backgroundnew;
}
......
......@@ -4,8 +4,8 @@
libart backend
Copyright (C) 2000 Eazel, Inc.
Copyright (C) 2002, 2003, 2004, 2005 Dom Lachowicz <cinamod@hotmail.com>
Copyright (C) 2003, 2004, 2005 Caleb Moore <c.moore@student.unsw.edu.au>
Copyright (C) 2002 - 2005 Dom Lachowicz <cinamod@hotmail.com>
Copyright (C) 2003 - 2005 Caleb Moore <c.moore@student.unsw.edu.au>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
......@@ -34,9 +34,9 @@
G_BEGIN_DECLS
void rsvg_pop_discrete_layer(RsvgDrawingCtx *ctx);
void rsvg_push_discrete_layer (RsvgDrawingCtx *ctx);
gboolean rsvg_needs_discrete_layer(RsvgState *state);
void rsvg_art_pop_discrete_layer(RsvgDrawingCtx *ctx);
void rsvg_art_push_discrete_layer (RsvgDrawingCtx *ctx);
gboolean rsvg_art_needs_discrete_layer(RsvgState *state);
void
rsvg_alpha_blt (GdkPixbuf * src, gint srcx, gint srcy, gint srcwidth,
......
......@@ -37,6 +37,7 @@
#include "rsvg-art-draw.h"
#include "rsvg-art-composite.h"
#include "rsvg-art-render.h"
#include "rsvg-paint-server.h"
#include "rsvg-styles.h"
#include "rsvg-bpath-util.h"
......@@ -217,7 +218,7 @@ rsvg_render_svp (RsvgDrawingCtx *ctx, ArtSVP *svp,
rsvg_state_clip_path_assure(ctx);
pixbuf = ctx->pixbuf;
pixbuf = ((RsvgArtRender *)ctx->render)->pixbuf;
if (pixbuf == NULL)
{
/* FIXME: What warning/GError here? */
......@@ -274,25 +275,25 @@ rsvg_render_svp (RsvgDrawingCtx *ctx, ArtSVP *svp,
static ArtSVP *
rsvg_render_filling (RsvgState *state, const ArtVpath *vpath)
{
ArtVpath *closed_vpath;
ArtSVP *svp2, *svp;
ArtSvpWriter *swr;
closed_vpath = rsvg_close_vpath (vpath);
svp = art_svp_from_vpath (closed_vpath);
g_free (closed_vpath);
if (state->fill_rule == FILL_RULE_EVENODD)
swr = art_svp_writer_rewind_new (ART_WIND_RULE_ODDEVEN);
else /* state->fill_rule == FILL_RULE_NONZERO */
swr = art_svp_writer_rewind_new (ART_WIND_RULE_NONZERO);
art_svp_intersector (svp, swr);
svp2 = art_svp_writer_rewind_reap (swr);
art_svp_free (svp);
return svp2;
ArtVpath *closed_vpath;
ArtSVP *svp2, *svp;
ArtSvpWriter *swr;
closed_vpath = rsvg_close_vpath (vpath);
svp = art_svp_from_vpath (closed_vpath);
g_free (closed_vpath);
if (state->fill_rule == FILL_RULE_EVENODD)
swr = art_svp_writer_rewind_new (ART_WIND_RULE_ODDEVEN);
else /* state->fill_rule == FILL_RULE_NONZERO */
swr = art_svp_writer_rewind_new (ART_WIND_RULE_NONZERO);
art_svp_intersector (svp, swr);
svp2 = art_svp_writer_rewind_reap (swr);
art_svp_free (svp);
return svp2;
}
static ArtSVP *
......@@ -334,7 +335,7 @@ rsvg_render_bpath (RsvgDrawingCtx *ctx, const ArtBpath *bpath)
int opacity;
int tmp;
pixbuf = ctx->pixbuf;
pixbuf = ((RsvgArtRender *)ctx->render)->pixbuf;
if (pixbuf == NULL)
{
/* FIXME: What warning/GError here? */
......@@ -356,7 +357,7 @@ rsvg_render_bpath (RsvgDrawingCtx *ctx, const ArtBpath *bpath)
art_free (affine_bpath);
need_tmpbuf = ((state->fill != NULL) && (state->stroke != NULL) &&
state->opacity != 0xff) || rsvg_needs_discrete_layer(state);
state->opacity != 0xff) || rsvg_art_needs_discrete_layer(state);
if (need_tmpbuf)
rsvg_push_discrete_layer (ctx);
......@@ -499,7 +500,7 @@ rsvg_render_markers(RsvgBpathDef * bpath_def, RsvgDrawingCtx *ctx)
}
void
rsvg_render_path(RsvgDrawingCtx *ctx, const char *d)
rsvg_art_render_path(RsvgDrawingCtx *ctx, const char *d)
{
RsvgBpathDef *bpath_def;
......@@ -513,17 +514,26 @@ rsvg_render_path(RsvgDrawingCtx *ctx, const char *d)
rsvg_bpath_def_free (bpath_def);
}
ArtSVP *
rsvg_render_path_as_svp(RsvgDrawingCtx *ctx, const char *d)
void
rsvg_art_svp_render_path (RsvgDrawingCtx *ctx, const char *d)
{
RsvgBpathDef *bpath_def;
ArtSVP * output;
RsvgArtSVPRender *render = (RsvgArtSVPRender *)ctx->render;
ArtSVP *svp2, *svp3;
bpath_def = rsvg_parse_path (d);
rsvg_bpath_def_art_finish (bpath_def);
output = rsvg_render_bpath_into_svp (ctx, bpath_def->bpath);
svp2 = rsvg_render_bpath_into_svp (ctx, bpath_def->bpath);
if (render->outline != NULL)
{
svp3 = art_svp_union(svp2, render->outline);
art_free(render->outline);
render->outline = svp3;
}
else
render->outline = svp2;
rsvg_bpath_def_free (bpath_def);
return output;
}
......@@ -31,8 +31,8 @@
G_BEGIN_DECLS
void rsvg_render_path (RsvgDrawingCtx *ctx, const char *d);
ArtSVP * rsvg_render_path_as_svp(RsvgDrawingCtx *ctx, const char *d);
void rsvg_art_render_path (RsvgDrawingCtx *ctx, const char *d);
void rsvg_art_svp_render_path (RsvgDrawingCtx *ctx, const char *d);
G_END_DECLS
......
......@@ -32,6 +32,7 @@
#include <string.h>
#include <math.h>
#include <rsvg-art-render.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
......@@ -3949,8 +3950,8 @@ rsvg_filter_primitive_image_render_in (RsvgFilterPrimitive * self,
img = _rsvg_pixbuf_new_cleared (GDK_COLORSPACE_RGB, 1, 8, context->width, context->height);
save = ctx->pixbuf;
ctx->pixbuf = img;
save = ((RsvgArtRender *)ctx->render)->pixbuf;
((RsvgArtRender *)ctx->render)->pixbuf = img;
for (i = 0; i < 6; i++)
rsvg_state_current(ctx)->affine[i] = context->paffine[i];
......@@ -3961,7 +3962,7 @@ rsvg_filter_primitive_image_render_in (RsvgFilterPrimitive * self,
rsvg_state_pop(ctx);
ctx->pixbuf = save;
((RsvgArtRender *)ctx->render)->pixbuf = save;
return img;
}
......
......@@ -35,7 +35,9 @@
#include <libart_lgpl/art_rgb_svp.h>
#include "rsvg-css.h"
#include "rsvg-mask.h"
/*very art dependant at the moment*/
#include "rsvg-art-composite.h"
#include "rsvg-art-render.h"
static const char s_UTF8_B64Alphabet[64] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
......@@ -653,6 +655,8 @@ rsvg_defs_drawable_image_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
GdkPixbuf *intermediate;
double basex, basey;
ArtSVP * temppath;
/*this will have to change*/
GdkPixbuf * pixbuf = ((RsvgArtRender *)ctx->render)->pixbuf;
rsvg_state_reinherit_top(ctx, &self->state, dominate);
......@@ -679,8 +683,8 @@ rsvg_defs_drawable_image_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
art_affine_multiply(tmp_affine, tmp_tmp_affine, tmp_affine);
intermediate = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 1, 8,
gdk_pixbuf_get_width (ctx->pixbuf),
gdk_pixbuf_get_height (ctx->pixbuf));
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
if (!intermediate)
{
......@@ -701,7 +705,7 @@ rsvg_defs_drawable_image_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
rsvg_alpha_blt (intermediate, 0, 0,
gdk_pixbuf_get_width (intermediate),
gdk_pixbuf_get_height (intermediate),
ctx->pixbuf,
pixbuf,
0, 0);
temprect.x0 = gdk_pixbuf_get_width (intermediate);
......
......@@ -27,6 +27,7 @@
#include "rsvg-styles.h"
#include "rsvg-art-draw.h"
#include "rsvg-art-composite.h"
#include "rsvg-art-render.h"
#include "rsvg-css.h"
#include <libart_lgpl/art_rgba.h>
#include <libart_lgpl/art_svp_ops.h>
......@@ -58,15 +59,15 @@ rsvg_mask_render (RsvgMask *self, GdkPixbuf *tos, GdkPixbuf *nos, RsvgDrawingCtx
mask = _rsvg_pixbuf_new_cleared(GDK_COLORSPACE_RGB, 1, 8,
gdk_pixbuf_get_width(tos),
gdk_pixbuf_get_height(tos));
save = ctx->pixbuf;
ctx->pixbuf = mask;
save = ((RsvgArtRender *)ctx->render)->pixbuf;
((RsvgArtRender *)ctx->render)->pixbuf = mask;
rsvg_state_push(ctx);
rsvg_defs_drawable_draw (drawable, ctx, 0);
rsvg_state_pop(ctx);
ctx->pixbuf = save;
((RsvgArtRender *)ctx->render)->pixbuf = save;
if (tos == NULL || nos == NULL)
{
......@@ -307,11 +308,21 @@ rsvg_clip_path_render (RsvgClipPath * self, RsvgDrawingCtx *ctx)
for (i = 0; i < group->children->len; i++)
{
RsvgArtSVPRender * asvpr;
RsvgRender * save;
rsvg_state_push(ctx);
svp = rsvg_defs_drawable_draw_as_svp (g_ptr_array_index(group->children, i),
ctx, 0);
asvpr = rsvg_art_svp_render_new();
save = ctx->render;
ctx->render = (RsvgRender *)asvpr;
rsvg_defs_drawable_draw (g_ptr_array_index(group->children, i),
ctx, 0);
svp = asvpr->outline;
/*todo, free the render*/
ctx->render = save;
if (svp != NULL)
{
if (svpx != NULL)
......@@ -446,7 +457,8 @@ rsvg_rect_clip_path(double x, double y, double w, double h, RsvgDrawingCtx * ctx
g_string_append (d, " Z");
output = rsvg_render_path_as_svp (ctx, d->str);
/* todo, reenable following code */
output = NULL; /* rsvg_render_path_as_svp (ctx, d->str);*/
g_string_free (d, TRUE);
return output;
}
......
......@@ -28,6 +28,7 @@
#include "rsvg-paint-server.h"
#include "rsvg-styles.h"
#include "rsvg-image.h"
#include "rsvg-art-render.h"
#include <glib/gmem.h>
#include <glib/gmessages.h>
......@@ -519,6 +520,7 @@ rsvg_paint_server_pattern_render (RsvgPaintServer *self, ArtRender *ar,
RsvgPattern *pattern = z->pattern;
RsvgDefsDrawable *drawable = (RsvgDefsDrawable *)pattern->g;
RsvgDrawingCtx *hctx = ctx->ctx;
GdkPixbuf *pixbuf = ((RsvgArtRender *)hctx->render)->pixbuf;
double affine[6];
double caffine[6];
int i, j;
......@@ -601,17 +603,17 @@ rsvg_paint_server_pattern_render (RsvgPaintServer *self, ArtRender *ar,
xoffset = -minx;
if (miny < 0)
yoffset = -miny;
if (maxx > gdk_pixbuf_get_width(hctx->pixbuf))
if (maxx > gdk_pixbuf_get_width(pixbuf))
xoffset = -minx;
if (maxy > gdk_pixbuf_get_height(hctx->pixbuf))
if (maxy > gdk_pixbuf_get_height(pixbuf))
yoffset = -maxy;
render = _rsvg_pixbuf_new_cleared(GDK_COLORSPACE_RGB, 1, 8,
gdk_pixbuf_get_width(hctx->pixbuf),
gdk_pixbuf_get_height(hctx->pixbuf));
save = hctx->pixbuf;
gdk_pixbuf_get_width(pixbuf),
gdk_pixbuf_get_height(pixbuf));
save = pixbuf;
hctx->pixbuf = render;
((RsvgArtRender *)hctx->render)->pixbuf = render;
rsvg_state_push(ctx->ctx);
......@@ -632,7 +634,7 @@ rsvg_paint_server_pattern_render (RsvgPaintServer *self, ArtRender *ar,
rsvg_state_pop(ctx->ctx);
hctx->pixbuf = save;
((RsvgArtRender *)hctx->render)->pixbuf = save;
render_image_pattern (ar, gdk_pixbuf_get_pixels (render),
pattern->x, pattern->y,
......
......@@ -32,12 +32,14 @@
#include <libxml/xmlmemory.h>
#include <pango/pango.h>
#include <libart_lgpl/art_rect.h>
#include <libart_lgpl/art_svp.h>
#include <glib/gslist.h>
G_BEGIN_DECLS
typedef struct RsvgSaxHandler RsvgSaxHandler;
typedef struct RsvgDrawingCtx RsvgDrawingCtx;
typedef struct RsvgRender RsvgRender;
typedef struct RsvgDimensionData RsvgDimensionData;
typedef struct _RsvgPropertyBag RsvgPropertyBag;
typedef struct _RsvgState RsvgState;
......@@ -127,7 +129,7 @@ struct RsvgHandle {
/*Contextual information for the drawing phase*/
struct RsvgDrawingCtx {
GdkPixbuf *pixbuf;
RsvgRender *render;
ArtIRect bbox;
GSList * state;
GError **error;
......@@ -139,6 +141,14 @@ struct RsvgDrawingCtx {
double dpi_y;
};
/*Abstract base class for context for our backends (one as yet)*/
struct RsvgRender {
void (* render_path) (RsvgDrawingCtx *ctx, const char *d);
void (* pop_discrete_layer) (RsvgDrawingCtx *ctx);
void (* push_discrete_layer) (RsvgDrawingCtx *ctx);
};
struct RsvgDimensionData {
int width;
int height;
......@@ -226,6 +236,11 @@ GByteArray *
_rsvg_acquire_xlink_href_resource (const char *href,
const char *base_uri,
GError **err);
void rsvg_pop_discrete_layer(RsvgDrawingCtx *ctx);
void rsvg_push_discrete_layer (RsvgDrawingCtx *ctx);
void rsvg_render_path (RsvgDrawingCtx *ctx, const char *d);
G_END_DECLS
#endif
......@@ -64,8 +64,6 @@
#include "rsvg-image.h"
#include "rsvg-art-draw.h"
#include <libart_lgpl/art_svp_intersect.h>
#include <libart_lgpl/art_svp_ops.h>
#include <libart_lgpl/art_affine.h>
/* 4/3 * (1-cos 45ƒ)/sin 45ƒ = 4/3 * sqrt(2) - 1 */
......@@ -96,18 +94,6 @@ rsvg_defs_drawable_path_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
}
static ArtSVP *
rsvg_defs_drawable_path_draw_as_svp (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgDefsDrawablePath *path = (RsvgDefsDrawablePath*)self;
rsvg_state_reinherit_top(ctx, &self->state, dominate);
return rsvg_render_path_as_svp (ctx, path->d);
}
void
rsvg_handle_path (RsvgHandle *ctx, const char * d, const char * id, RsvgState state)
{
......@@ -119,7 +105,6 @@ rsvg_handle_path (RsvgHandle *ctx, const char * d, const char * id, RsvgState st
path->super.super.type = RSVG_DEF_PATH;
path->super.super.free = rsvg_defs_drawable_path_free;
path->super.draw = rsvg_defs_drawable_path_draw;
path->super.draw_as_svp = rsvg_defs_drawable_path_draw_as_svp;
rsvg_defs_set (ctx->defs, id, &path->super.super);
path->super.parent = (RsvgDefsDrawable *)ctx->current_defs_group;
......
......@@ -32,7 +32,6 @@
#include "rsvg-css.h"
#include "rsvg-art-composite.h"
#include <libart_lgpl/art_svp_ops.h>
#include <libart_lgpl/art_affine.h>
void
......@@ -68,14 +67,6 @@ rsvg_end_g (RsvgHandle *ctx)
rsvg_pop_def_group (ctx);
}
ArtSVP *
rsvg_defs_drawable_draw_as_svp (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
return self->draw_as_svp(self, ctx, dominate);
}
static void
rsvg_defs_drawable_group_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
......@@ -100,38 +91,6 @@ rsvg_defs_drawable_group_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
rsvg_pop_discrete_layer (ctx);
}
static ArtSVP *
rsvg_defs_drawable_group_draw_as_svp (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgDefsDrawableGroup *group = (RsvgDefsDrawableGroup*)self;
guint i;
ArtSVP *svp1, *svp2, *svp3;
svp1 = NULL;
rsvg_state_reinherit_top(ctx, &self->state, dominate);
for (i = 0; i < group->children->len; i++)
{
rsvg_state_push(ctx);
svp2 = rsvg_defs_drawable_draw_as_svp (g_ptr_array_index(group->children, i),
ctx, 0);
if (svp1 != NULL)
{
svp3 = art_svp_union(svp2, svp1);
art_free(svp1);
svp1 = svp3;
}
else
svp1 = svp2;
rsvg_state_pop(ctx);
}
return svp1;
}
static void
rsvg_defs_drawable_group_free (RsvgDefVal *self)
{
......@@ -190,7 +149,6 @@ rsvg_push_part_def_group (RsvgHandle *ctx, const char * id,
group->super.super.type = RSVG_DEF_PATH;
group->super.super.free = rsvg_defs_drawable_group_free;
group->super.draw = rsvg_defs_drawable_group_draw;
group->super.draw_as_svp = rsvg_defs_drawable_group_draw_as_svp;
rsvg_defs_set (ctx->defs, id, &group->super.super);
......@@ -261,7 +219,6 @@ static void
rsvg_defs_drawable_use_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgState *state = rsvg_state_current (ctx);
RsvgDefsDrawableUse *use = (RsvgDefsDrawableUse*)self;
RsvgDefsDrawable * child;
......@@ -269,39 +226,17 @@ rsvg_defs_drawable_use_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
child = rsvg_defs_drawable_use_resolve(use, ctx, rsvg_state_current(ctx)->affine);
if (state->opacity != 0xff || rsvg_needs_discrete_layer(state))
rsvg_push_discrete_layer (ctx);
rsvg_push_discrete_layer (ctx);
rsvg_state_push(ctx);
rsvg_defs_drawable_draw (child, ctx, 1);
rsvg_state_pop(ctx);
rsvg_state_pop(ctx);
if (state->opacity != 0xff || rsvg_needs_discrete_layer(state))
rsvg_pop_discrete_layer (ctx);
rsvg_pop_discrete_layer (ctx);
}
static ArtSVP *
rsvg_defs_drawable_use_draw_as_svp (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgDefsDrawableUse *use = (RsvgDefsDrawableUse*)self;
ArtSVP * svp;
RsvgDefsDrawable * child;
child = rsvg_defs_drawable_use_resolve(use, ctx, rsvg_state_current(ctx)->affine);
rsvg_state_reinherit_top(ctx, &self->state, dominate);
rsvg_state_push(ctx);
svp = rsvg_defs_drawable_draw_as_svp (child, ctx, 1);
rsvg_state_pop(ctx);
return svp;
}
static void
rsvg_defs_drawable_use_free (RsvgDefVal *self)
{
......@@ -440,7 +375,6 @@ rsvg_start_sub_svg (RsvgHandle *ctx, RsvgPropertyBag *atts)
group->super.super.type = RSVG_DEF_PATH;
group->super.super.free = rsvg_defs_drawable_svg_free;
group->super.draw = rsvg_defs_drawable_svg_draw;
group->super.draw_as_svp = rsvg_defs_drawable_group_draw_as_svp;
rsvg_defs_set (ctx->defs, id, &group->super.super);
......@@ -509,7 +443,6 @@ rsvg_start_use (RsvgHandle *ctx, RsvgPropertyBag *atts)
use->super.super.type = RSVG_DEF_PATH;
use->super.super.free = rsvg_defs_drawable_use_free;
use->super.draw = rsvg_defs_drawable_use_draw;
use->super.draw_as_svp = rsvg_defs_drawable_use_draw_as_svp;
use->x = x;
use->y = y;
use->w = width;
......@@ -620,7 +553,6 @@ rsvg_start_symbol(RsvgHandle *ctx, RsvgPropertyBag *atts)
group->super.super.type = RSVG_DEF_SYMBOL;
group->super.super.free = rsvg_defs_drawable_symbol_free;
group->super.draw = rsvg_defs_drawable_symbol_draw;
group->super.draw_as_svp = rsvg_defs_drawable_group_draw_as_svp;
rsvg_defs_set (ctx->defs, id, &group->super.super);
......
......@@ -55,8 +55,6 @@ struct _RsvgDefsDrawable {
RsvgState state;
RsvgDefsDrawable * parent;
void (*draw) (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx, int dominate);
ArtSVP * (*draw_as_svp) (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate);
};
......@@ -97,9 +95,6 @@ void rsvg_defs_drawable_group_pack (RsvgDefsDrawableGroup *self,
void rsvg_defs_drawable_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate);
ArtSVP * rsvg_defs_drawable_draw_as_svp (RsvgDefsDrawable * self,
RsvgDrawingCtx *ctx,
int dominate);
G_END_DECLS
......
......@@ -34,7 +34,6 @@
#include "rsvg-mask.h"
#include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_svp_ops.h>
#include <libart_lgpl/art_render_mask.h>
#include "rsvg-shapes.h"
......@@ -391,13 +390,6 @@ rsvg_text_render_text (RsvgDrawingCtx *ctx,
gdouble *x,
gdouble *y);
ArtSVP *
rsvg_text_render_text_as_svp (RsvgDrawingCtx *ctx,
RsvgTspan *tspan,
const char *text,
gdouble *x,
gdouble *y);
static gdouble
rsvg_text_width (RsvgDrawingCtx *ctx,
RsvgTspan *tspan,
......@@ -492,67 +484,6 @@ rsvg_tspan_draw(RsvgTspan * self, RsvgDrawingCtx *ctx, gdouble *x, gdouble *y, i
}
}
static ArtSVP *
rsvg_tspan_draw_as_svp(RsvgTspan * self, RsvgDrawingCtx *ctx, gdouble *x, gdouble *y, int dominate);
static ArtSVP *
rsvg_tchunk_draw_as_svp(RsvgTChunk * self, RsvgDrawingCtx *ctx, RsvgTspan *span, gdouble *x, gdouble *y)
{
if (self->string)
return rsvg_text_render_text_as_svp (ctx, span, self->string->str, x, y);
if (self->span)
{
ArtSVP * output;
rsvg_state_push(ctx);
output = rsvg_tspan_draw_as_svp (self->span, ctx, x, y, 0);
rsvg_state_pop(ctx);
return output;
}
return NULL;
}
/*todo: remove unnesicary code duplication*/
static ArtSVP *
rsvg_tspan_draw_as_svp(RsvgTspan * self, RsvgDrawingCtx *ctx, gdouble *x, gdouble *y, int dominate)
{
unsigned int i;
ArtSVP *svp1, *svp2, *svp3;
svp1 = NULL;
rsvg_state_reinherit_top(ctx, &self->state, dominate);
if (self->hasx || self->hasy)
{
switch (rsvg_state_current(ctx)->text_anchor)
{
case TEXT_ANCHOR_START:
*x = self->x;
break;
case TEXT_ANCHOR_MIDDLE:
*x = self->x - rsvg_text_tspan_width (ctx, self) / 2;
break;
case TEXT_ANCHOR_END:
*x = self->x - rsvg_text_tspan_width (ctx, self);
break;
}
*y = self->y;
}
for (i = 0; i < self->contents->len; i++) {
svp2 = rsvg_tchunk_draw_as_svp (g_ptr_array_index(self->contents, i), ctx, self, x, y);
if (svp1 != NULL)
{
svp3 = art_svp_union(svp2, svp1);
art_free(svp1);
svp1 = svp3;
}