summaryrefslogtreecommitdiff
path: root/riscos/bitmap.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2005-04-29 01:35:52 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2005-04-29 01:35:52 +0000
commitec9db1d6af76c053f5e1c746057554e0b0dbcc9b (patch)
treeaee18fe5928493c31f36d99a609fac8052b66289 /riscos/bitmap.c
parent683892f9db54d0bdc2380dba12682df4f282b4b5 (diff)
downloadnetsurf-ec9db1d6af76c053f5e1c746057554e0b0dbcc9b.tar.gz
netsurf-ec9db1d6af76c053f5e1c746057554e0b0dbcc9b.tar.bz2
[project @ 2005-04-29 01:35:52 by rjw]
Only initialise canvases if we need to. svn path=/import/netsurf/; revision=1699
Diffstat (limited to 'riscos/bitmap.c')
-rw-r--r--riscos/bitmap.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/riscos/bitmap.c b/riscos/bitmap.c
index 7bdf1bde4..2f2416550 100644
--- a/riscos/bitmap.c
+++ b/riscos/bitmap.c
@@ -29,10 +29,11 @@
*
* \param width width of image in pixels
* \param height width of image in pixels
+ * \param clear whether to clear the image ready for use
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
-struct bitmap *bitmap_create(int width, int height)
+struct bitmap *bitmap_create(int width, int height, bool clear)
{
unsigned int area_size;
struct bitmap *bitmap;
@@ -43,7 +44,10 @@ struct bitmap *bitmap_create(int width, int height)
return NULL;
area_size = 16 + 44 + width * height * 4;
- bitmap = calloc(sizeof(struct bitmap) + area_size, 1);
+ if (clear)
+ bitmap = calloc(sizeof(struct bitmap) + area_size, 1);
+ else
+ bitmap = malloc(sizeof(struct bitmap) + area_size);
if (!bitmap)
return NULL;
@@ -61,7 +65,8 @@ struct bitmap *bitmap_create(int width, int height)
/* sprite control block */
sprite = (osspriteop_header *) (sprite_area + 1);
sprite->size = area_size - 16;
-/* memset(sprite->name, 0x00, 12); */
+ if (!clear)
+ memset(sprite->name, 0x00, 12);
strncpy(sprite->name, "bitmap", 12);
sprite->width = width - 1;
sprite->height = height - 1;