summaryrefslogtreecommitdiff
path: root/frontends/riscos
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-03-24 18:09:28 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2022-03-24 18:09:28 +0000
commit002c3c1a7c2ae7229afac3f1966892fd42895aec (patch)
treebc9c769b176981296b5e92233fd623b3164a4513 /frontends/riscos
parentc2d72d1e9361b3017872e5aff16cfe9a894f3048 (diff)
downloadnetsurf-002c3c1a7c2ae7229afac3f1966892fd42895aec.tar.gz
netsurf-002c3c1a7c2ae7229afac3f1966892fd42895aec.tar.bz2
Bitmap API: Clean up creation flags.
Diffstat (limited to 'frontends/riscos')
-rw-r--r--frontends/riscos/bitmap.c14
-rw-r--r--frontends/riscos/bitmap.h9
-rw-r--r--frontends/riscos/save.c2
-rw-r--r--frontends/riscos/window.c2
4 files changed, 13 insertions, 14 deletions
diff --git a/frontends/riscos/bitmap.c b/frontends/riscos/bitmap.c
index e724d443f..3454c66e5 100644
--- a/frontends/riscos/bitmap.c
+++ b/frontends/riscos/bitmap.c
@@ -91,7 +91,7 @@ static bool bitmap_initialise(struct bitmap *bitmap)
assert(!bitmap->sprite_area);
area_size = 16 + 44 + bitmap->width * bitmap->height * 4;
- if (bitmap->state & BITMAP_CLEAR_MEMORY)
+ if (bitmap->clear)
bitmap->sprite_area = calloc(1, area_size);
else
bitmap->sprite_area = malloc(area_size);
@@ -123,7 +123,7 @@ static bool bitmap_initialise(struct bitmap *bitmap)
/* exported interface documented in riscos/bitmap.h */
-void *riscos_bitmap_create(int width, int height, unsigned int state)
+void *riscos_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
{
struct bitmap *bitmap;
@@ -135,7 +135,8 @@ void *riscos_bitmap_create(int width, int height, unsigned int state)
return NULL;
bitmap->width = width;
bitmap->height = height;
- bitmap->state = state;
+ bitmap->opaque = (flags & BITMAP_OPAQUE) == BITMAP_OPAQUE;
+ bitmap->clear = (flags & BITMAP_CLEAR) == BITMAP_CLEAR;
return bitmap;
}
@@ -172,10 +173,7 @@ static void bitmap_set_opaque(void *vbitmap, bool opaque)
struct bitmap *bitmap = (struct bitmap *) vbitmap;
assert(bitmap);
- if (opaque)
- bitmap->state |= BITMAP_OPAQUE;
- else
- bitmap->state &= ~BITMAP_OPAQUE;
+ bitmap->opaque = opaque;
}
@@ -246,7 +244,7 @@ bool riscos_bitmap_get_opaque(void *vbitmap)
{
struct bitmap *bitmap = (struct bitmap *) vbitmap;
assert(bitmap);
- return (bitmap->state & BITMAP_OPAQUE);
+ return bitmap->opaque;
}
diff --git a/frontends/riscos/bitmap.h b/frontends/riscos/bitmap.h
index f66ebb317..dd3904d67 100644
--- a/frontends/riscos/bitmap.h
+++ b/frontends/riscos/bitmap.h
@@ -37,7 +37,8 @@ struct bitmap {
int width; /**< width of bitmap */
int height; /**< height of bitmap */
- unsigned int state; /**< The bitmap attributes (opaque/dirty etc.) */
+ bool opaque; /**< Whether the bitmap is opaque. */
+ bool clear; /**< Whether the bitmap should be initialised to zeros. */
struct osspriteop_area *sprite_area; /**< Uncompressed data, or NULL */
};
@@ -71,11 +72,11 @@ void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const struct osspriteop
* Create a bitmap.
*
* \param width width of image in pixels
- * \param height width of image in pixels
- * \param state the state to create the bitmap in.
+ * \param height height of image in pixels
+ * \param flags flags for bitmap creation.
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
-void *riscos_bitmap_create(int width, int height, unsigned int state);
+void *riscos_bitmap_create(int width, int height, enum gui_bitmap_flags flags);
/**
* Free a bitmap.
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 86797602b..85fefead3 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -243,7 +243,7 @@ ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name)
struct bitmap *bitmap;
osspriteop_area *area;
- bitmap = riscos_bitmap_create(34, 34, BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY);
+ bitmap = riscos_bitmap_create(34, 34, BITMAP_OPAQUE | BITMAP_CLEAR);
if (!bitmap) {
NSLOG(netsurf, INFO, "Thumbnail initialisation failed.");
return false;
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 28ef06fa9..cb1e5484b 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -4568,7 +4568,7 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi)
/* create the thumbnail sprite */
bitmap = riscos_bitmap_create(width, height,
- BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY);
+ BITMAP_OPAQUE | BITMAP_CLEAR);
if (!bitmap) {
NSLOG(netsurf, INFO, "Thumbnail initialisation failed.");
return;