diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-08-09 21:59:47 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-08-09 21:59:47 +0100 |
commit | e4d2677c80985914b2b37efd5d0a70a1856741b2 (patch) | |
tree | 58d674785310410d5187fe0dda6748e30a155ab0 /amiga | |
parent | 56967bbf0657fb52605f17cb56de595a3e6cf159 (diff) | |
download | netsurf-e4d2677c80985914b2b37efd5d0a70a1856741b2.tar.gz netsurf-e4d2677c80985914b2b37efd5d0a70a1856741b2.tar.bz2 |
first attempt to create our own mask of only wholly transparent pixels.
Diffstat (limited to 'amiga')
-rw-r--r-- | amiga/bitmap.c | 39 | ||||
-rwxr-xr-x | amiga/plotters.c | 5 |
2 files changed, 39 insertions, 5 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c index a80fb0e1a..53de5cf4f 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -120,16 +120,20 @@ void bitmap_destroy(void *bitmap) { if((bm->nativebm) && (bm->dto == NULL)) { p96FreeBitMap(bm->nativebm); - bm->nativebm = NULL; } if(bm->dto) { DisposeDTObject(bm->dto); - bm->dto = NULL; } + if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height); + FreeVec(bm->pixdata); bm->pixdata = NULL; + bm->nativebm = NULL; + bm->native_mask = NULL; + bm->dto = NULL; + FreeVec(bm); bm = NULL; } @@ -174,6 +178,8 @@ void bitmap_modified(void *bitmap) { p96FreeBitMap(bm->nativebm); if(bm->dto) DisposeDTObject(bm->dto); + if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height); + bm->nativebm = NULL; bm->dto = NULL; bm->native_mask = NULL; @@ -468,6 +474,31 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width, return tbm; } +static PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height) +{ + uint32 *bmi = (uint32 *) bitmap->pixdata; + UBYTE maskbit = 0; + int y, x; + + if((height != bitmap->height) || (width != bitmap->width)) return NULL; + if(bitmap_get_opaque(bitmap) == true) return NULL; + if(bitmap->native_mask) return bitmap->native_mask; + + bitmap->native_mask = AllocRaster(width, height); + + for(y=0; y<height; y++) { + for(x=0; x<width; x++) { + if ((*bmi & 0xff000000U) == 0x00000000U) maskbit = 1; + else maskbit = 0; + bmi++; + bitmap->native_mask[(y*4) + (x/8)] = + (bitmap->native_mask[(y*4) + (x/8)] << 1) | maskbit; + } + } + + return bitmap->native_mask; +} + static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap, int width, int height) { @@ -504,12 +535,14 @@ static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap, GetDTAttrs(bitmap->dto, PDTA_DestBitMap, &dtbm, - PDTA_MaskPlane, &bitmap->native_mask, + //PDTA_MaskPlane, &bitmap->native_mask, TAG_END); bitmap->nativebmwidth = width; bitmap->nativebmheight = height; + ami_bitmap_get_mask(bitmap, width, height); + return dtbm; } diff --git a/amiga/plotters.c b/amiga/plotters.c index 66c996e71..721596f02 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -678,9 +678,10 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma } else { tag = BLITA_MaskPlane; tag_data = (ULONG)bitmap->native_mask; - minterm = 0xc0; /* should be (ABC|ABNC|ANBC); */ + minterm = (ABC|ABNC|ANBC); } - + //BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, (ABC|ABNC|ANBC), bitmap->native_mask); + BltBitMapTags(BLITA_Width,width, BLITA_Height,height, BLITA_Source,tbm, |