From 70c7b81c2fd459c87697216b69c2bd17e5d3086c Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 1 Jun 2008 00:15:53 +0000 Subject: Improve MNG error handling to show error code. Fix code not expecting bitmap_get_buffer() to return 0. svn path=/trunk/netsurf/; revision=4237 --- riscos/plotters.c | 18 ++++++++++++++++-- riscos/save_draw.c | 11 ++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'riscos') diff --git a/riscos/plotters.c b/riscos/plotters.c index da890abad..3650e2246 100644 --- a/riscos/plotters.c +++ b/riscos/plotters.c @@ -498,7 +498,14 @@ bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c) bool ro_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg) { - bitmap_get_buffer(bitmap); + char *buffer; + + buffer = bitmap_get_buffer(bitmap); + if (!buffer) { + LOG(("bitmap_get_buffer failed")); + return false; + } + return image_redraw(bitmap->sprite_area, ro_plot_origin_x + x * 2, ro_plot_origin_y - y * 2, @@ -516,7 +523,14 @@ bool ro_plot_bitmap_tile(int x, int y, int width, int height, struct bitmap *bitmap, colour bg, bool repeat_x, bool repeat_y) { - bitmap_get_buffer(bitmap); + char *buffer; + + buffer = bitmap_get_buffer(bitmap); + if (!buffer) { + LOG(("bitmap_get_buffer failed")); + return false; + } + return image_redraw(bitmap->sprite_area, ro_plot_origin_x + x * 2, ro_plot_origin_y - y * 2, diff --git a/riscos/save_draw.c b/riscos/save_draw.c index 8d1e812b0..5df1c0089 100644 --- a/riscos/save_draw.c +++ b/riscos/save_draw.c @@ -47,7 +47,7 @@ static bool ro_save_draw_path(float *p, unsigned int n, colour fill, static bool ro_save_draw_fill(int x0, int y0, int x1, int y1, colour c); static bool ro_save_draw_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1); -static bool ro_save_draw_text(int x, int y, struct css_style *style, +static bool ro_save_draw_text(int x, int y, const struct css_style *style, const char *text, size_t length, colour bg, colour c); static bool ro_save_draw_disc(int x, int y, int radius, colour colour, bool filled); @@ -346,7 +346,7 @@ bool ro_save_draw_clip(int clip_x0, int clip_y0, } -bool ro_save_draw_text(int x, int y, struct css_style *style, +bool ro_save_draw_text(int x, int y, const struct css_style *style, const char *text, size_t length, colour bg, colour c) { pencil_code code; @@ -380,8 +380,13 @@ bool ro_save_draw_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg) { pencil_code code; + char *buffer; - bitmap_get_buffer(bitmap); + buffer = bitmap_get_buffer(bitmap); + if (!buffer) { + warn_user("NoMemory", 0); + return false; + } code = pencil_sprite(ro_save_draw_diagram, x * 2, (-y - height) * 2, width * 2, height * 2, -- cgit v1.2.3