diff options
Diffstat (limited to 'content/handlers/image/svg.c')
-rw-r--r-- | content/handlers/image/svg.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c index 2edc7bd08..895d799df 100644 --- a/content/handlers/image/svg.c +++ b/content/handlers/image/svg.c @@ -30,9 +30,11 @@ #include "utils/messages.h" #include "utils/utils.h" +#include "utils/nsurl.h" #include "netsurf/plotters.h" #include "netsurf/content.h" #include "content/content_protected.h" +#include "content/content_factory.h" #include "image/svg.h" @@ -59,7 +61,7 @@ static nserror svg_create_svg_data(svg_content *c) return NSERROR_OK; no_memory: - content_broadcast_errorcode(&c->base, NSERROR_NOMEM); + content_broadcast_error(&c->base, NSERROR_NOMEM, NULL); return NSERROR_NOMEM; } @@ -126,8 +128,8 @@ static bool svg_convert(struct content *c) static void svg_reformat(struct content *c, int width, int height) { svg_content *svg = (svg_content *) c; - const char *source_data; - unsigned long source_size; + const uint8_t *source_data; + size_t source_size; assert(svg->diagram); @@ -135,9 +137,12 @@ static void svg_reformat(struct content *c, int width, int height) if (width != svg->current_width || height != svg->current_height) { source_data = content__get_source_data(c, &source_size); - svgtiny_parse(svg->diagram, source_data, source_size, - nsurl_access(content_get_url(c)), - width, height); + svgtiny_parse(svg->diagram, + (const char *)source_data, + source_size, + nsurl_access(content_get_url(c)), + width, + height); svg->current_width = width; svg->current_height = height; @@ -188,14 +193,15 @@ svg_redraw_internal(struct content *c, for (i = 0; i != diagram->shape_count; i++) { if (diagram->shape[i].path) { + pstyle.stroke_width = plot_style_int_to_fixed( + diagram->shape[i].stroke_width); pstyle.stroke_colour = BGR(diagram->shape[i].stroke); pstyle.fill_colour = BGR(diagram->shape[i].fill); res = ctx->plot->path(ctx, - &pstyle, - diagram->shape[i].path, - diagram->shape[i].path_length, - diagram->shape[i].stroke_width, - transform); + &pstyle, + diagram->shape[i].path, + diagram->shape[i].path_length, + transform); if (res != NSERROR_OK) { return false; } @@ -210,7 +216,7 @@ svg_redraw_internal(struct content *c, fstyle.background = 0xffffff; fstyle.foreground = 0x000000; - fstyle.size = (8 * FONT_SIZE_SCALE) * scale; + fstyle.size = (8 * PLOT_STYLE_SCALE) * scale; res = ctx->plot->text(ctx, &fstyle, @@ -221,7 +227,7 @@ svg_redraw_internal(struct content *c, return false; } } - } + } #undef BGR @@ -360,5 +366,3 @@ static const char *svg_types[] = { CONTENT_FACTORY_REGISTER_TYPES(svg, svg_types, svg_content_handler); - - |