From 21f142a7fa12cc89420ac9439c83f06af249dc39 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 2 Feb 2015 00:32:34 +0000 Subject: Friend the screen bitmap for <= 8-bit modes, but only on OS3 as this causes OS4 to freeze --- amiga/bitmap.c | 18 ++++++++++++++++++ amiga/plotters.c | 7 ++++++- amiga/rtg.c | 2 -- 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'amiga') diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 95b5f71d6..aabb6a3be 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -292,6 +292,16 @@ void ami_bitmap_argb_to_rgba(struct bitmap *bm) data[i] = (data[i] << 8) | (data[i] >> 24); } } + +void ami_bitmap_rgba_to_argb(struct bitmap *bm) +{ + if(bm == NULL) return; + + ULONG *data = (ULONG *)bitmap_get_buffer(bm); + for(int i = 0; i < ((bitmap_get_rowstride(bm) / sizeof(ULONG)) * bitmap_get_height(bm)); i++) { + data[i] = (data[i] >> 8) | (data[i] << 24); + } +} #endif #ifdef BITMAP_DUMP @@ -345,6 +355,14 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap) IDoMethod(dto, PDTM_WRITEPIXELARRAY, bitmap_get_buffer(bitmap), PBPAFMT_RGBA, bitmap_get_rowstride(bitmap), 0, 0, bitmap_get_width(bitmap), bitmap_get_height(bitmap)); +#if 0 + ami_bitmap_rgba_to_argb(bitmap); + IDoMethod(dto, PDTM_WRITEPIXELARRAY, bitmap_get_buffer(bitmap), + PBPAFMT_ARGB, bitmap_get_rowstride(bitmap), 0, 0, + bitmap_get_width(bitmap), bitmap_get_height(bitmap)); + ami_bitmap_argb_to_rgb(bitmap); +#endif + } return dto; diff --git a/amiga/plotters.c b/amiga/plotters.c index 3c1a09099..88021ee29 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -113,6 +113,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) struct BitMap *friend = NULL; depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); + LOG(("Screen depth = %d", depth)); + #ifdef __amigaos4__ if(depth < 16) { palette_mapped = true; @@ -131,7 +133,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) gg->areabuf = AllocVecTagList(AREA_SIZE, NULL); gg->tmprasbuf = AllocVecTagList(width * height, NULL); - if(palette_mapped == true) { + if(palette_mapped == true) { +#ifndef __amigaos4__ + friend = scrn->RastPort.BitMap; +#endif gg->bm = AllocBitMap(width, height, depth, 0, friend); } else { if(depth == 32) friend = scrn->RastPort.BitMap; diff --git a/amiga/rtg.c b/amiga/rtg.c index fbefd55a1..267bd5d05 100644 --- a/amiga/rtg.c +++ b/amiga/rtg.c @@ -22,8 +22,6 @@ #include "amiga/rtg.h" -/**\todo p96WritePixelArray */ - struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap *friend, RGBFTYPE format) { -- cgit v1.2.3