diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-06-30 15:48:07 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-06-30 15:48:07 +0000 |
commit | eddae6af0663243a2677674d501f9a87d55798f5 (patch) | |
tree | 08562171f870a6b592d624adfbfd0d6fa11fcdcb /image | |
parent | a5dc6b9e6637c85d18510ac6446ee4a8a7955e7b (diff) | |
download | netsurf-eddae6af0663243a2677674d501f9a87d55798f5.tar.gz netsurf-eddae6af0663243a2677674d501f9a87d55798f5.tar.bz2 |
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
Diffstat (limited to 'image')
-rw-r--r-- | image/bmp.c | 4 | ||||
-rw-r--r-- | image/gif.c | 4 | ||||
-rw-r--r-- | image/ico.c | 4 | ||||
-rw-r--r-- | image/jpeg.c | 5 | ||||
-rw-r--r-- | image/mng.c | 6 | ||||
-rw-r--r-- | image/nssprite.c | 6 | ||||
-rw-r--r-- | image/png.c | 4 | ||||
-rw-r--r-- | image/rsvg.c | 4 | ||||
-rw-r--r-- | image/svg.c | 19 | ||||
-rw-r--r-- | image/webp.c | 6 |
10 files changed, 33 insertions, 29 deletions
diff --git a/image/bmp.c b/image/bmp.c index d209621ba..816884e83 100644 --- a/image/bmp.c +++ b/image/bmp.c @@ -198,7 +198,7 @@ static bool nsbmp_convert(struct content *c) } static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { nsbmp_content *bmp = (nsbmp_content *) c; bitmap_flags_t flags = BITMAPF_NONE; @@ -214,7 +214,7 @@ static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } diff --git a/image/gif.c b/image/gif.c index 0a3dccf31..38ba03dda 100644 --- a/image/gif.c +++ b/image/gif.c @@ -339,7 +339,7 @@ static gif_result nsgif_get_frame(struct content *c) } static bool nsgif_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { nsgif_content *gif = (nsgif_content *) c; bitmap_flags_t flags = BITMAPF_NONE; @@ -358,7 +358,7 @@ static bool nsgif_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } diff --git a/image/ico.c b/image/ico.c index a64f76e70..cae5e07f5 100644 --- a/image/ico.c +++ b/image/ico.c @@ -158,7 +158,7 @@ static bool nsico_convert(struct content *c) static bool nsico_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { nsico_content *ico = (nsico_content *) c; struct bmp_image *bmp = ico_find(ico->ico, data->width, data->height); @@ -175,7 +175,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } diff --git a/image/jpeg.c b/image/jpeg.c index 544840241..58fb43e22 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -39,6 +39,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/talloc.h" +#include "utils/types.h" #include "utils/utils.h" #define JPEG_INTERNAL_OPTIONS @@ -278,7 +279,7 @@ static void nsjpeg_destroy(struct content *c) * Redraw a CONTENT_JPEG with appropriate tiling. */ static bool nsjpeg_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { bitmap_flags_t flags = BITMAPF_NONE; @@ -287,7 +288,7 @@ static bool nsjpeg_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } diff --git a/image/mng.c b/image/mng.c index 731f5f14e..0ba084f6a 100644 --- a/image/mng.c +++ b/image/mng.c @@ -68,7 +68,7 @@ static bool nsmng_process_data(struct content *c, const char *data, static bool nsmng_convert(struct content *c); static void nsmng_destroy(struct content *c); static bool nsmng_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip); + const struct rect *clip, const struct redraw_context *ctx); static nserror nsmng_clone(const struct content *old, struct content **newc); static content_type nsmng_content_type(lwc_string *mime_type); @@ -686,7 +686,7 @@ void nsmng_destroy(struct content *c) bool nsmng_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { nsmng_content *mng = (nsmng_content *) c; bool ret; @@ -705,7 +705,7 @@ bool nsmng_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - ret = plot.bitmap(data->x, data->y, data->width, data->height, + ret = ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); /* Check if we need to restart the animation diff --git a/image/nssprite.c b/image/nssprite.c index 0eff2a148..3282e821b 100644 --- a/image/nssprite.c +++ b/image/nssprite.c @@ -51,7 +51,7 @@ static nserror nssprite_create(const content_handler *handler, static bool nssprite_convert(struct content *c); static void nssprite_destroy(struct content *c); static bool nssprite_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip); + const struct rect *clip, const struct redraw_context *ctx); static nserror nssprite_clone(const struct content *old, struct content **newc); static content_type nssprite_content_type(lwc_string *mime_type); @@ -239,7 +239,7 @@ void nssprite_destroy(struct content *c) */ bool nssprite_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { bitmap_flags_t flags = BITMAPF_NONE; @@ -248,7 +248,7 @@ bool nssprite_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } diff --git a/image/png.c b/image/png.c index a0475aa2f..57cd50146 100644 --- a/image/png.c +++ b/image/png.c @@ -363,7 +363,7 @@ static void nspng_destroy(struct content *c) static bool nspng_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { nspng_content *png_c = (nspng_content *) c; bitmap_flags_t flags = BITMAPF_NONE; @@ -375,7 +375,7 @@ static bool nspng_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, png_c->bitmap, data->background_colour, flags); } diff --git a/image/rsvg.c b/image/rsvg.c index 39bec0190..5af3c1bc2 100644 --- a/image/rsvg.c +++ b/image/rsvg.c @@ -230,7 +230,7 @@ static bool rsvg_convert(struct content *c) } static bool rsvg_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { bitmap_flags_t flags = BITMAPF_NONE; @@ -241,7 +241,7 @@ static bool rsvg_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } 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; } diff --git a/image/webp.c b/image/webp.c index 8702b0a3b..cabd40a3f 100644 --- a/image/webp.c +++ b/image/webp.c @@ -48,7 +48,7 @@ static nserror webp_create(const content_handler *handler, static bool webp_convert(struct content *c); static void webp_destroy(struct content *c); static bool webp_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip); + const struct rect *clip, const struct redraw_context *ctx); static nserror webp_clone(const struct content *old, struct content **newc); static content_type webp_content_type(lwc_string *mime_type); @@ -212,7 +212,7 @@ void webp_destroy(struct content *c) */ bool webp_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip) + const struct rect *clip, const struct redraw_context *ctx) { bitmap_flags_t flags = BITMAPF_NONE; @@ -221,7 +221,7 @@ bool webp_redraw(struct content *c, struct content_redraw_data *data, if (data->repeat_y) flags |= BITMAPF_REPEAT_Y; - return plot.bitmap(data->x, data->y, data->width, data->height, + return ctx->plot->bitmap(data->x, data->y, data->width, data->height, c->bitmap, data->background_colour, flags); } |