summaryrefslogtreecommitdiff
path: root/frontends/monkey
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/monkey
parentc2d72d1e9361b3017872e5aff16cfe9a894f3048 (diff)
downloadnetsurf-002c3c1a7c2ae7229afac3f1966892fd42895aec.tar.gz
netsurf-002c3c1a7c2ae7229afac3f1966892fd42895aec.tar.bz2
Bitmap API: Clean up creation flags.
Diffstat (limited to 'frontends/monkey')
-rw-r--r--frontends/monkey/bitmap.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/frontends/monkey/bitmap.c b/frontends/monkey/bitmap.c
index ba3b83cf5..36016988c 100644
--- a/frontends/monkey/bitmap.c
+++ b/frontends/monkey/bitmap.c
@@ -31,26 +31,26 @@ struct bitmap {
size_t rowstride;
int width;
int height;
- unsigned int state;
+ bool opaque;
};
-static void *bitmap_create(int width, int height, unsigned int state)
+static void *bitmap_create(int width, int height, enum gui_bitmap_flags flags)
{
struct bitmap *ret = calloc(sizeof(*ret), 1);
if (ret == NULL)
return NULL;
-
+
ret->width = width;
ret->height = height;
- ret->state = state;
-
+ ret->opaque = (flags & BITMAP_OPAQUE) == BITMAP_OPAQUE;
+
ret->ptr = calloc(width, height * 4);
-
+
if (ret->ptr == NULL) {
free(ret);
return NULL;
}
-
+
return ret;
}
@@ -64,11 +64,8 @@ static void bitmap_destroy(void *bitmap)
static void bitmap_set_opaque(void *bitmap, bool opaque)
{
struct bitmap *bmap = bitmap;
-
- if (opaque)
- bmap->state |= (BITMAP_OPAQUE);
- else
- bmap->state &= ~(BITMAP_OPAQUE);
+
+ bmap->opaque = opaque;
}
static bool bitmap_test_opaque(void *bitmap)
@@ -79,8 +76,8 @@ static bool bitmap_test_opaque(void *bitmap)
static bool bitmap_get_opaque(void *bitmap)
{
struct bitmap *bmap = bitmap;
-
- return (bmap->state & BITMAP_OPAQUE) == BITMAP_OPAQUE;
+
+ return bmap->opaque;
}
static unsigned char *bitmap_get_buffer(void *bitmap)
@@ -98,7 +95,7 @@ static size_t bitmap_get_rowstride(void *bitmap)
static void bitmap_modified(void *bitmap)
{
- struct bitmap *bmap = bitmap;
+ return;
}
static int bitmap_get_width(void *bitmap)