Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/e6b827979b3bb28a82101...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/e6b827979b3bb28a82101fe...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/e6b827979b3bb28a82101fe12...
The branch, master has been updated
via e6b827979b3bb28a82101fe1211c809af112e987 (commit)
from b002ba73578c2d3bdb230c17ff474487c767f827 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e6b827979b3bb28a821...
commit e6b827979b3bb28a82101fe1211c809af112e987
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Allocate bitmap structures using an itempool
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 986f426..28c229b 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 = {
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index aba3597..78d6c0d 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -55,6 +55,11 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
/**
+ * Cleanup bitmap allocations
+ */
+void ami_bitmap_fini(void);
+
+/**
* Create a bitmap.
*
* \param width width of image in pixels
diff --git a/amiga/gui.c b/amiga/gui.c
index c73f0d1..c7f920f 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5681,6 +5681,7 @@ int main(int argc, char** argv)
FreeSysObject(ASOT_PORT, schedulermsgport);
ami_object_fini();
+ ami_bitmap_fini();
ami_libs_close();
return RETURN_OK;
-----------------------------------------------------------------------
Summary of changes:
amiga/bitmap.c | 15 ++++++++++++---
amiga/bitmap.h | 5 +++++
amiga/gui.c | 1 +
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 986f426..28c229b 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 = {
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index aba3597..78d6c0d 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -55,6 +55,11 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
/**
+ * Cleanup bitmap allocations
+ */
+void ami_bitmap_fini(void);
+
+/**
* Create a bitmap.
*
* \param width width of image in pixels
diff --git a/amiga/gui.c b/amiga/gui.c
index c73f0d1..c7f920f 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5681,6 +5681,7 @@ int main(int argc, char** argv)
FreeSysObject(ASOT_PORT, schedulermsgport);
ami_object_fini();
+ ami_bitmap_fini();
ami_libs_close();
return RETURN_OK;
--
NetSurf Browser