If bitmap is opaque, ensure we override the alpha channel as it may contain nonsense.

This commit is contained in:
Chris Young 2013-10-05 11:18:27 +01:00
parent f5bdd4b109
commit a06cb9f05c
2 changed files with 30 additions and 11 deletions

View File

@ -288,6 +288,21 @@ void ami_bitmap_argb_to_rgba(struct bitmap *bm)
}
#endif
void bitmap_dump(struct bitmap *bitmap)
{
int x,y;
ULONG *bm = (ULONG *)bitmap->pixdata;
printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n", bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false", bitmap->nativebm, bitmap->nativebmwidth, bitmap->nativebmheight);
for(y = 0; y < bitmap->height; y++) {
for(x = 0; x < bitmap->width; x++) {
printf("%lx ", bm[(y*bitmap->width) + x]);
}
printf("\n");
}
}
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
{
Object *dto;
@ -423,11 +438,9 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
{
#ifdef __amigaos4__
uint32 comptype = COMPOSITE_Src;
uint32 flags = 0;
if(bitmap->opaque) flags |= COMPFLAG_IgnoreDestAlpha;
uint32 flags = 0; //COMPFLAG_IgnoreDestAlpha;
if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
CompositeTags(comptype,tbm,scaledbm,
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),

View File

@ -344,7 +344,7 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
glob->rp->LinePtrn = PATT_LINE;
break;
case PLOT_OP_TYPE_DOT: /**< Doted plot */
case PLOT_OP_TYPE_DOT: /**< Dotted plot */
glob->rp->LinePtrn = PATT_DOT;
break;
@ -694,12 +694,15 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
#ifdef __amigaos4__
uint32 comptype = COMPOSITE_Src;
if(!bitmap->opaque)
comptype = COMPOSITE_Src_Over_Dest;
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
if(bitmap_get_opaque(bitmap)) {
compflags |= COMPFLAG_SrcAlphaOverride;
comptype = COMPOSITE_Src;
}
CompositeTags(comptype,tbm,glob->rp->BitMap,
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
COMPTAG_Flags, compflags,
COMPTAG_DestX,glob->rect.MinX,
COMPTAG_DestY,glob->rect.MinY,
COMPTAG_DestWidth,glob->rect.MaxX - glob->rect.MinX + 1,
@ -860,8 +863,11 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
#ifdef __amigaos4__
CompositeTags(COMPOSITE_Src_Over_Dest,bfbm->bm, rp->BitMap,
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
CompositeTags(comptype, bfbm->bm, rp->BitMap,
COMPTAG_Flags, compflags,
COMPTAG_DestX,bfmsg->Bounds.MinX,
COMPTAG_DestY,bfmsg->Bounds.MinY,
COMPTAG_DestWidth,bfmsg->Bounds.MaxX - bfmsg->Bounds.MinX + 1,