From 8fdd91bc93574f7260181fa1f7197b58ce243481 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 5 Apr 2010 22:03:44 +0000 Subject: Port to new content API svn path=/trunk/netsurf/; revision=10246 --- riscos/draw.c | 31 +++++++++++++++++++++---------- riscos/draw.h | 3 ++- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'riscos') diff --git a/riscos/draw.c b/riscos/draw.c index f1a2b04c0..66f2c0c1d 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -30,7 +30,7 @@ #include "oslib/drawfile.h" #include "utils/config.h" #include "desktop/plotters.h" -#include "content/content.h" +#include "content/content_protected.h" #include "riscos/draw.h" #include "riscos/gui.h" #include "utils/utils.h" @@ -44,16 +44,22 @@ * bounding box bottom-left. */ -bool draw_convert(struct content *c, int width, int height) +bool draw_convert(struct content *c) { union content_msg_data msg_data; + const char *source_data; + unsigned long source_size; + const void *data; os_box bbox; - void *data = c->source_data; os_error *error; + char title[100]; + + source_data = content__get_source_data(c, &source_size); + data = source_data; /* BBox contents in Draw units (256*OS unit) */ error = xdrawfile_bbox(0, (drawfile_diagram *) data, - (int) c->source_size, 0, &bbox); + (int) source_size, 0, &bbox); if (error) { LOG(("xdrawfile_bbox: 0x%x: %s", error->errnum, error->errmess)); @@ -74,10 +80,10 @@ bool draw_convert(struct content *c, int width, int height) c->data.draw.x0 = bbox.x0; c->data.draw.y0 = bbox.y0; - c->title = malloc(100); - if (c->title) - snprintf(c->title, 100, messages_get("DrawTitle"), c->width, - c->height, c->source_size); + snprintf(title, sizeof(title), messages_get("DrawTitle"), c->width, + c->height, source_size); + content__set_title(c, title); + c->status = CONTENT_STATUS_DONE; /* Done: update status bar */ content_set_status(c, ""); @@ -105,7 +111,9 @@ bool draw_redraw(struct content *c, int x, int y, float scale, colour background_colour) { os_trfm matrix; - void *data = c->source_data; + const char *source_data; + unsigned long source_size; + const void *data; os_error *error; if (plot.flush && !plot.flush()) @@ -114,6 +122,9 @@ bool draw_redraw(struct content *c, int x, int y, if (!c->width || !c->height) return false; + source_data = content__get_source_data(c, &source_size); + data = source_data; + /* Scaled image. Transform units (65536*OS units) */ matrix.entries[0][0] = width * 65536 / c->width; matrix.entries[0][1] = 0; @@ -126,7 +137,7 @@ bool draw_redraw(struct content *c, int x, int y, c->data.draw.y0 * height / c->height; error = xdrawfile_render(0, (drawfile_diagram *) data, - (int) c->source_size, &matrix, 0, 0); + (int) source_size, &matrix, 0, 0); if (error) { LOG(("xdrawfile_render: 0x%x: %s", error->errnum, error->errmess)); diff --git a/riscos/draw.h b/riscos/draw.h index a55058767..854772e17 100644 --- a/riscos/draw.h +++ b/riscos/draw.h @@ -34,12 +34,13 @@ struct content_draw_data { int x0, y0; }; -bool draw_convert(struct content *c, int width, int height); +bool draw_convert(struct content *c); void draw_destroy(struct content *c); bool draw_redraw(struct content *c, int x, int y, int width, int height, int clip_x0, int clip_y0, int clip_x1, int clip_y1, float scale, colour background_colour); +bool draw_clone(const struct content *old, struct content *new_content); #endif /* WITH_DRAW */ -- cgit v1.2.3