summaryrefslogtreecommitdiff
path: root/frontends/riscos/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/riscos/bitmap.c')
-rw-r--r--frontends/riscos/bitmap.c84
1 files changed, 7 insertions, 77 deletions
diff --git a/frontends/riscos/bitmap.c b/frontends/riscos/bitmap.c
index d554d54b4..97dce6acc 100644
--- a/frontends/riscos/bitmap.c
+++ b/frontends/riscos/bitmap.c
@@ -44,7 +44,6 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/plotters.h"
-#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "riscos/gui.h"
@@ -91,7 +90,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 +122,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 +134,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 +172,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;
}
@@ -192,61 +189,12 @@ static size_t bitmap_get_rowstride(void *vbitmap)
}
-/**
- * Tests whether a bitmap has an opaque alpha channel
- *
- * \param vbitmap a bitmap, as returned by bitmap_create()
- * \return whether the bitmap is opaque
- */
-static bool bitmap_test_opaque(void *vbitmap)
-{
- struct bitmap *bitmap = (struct bitmap *) vbitmap;
- unsigned char *sprite;
- unsigned int width, height, size;
- osspriteop_header *sprite_header;
- unsigned *p, *ep;
-
- assert(bitmap);
-
- sprite = riscos_bitmap_get_buffer(bitmap);
- if (!sprite)
- return false;
-
- width = bitmap_get_rowstride(bitmap);
-
- sprite_header = (osspriteop_header *) (bitmap->sprite_area + 1);
-
- height = (sprite_header->height + 1);
-
- size = width * height;
-
- p = (void *) sprite;
-
- ep = (void *) (sprite + (size & ~31));
- while (p < ep) {
- /* \todo prefetch(p, 128)? */
- if (((p[0] & p[1] & p[2] & p[3] & p[4] & p[5] & p[6] & p[7])
- & 0xff000000U) != 0xff000000U)
- return false;
- p += 8;
- }
-
- ep = (void *) (sprite + size);
- while (p < ep) {
- if ((*p & 0xff000000U) != 0xff000000U) return false;
- p++;
- }
-
- return true;
-}
-
-
/* exported interface documented in riscos/bitmap.h */
bool riscos_bitmap_get_opaque(void *vbitmap)
{
struct bitmap *bitmap = (struct bitmap *) vbitmap;
assert(bitmap);
- return (bitmap->state & BITMAP_OPAQUE);
+ return bitmap->opaque;
}
@@ -449,8 +397,7 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
*/
static void bitmap_modified(void *vbitmap)
{
- struct bitmap *bitmap = (struct bitmap *) vbitmap;
- bitmap->state |= BITMAP_MODIFIED;
+ (void)(vbitmap);
}
@@ -480,20 +427,6 @@ static int bitmap_get_height(void *vbitmap)
}
-/**
- * Find the bytes per pixel of a bitmap
- *
- * \param vbitmap a bitmap, as returned by bitmap_create()
- * \return bytes per pixel
- */
-static size_t bitmap_get_bpp(void *vbitmap)
-{
- struct bitmap *bitmap = (struct bitmap *)vbitmap;
- assert(bitmap);
- return 4;
-}
-
-
/* exported interface documented in riscos/bitmap.h */
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap,
const osspriteop_header *s)
@@ -874,13 +807,10 @@ static struct gui_bitmap_table bitmap_table = {
.destroy = riscos_bitmap_destroy,
.set_opaque = bitmap_set_opaque,
.get_opaque = riscos_bitmap_get_opaque,
- .test_opaque = bitmap_test_opaque,
.get_buffer = riscos_bitmap_get_buffer,
.get_rowstride = bitmap_get_rowstride,
.get_width = bitmap_get_width,
.get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = riscos_bitmap_save,
.modified = bitmap_modified,
.render = riscos_bitmap_render,
};