From e6b827979b3bb28a82101fe1211c809af112e987 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 29 Jan 2016 19:39:37 +0000 Subject: Allocate bitmap structures using an itempool --- amiga/bitmap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'amiga/bitmap.c') diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 986f4261f..28c229b06 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -52,13 +52,16 @@ enum { AMI_NSBM_PALETTEMAPPED }; +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 = AllocVecTagList(sizeof(struct bitmap), NULL); + + if(pool_bitmap == NULL) pool_bitmap = ami_misc_itempool_create(sizeof(struct bitmap)); + + 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); @@ -128,7 +131,7 @@ void amiga_bitmap_destroy(void *bitmap) bm->native_mask = NULL; bm->dto = NULL; - FreeVec(bm); + ami_misc_itempool_free(pool_bitmap, bm, sizeof(struct bitmap)); bm = NULL; } } @@ -557,6 +560,12 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap, } } +void ami_bitmap_fini(void) +{ + if(pool_bitmap) ami_misc_itempool_delete(pool_bitmap); + pool_bitmap = NULL; +} + static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content) { struct redraw_context ctx = { -- cgit v1.2.3