diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-08-11 17:19:54 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-08-11 17:19:54 +0100 |
commit | 59784ba8528182089c77e710f5ff31b3c78d6dc1 (patch) | |
tree | c075c69c7651d59d186a34eab78a24c1f6aa3d3c /amiga/bitmap.c | |
parent | 0210ef066b75da6ff2a91b5de9ad6d3f583548f2 (diff) | |
download | netsurf-59784ba8528182089c77e710f5ff31b3c78d6dc1.tar.gz netsurf-59784ba8528182089c77e710f5ff31b3c78d6dc1.tar.bz2 |
fix mask
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r-- | amiga/bitmap.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c index 381958b34..97e00f302 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -472,39 +472,30 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width, return tbm; } -PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height) +PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, + int height, struct BitMap *n_bm) { uint32 *bmi = (uint32 *) bitmap->pixdata; UBYTE maskbit = 0; + ULONG bm_width; int y, x, w; 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); + bm_width = GetBitMapAttr(n_bm, BMA_WIDTH); + bitmap->native_mask = AllocRaster(bm_width, height); - w = width / 8; - -/* - int wu = width; - while((wu % 16) != 0) { - wu += 8; - w++; - } -*/ - - for(int i=0; i<(height * (width / 8)); i++) { - bitmap->native_mask[i] = 0; - } + int bpr = RASSIZE(bm_width, 1); for(y=0; y<height; y++) { for(x=0; x<width; x++) { if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0; else maskbit = 1; bmi++; - bitmap->native_mask[(y*w) + (x/8)] = - (bitmap->native_mask[(y*w) + (x/8)] << 1) | maskbit; + bitmap->native_mask[(y*bpr) + (x/8)] = + (bitmap->native_mask[(y*bpr) + (x/8)] << 1) | maskbit; } } @@ -552,7 +543,7 @@ static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap, bitmap->nativebmwidth = width; bitmap->nativebmheight = height; - ami_bitmap_get_mask(bitmap, width, height); + ami_bitmap_get_mask(bitmap, width, height, dtbm); return dtbm; } |