diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-04-26 00:41:50 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-04-26 00:41:50 +0100 |
commit | 4fcc83f119ccda17ba03d898592ef89631885066 (patch) | |
tree | 6f5834f592925eb5f0c4e0af0f091cf6aa789f83 | |
parent | 99c94fabc94d4c6f71903b9f7eb64b6a035443d1 (diff) | |
download | netsurf-chris/quant.tar.gz |
Fix 8-bit mode/guigfx to work on OS4chris/quant
-rw-r--r-- | amiga/bitmap.c | 48 | ||||
-rw-r--r-- | amiga/plotters.c | 2 |
2 files changed, 25 insertions, 25 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c index bcd761ed6..6ef5157b2 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -432,23 +432,17 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w } } else { if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, - 8, 0, friendbm, AMI_BITMAP_FORMAT))) { //TODO: avoid p96 + 8, 0, friendbm, AMI_BITMAP_FORMAT))) { struct RastPort rp; InitRastPort(&rp); rp.BitMap = tbm; - ULONG dithermode; - - switch(nsoption_int(dither_quality)) { - case 0: - dithermode = DITHERMODE_NONE; - break; - case 1: - dithermode = DITHERMODE_EDD; - break; - case 2: - dithermode = DITHERMODE_FS; - break; + ULONG dithermode = DITHERMODE_NONE; + + if(nsoption_int(dither_quality) == 1) { + dithermode = DITHERMODE_EDD; + } else if(nsoption_int(dither_quality) == 2) { + dithermode = DITHERMODE_FS; } ami_bitmap_rgba_to_argb(bitmap); @@ -484,25 +478,29 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w { struct BitMap *scaledbm; struct BitScaleArgs bsa; + int depth = 32; + if(type == AMI_NSBM_PALETTEMAPPED) depth = 8; - scaledbm = ami_rtg_allocbitmap(width, height, 32, 0, + scaledbm = ami_rtg_allocbitmap(width, height, depth, 0, friendbm, AMI_BITMAP_FORMAT); #ifdef __amigaos4__ - if(__builtin_expect(GfxBase->LibNode.lib_Version >= 53, 1)) { - /* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) */ + if(__builtin_expect(((GfxBase->LibNode.lib_Version >= 53) && + (type == AMI_NSBM_TRUECOLOUR)), 1)) { + /* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) + * Additionally, when we use friend BitMaps in non 32-bit modes it freezes the OS */ uint32 flags = 0; if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter; CompositeTags(COMPOSITE_Src, tbm, scaledbm, - COMPTAG_ScaleX,COMP_FLOAT_TO_FIX((float)width/bitmap->width), - COMPTAG_ScaleY,COMP_FLOAT_TO_FIX((float)height/bitmap->height), + COMPTAG_ScaleX, COMP_FLOAT_TO_FIX((float)width/bitmap->width), + COMPTAG_ScaleY, COMP_FLOAT_TO_FIX((float)height/bitmap->height), COMPTAG_Flags, flags, - COMPTAG_DestX,0, - COMPTAG_DestY,0, - COMPTAG_DestWidth,width, - COMPTAG_DestHeight,height, - COMPTAG_OffsetX,0, - COMPTAG_OffsetY,0, + COMPTAG_DestX, 0, + COMPTAG_DestY, 0, + COMPTAG_DestWidth, width, + COMPTAG_DestHeight, height, + COMPTAG_OffsetX, 0, + COMPTAG_OffsetY, 0, COMPTAG_FriendBitMap, scrn->RastPort.BitMap, TAG_DONE); } else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */ @@ -590,7 +588,7 @@ static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap, amiga_bitmap_modified(bitmap); } - return ami_bitmap_get_generic(bitmap, width, height, NULL, AMI_NSBM_PALETTEMAPPED); + return ami_bitmap_get_generic(bitmap, width, height, friendbm, AMI_NSBM_PALETTEMAPPED); } struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap, diff --git a/amiga/plotters.c b/amiga/plotters.c index 58dae4fc3..9c3c3c7f1 100644 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -155,6 +155,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for /* Screen depth is reported as 24 even when it's actually 32-bit. * We get freezes and other problems on OS4 if we befriend at any * other depths, hence this check. + * \todo use friend BitMaps but avoid CompositeTags() at non-32-bit + * as that seems to be the cause of the problems. */ if((depth >= 24) && (force32bit == false)) friend = scrn->RastPort.BitMap; #endif |