From eddae6af0663243a2677674d501f9a87d55798f5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 30 Jun 2011 15:48:07 +0000 Subject: Remove plotter table global. Pass a redraw context around redraw functions. Knockout could be handled better. Note: untested on most front ends. svn path=/trunk/netsurf/; revision=12543 --- image/svg.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'image/svg.c') diff --git a/image/svg.c b/image/svg.c index d53013033..cc1762ddb 100644 --- a/image/svg.c +++ b/image/svg.c @@ -52,7 +52,7 @@ static bool svg_convert(struct content *c); static void svg_destroy(struct content *c); static void svg_reformat(struct content *c, int width, int height); static bool svg_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip); + const struct rect *clip, const struct redraw_context *ctx); static nserror svg_clone(const struct content *old, struct content **newc); static content_type svg_content_type(lwc_string *mime_type); @@ -217,7 +217,8 @@ void svg_reformat(struct content *c, int width, int height) static bool svg_redraw_internal(struct content *c, int x, int y, int width, int height, const struct rect *clip, - float scale, colour background_colour) + const struct redraw_context *ctx, float scale, + colour background_colour) { svg_content *svg = (svg_content *) c; float transform[6]; @@ -243,7 +244,7 @@ static bool svg_redraw_internal(struct content *c, int x, int y, for (i = 0; i != diagram->shape_count; i++) { if (diagram->shape[i].path) { - ok = plot.path(diagram->shape[i].path, + ok = ctx->plot->path(diagram->shape[i].path, diagram->shape[i].path_length, BGR(diagram->shape[i].fill), diagram->shape[i].stroke_width, @@ -264,7 +265,7 @@ static bool svg_redraw_internal(struct content *c, int x, int y, fstyle.foreground = 0x000000; fstyle.size = (8 * FONT_SIZE_SCALE) * scale; - ok = plot.text(px, py, + ok = ctx->plot->text(px, py, diagram->shape[i].text, strlen(diagram->shape[i].text), &fstyle); @@ -284,7 +285,7 @@ static bool svg_redraw_internal(struct content *c, int x, int y, */ bool svg_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { int x = data->x; int y = data->y; @@ -297,8 +298,10 @@ bool svg_redraw(struct content *c, struct content_redraw_data *data, if ((data->repeat_x == false) && (data->repeat_y == false)) { /* Simple case: SVG is not tiled */ - return svg_redraw_internal(c, x, y, data->width, data->height, - clip, data->scale, data->background_colour); + return svg_redraw_internal(c, x, y, + data->width, data->height, + clip, ctx, data->scale, + data->background_colour); } else { /* Tiled redraw required. SVG repeats to extents of clip * rectangle, in x, y or both directions */ @@ -325,7 +328,7 @@ bool svg_redraw(struct content *c, struct content_redraw_data *data, for (x = x0; x < x1; x += data->width) { if (!svg_redraw_internal(c, x, y, data->width, data->height, - clip, data->scale, + clip, ctx, data->scale, data->background_colour)) { return false; } -- cgit v1.2.3