summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2022-04-01 16:03:44 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2022-04-01 16:03:44 +0100
commit44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 (patch)
treeed5a967b97c232ae7d06bbc2ed4e5494301077bf
parent7d5c449389162c3b11cecc0b4a969d50a693c8b1 (diff)
downloadnetsurf-44e464e98daed2e0eab9cf52446ad2ab4e9a65a6.tar.gz
netsurf-44e464e98daed2e0eab9cf52446ad2ab4e9a65a6.tar.bz2
Amiga: Use ARGB format bitmaps
-rw-r--r--frontends/amiga/bitmap.c30
-rwxr-xr-xfrontends/amiga/bitmap.h2
-rw-r--r--frontends/amiga/gui.c6
3 files changed, 10 insertions, 28 deletions
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index cd2667bdd..e8534a395 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -347,26 +347,6 @@ int bitmap_get_height(void *bitmap)
}
}
-static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] << 8) | (data[i] >> 24);
- }
-}
-
-static void ami_bitmap_rgba_to_argb(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[ i] >> 8) | (data[i] << 24);
- }
-}
-
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -416,7 +396,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
TAG_DONE);
IDoMethod(dto, PDTM_WRITEPIXELARRAY, amiga_bitmap_get_buffer(bitmap),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bitmap), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bitmap), 0, 0,
bitmap_get_width(bitmap), bitmap_get_height(bitmap));
}
@@ -441,7 +421,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
bm = amiga_bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
IDoMethod(dto, PDTM_READPIXELARRAY, amiga_bitmap_get_buffer(bm),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bm), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
amiga_bitmap_set_opaque(bm, bitmap_test_opaque(bm));
@@ -497,7 +477,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
dithermode = DITHERMODE_FS;
}
- ami_bitmap_rgba_to_argb(bitmap);
bitmap->drawhandle = ObtainDrawHandle(
NULL,
&rp,
@@ -514,7 +493,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
ReleaseDrawHandle(bitmap->drawhandle);
bitmap->drawhandle = NULL;
}
- ami_bitmap_argb_to_rgba(bitmap);
} else {
if(guigfx_warned == false) {
amiga_warn_user("BMConvErr", NULL);
@@ -664,7 +642,7 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
for(y=0; y<height; y++) {
for(x=0; x<width; x++) {
- if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
+ if ((*bmi & 0xff000000U) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
else maskbit = 1;
bmi++;
bitmap->native_mask[(y*bpr) + (x/8)] |=
@@ -741,8 +719,6 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
BLITA_DestY, 0,
TAG_DONE);
- ami_bitmap_argb_to_rgba(bitmap);
-
/**\todo In theory we should be able to move the bitmap to our native area
to try to avoid re-conversion (at the expense of memory) */
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 8e7bcbc70..a7dc9198f 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -27,7 +27,7 @@
#include "netsurf/bitmap.h"
-#define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8
+#define AMI_BITMAP_FORMAT RGBFB_A8R8G8B8
#define AMI_BITMAP_SCALE_ICON 0xFF
extern struct gui_bitmap_table *amiga_bitmap_table;
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 8eb34fb92..6734433fd 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6670,6 +6670,12 @@ int main(int argc, char** argv)
win_destroyed = false;
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
window_list = NewObjList();
urldb_load(nsoption_charp(url_file));