summaryrefslogtreecommitdiff
path: root/riscos/draw.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-06-10 20:41:26 +0000
committerJames Bursa <james@netsurf-browser.org>2004-06-10 20:41:26 +0000
commit08177fa58119f9e67fdffb32ee20dbf05bd4fa78 (patch)
treedaa1124c9304e218045d12b9d531bd35e3a51565 /riscos/draw.c
parentff5e70f86538bfd5a08a0ebbb7bc484ae9b841e6 (diff)
downloadnetsurf-08177fa58119f9e67fdffb32ee20dbf05bd4fa78.tar.gz
netsurf-08177fa58119f9e67fdffb32ee20dbf05bd4fa78.tar.bz2
[project @ 2004-06-10 20:41:26 by bursa]
Add global content list. Better error handling in content code. Improved code documentation. Remove some obsolete functions. Implement debug window listing contents. svn path=/import/netsurf/; revision=951
Diffstat (limited to 'riscos/draw.c')
-rw-r--r--riscos/draw.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/riscos/draw.c b/riscos/draw.c
index b59a96261..fbe4251cf 100644
--- a/riscos/draw.c
+++ b/riscos/draw.c
@@ -18,56 +18,47 @@
#ifdef WITH_DRAW
-int draw_convert(struct content *c, unsigned int width, unsigned int height)
+bool draw_convert(struct content *c, int width, int height)
{
+ union content_msg_data msg_data;
+ os_box bbox;
os_error *error;
- os_trfm *matrix = xcalloc(1, sizeof(os_trfm));
- os_box *bbox = xcalloc(1, sizeof(os_box));
-
- /* Full size image (1:1) */
- matrix->entries[0][0] = 1 << 16;
- matrix->entries[0][1] = 0;
- matrix->entries[1][0] = 0;
- matrix->entries[1][1] = 1 << 16;
- matrix->entries[2][0] = 0;
- matrix->entries[2][1] = 0;
/* BBox contents in Draw units (256*OS unit) */
error = xdrawfile_bbox(0, (drawfile_diagram*)(c->source_data),
- (int)c->source_size, matrix, bbox);
-
+ (int) c->source_size, 0, &bbox);
if (error) {
- LOG(("error: %s", error->errmess));
- xfree(matrix);
- xfree(bbox);
- return 1;
+ LOG(("xdrawfile_bbox: 0x%x: %s",
+ error->errnum, error->errmess));
+ msg_data.error = error->errmess;
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ return false;
}
/* c->width & c->height stored as (OS units/2)
=> divide by 512 to convert from draw units */
- c->width = ((bbox->x1 - bbox->x0) / 512);
- c->height = ((bbox->y1 - bbox->y0) / 512);
- c->data.draw.x0 = bbox->x0 / 2;
- c->data.draw.y0 = bbox->y0 / 2;
- c->title = xcalloc(100, 1);
- sprintf(c->title, messages_get("DrawTitle"), c->width,
+ c->width = ((bbox.x1 - bbox.x0) / 512);
+ c->height = ((bbox.y1 - bbox.y0) / 512);
+ c->data.draw.x0 = bbox.x0 / 2;
+ c->data.draw.y0 = bbox.y0 / 2;
+ c->title = malloc(100);
+ if (c->title)
+ snprintf(c->title, 100, messages_get("DrawTitle"), c->width,
c->height, c->source_size);
c->status = CONTENT_STATUS_DONE;
- xfree(matrix);
- xfree(bbox);
- return 0;
+ return true;
}
void draw_destroy(struct content *c)
{
- xfree(c->title);
+ free(c->title);
}
-void draw_redraw(struct content *c, long x, long y,
- unsigned long width, unsigned long height,
- long clip_x0, long clip_y0, long clip_x1, long clip_y1,
+void 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)
{
os_trfm matrix;