Gitweb links: ...log http://git.netsurf-browser.org/netsurf.git/shortlog/44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 ...commit http://git.netsurf-browser.org/netsurf.git/commit/44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 ...tree http://git.netsurf-browser.org/netsurf.git/tree/44e464e98daed2e0eab9cf52446ad2ab4e9a65a6
The branch, master has been updated via 44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 (commit) from 7d5c449389162c3b11cecc0b4a969d50a693c8b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 commit 44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 Author: Chris Young <ch...@unsatisfactorysoftware.co.uk> Commit: Chris Young <ch...@unsatisfactorysoftware.co.uk> Amiga: Use ARGB format bitmaps diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index cd2667b..e8534a3 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 8e7bcbc..a7dc919 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 8eb34fb..6734433 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)); ----------------------------------------------------------------------- Summary of changes: frontends/amiga/bitmap.c | 30 +++--------------------------- frontends/amiga/bitmap.h | 2 +- frontends/amiga/gui.c | 6 ++++++ 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index cd2667b..e8534a3 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 8e7bcbc..a7dc919 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 8eb34fb..6734433 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)); -- NetSurf Browser _______________________________________________ netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org