From ec9db1d6af76c053f5e1c746057554e0b0dbcc9b Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Fri, 29 Apr 2005 01:35:52 +0000 Subject: [project @ 2005-04-29 01:35:52 by rjw] Only initialise canvases if we need to. svn path=/import/netsurf/; revision=1699 --- image/bitmap.h | 2 +- image/gifread.c | 4 ++-- image/jpeg.c | 2 +- image/mng.c | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'image') diff --git a/image/bitmap.h b/image/bitmap.h index 9d442c214..1e68761b3 100644 --- a/image/bitmap.h +++ b/image/bitmap.h @@ -25,7 +25,7 @@ struct content; /** An opaque image. */ struct bitmap; -struct bitmap *bitmap_create(int width, int height); +struct bitmap *bitmap_create(int width, int height, bool clear); void bitmap_set_opaque(struct bitmap *bitmap, bool opaque); bool bitmap_test_opaque(struct bitmap *bitmap); bool bitmap_get_opaque(struct bitmap *bitmap); diff --git a/image/gifread.c b/image/gifread.c index fc49bfcb7..80ea97d24 100644 --- a/image/gifread.c +++ b/image/gifread.c @@ -202,7 +202,7 @@ int gif_initialise(struct gif_animation *gif) { /* Initialise the sprite header */ - if ((gif->frame_image = bitmap_create(gif->width, gif->height)) == NULL) { + if ((gif->frame_image = bitmap_create(gif->width, gif->height, false)) == NULL) { gif_finalise(gif); return GIF_INSUFFICIENT_MEMORY; } @@ -280,7 +280,7 @@ static int gif_initialise_sprite(struct gif_animation *gif, unsigned int width, /* Allocate some more memory */ - if ((buffer = bitmap_create(max_width, max_height)) == NULL) + if ((buffer = bitmap_create(max_width, max_height, false)) == NULL) return GIF_INSUFFICIENT_MEMORY; bitmap_destroy(gif->frame_image); gif->frame_image = buffer; diff --git a/image/jpeg.c b/image/jpeg.c index 7f57d62b2..0482aa912 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -94,7 +94,7 @@ bool nsjpeg_convert(struct content *c, int w, int h) width = cinfo.output_width; height = cinfo.output_height; - bitmap = bitmap_create(width, height); + bitmap = bitmap_create(width, height, false); if (!bitmap) { jpeg_destroy_decompress(&cinfo); diff --git a/image/mng.c b/image/mng.c index c19873283..fadd6a3af 100644 --- a/image/mng.c +++ b/image/mng.c @@ -188,7 +188,7 @@ mng_bool nsmng_processheader(mng_handle mng, mng_uint32 width, mng_uint32 height LOG(("processing header (%p) %d, %d", c, width, height)); - c->bitmap = bitmap_create(width, height); + c->bitmap = bitmap_create(width, height, false); if (!c->bitmap) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); @@ -297,6 +297,9 @@ bool nsmng_convert(struct content *c, int width, int height) { /* Optimise the plotting of JNG/PNGs */ c->data.mng.opaque_test_pending = (c->type == CONTENT_PNG) || (c->type == CONTENT_JNG); + if (c->data.mng.opaque_test_pending) + bitmap_set_opaque(c->bitmap, false); + return true; } -- cgit v1.2.3