From 3d9a1198db571973e2760d6f27c771cbe31c844b Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Wed, 22 Feb 2006 01:58:19 +0000 Subject: [project @ 2006-02-22 01:58:19 by rjw] Reduce constant bitmap overhead per reference by moving to a flag word. Allow bitmaps to be reduced back to their raw data to free extra memory in a highly efficient manner. svn path=/import/netsurf/; revision=2089 --- image/bitmap.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'image/bitmap.h') diff --git a/image/bitmap.h b/image/bitmap.h index c187b3ecb..bae1e1a15 100644 --- a/image/bitmap.h +++ b/image/bitmap.h @@ -20,18 +20,20 @@ #include #include -typedef enum { - BITMAP_READY, /** Bitmap buffer is ready */ - BITMAP_ALLOCATE_MEMORY, /** Allocate memory */ - BITMAP_CLEAR_MEMORY, /** Clear the memory */ -} bitmap_state; +#define BITMAP_NEW 0 +#define BITMAP_OPAQUE (1 << 0) /** image is opaque */ +#define BITMAP_MODIFIED (1 << 1) /** buffer has been modified */ +#define BITMAP_PERSISTENT (1 << 2) /** retain between sessions */ +#define BITMAP_CLEAR_MEMORY (1 << 3) /** memory should be wiped */ +#define BITMAP_SUSPENDED (1 << 4) /** currently suspended */ +#define BITMAP_READY (1 << 5) /** fully initialised */ struct content; /** An opaque image. */ struct bitmap; -struct bitmap *bitmap_create(int width, int height, bitmap_state state); +struct bitmap *bitmap_create(int width, int height, unsigned int state); void bitmap_set_opaque(struct bitmap *bitmap, bool opaque); bool bitmap_test_opaque(struct bitmap *bitmap); bool bitmap_get_opaque(struct bitmap *bitmap); @@ -40,5 +42,7 @@ size_t bitmap_get_rowstride(struct bitmap *bitmap); void bitmap_destroy(struct bitmap *bitmap); bool bitmap_save(struct bitmap *bitmap, const char *path); void bitmap_modified(struct bitmap *bitmap); +void bitmap_set_suspendable(struct bitmap *bitmap, void *private_word, + void (*invalidate)(struct bitmap *bitmap, void *private_word)); #endif -- cgit v1.2.3