summaryrefslogtreecommitdiff
path: root/amiga/bitmap.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-01-21 20:42:49 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-01-21 20:42:49 +0000
commitb41685208f25a906b8a08809e67c2a1a2ec153d9 (patch)
tree242bf836618e5de28240d7848998bf26e8c2d36b /amiga/bitmap.c
parent0cc19b10fcd9f43bb4c9d83654d2d07cad139b12 (diff)
downloadnetsurf-b41685208f25a906b8a08809e67c2a1a2ec153d9.tar.gz
netsurf-b41685208f25a906b8a08809e67c2a1a2ec153d9.tar.bz2
Revert "alloc bitmap structures using itempools"
This reverts commit 0cc19b10fcd9f43bb4c9d83654d2d07cad139b12. This caused memory leakage, as the memory pool is removed before the core has destroyed all the bitmaps.
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r--amiga/bitmap.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 5ba74020c..6984d3e0c 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -44,28 +44,21 @@
#include "amiga/misc.h"
#include "amiga/rtg.h"
-static APTR pool_bitmap = NULL;
-
/* exported function documented in amiga/bitmap.h */
void *amiga_bitmap_create(int width, int height, unsigned int state)
{
struct bitmap *bitmap;
+
+ bitmap = ami_misc_allocvec_clear(sizeof(struct bitmap), 0);
+ if(bitmap)
+ {
+ bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
+ bitmap->width = width;
+ bitmap->height = height;
- bitmap = ami_misc_itempool_alloc(pool_bitmap, sizeof(struct bitmap));
- if(bitmap == NULL) return NULL;
-
- bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
- bitmap->width = width;
- bitmap->height = height;
-
- if(state & BITMAP_OPAQUE) bitmap->opaque = true;
- else bitmap->opaque = false;
-
- bitmap->nativebm = NULL;
- bitmap->nativebmwidth = 0;
- bitmap->nativebmheight = 0;
- bitmap->native_mask = NULL;
- bitmap->dto = NULL;
+ if(state & BITMAP_OPAQUE) bitmap->opaque = true;
+ else bitmap->opaque = false;
+ }
return bitmap;
}
@@ -116,7 +109,7 @@ void amiga_bitmap_destroy(void *bitmap)
bm->native_mask = NULL;
bm->dto = NULL;
- ami_misc_itempool_free(pool_bitmap, bm, sizeof(struct bitmap));
+ FreeVec(bm);
bm = NULL;
}
}
@@ -589,20 +582,6 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
return NSERROR_OK;
}
-void amiga_bitmap_fini(void)
-{
- if(pool_bitmap) ami_misc_itempool_delete(pool_bitmap);
-}
-
-bool amiga_bitmap_init(void)
-{
- if((pool_bitmap = ami_misc_itempool_create(sizeof(struct bitmap)))) {
- return true;
- } else {
- return false;
- }
-}
-
static struct gui_bitmap_table bitmap_table = {
.create = amiga_bitmap_create,
.destroy = amiga_bitmap_destroy,