summaryrefslogtreecommitdiff
path: root/amiga/bitmap.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-12 11:02:12 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-12 11:02:12 +0100
commit8b31fc0e7880fed1da176c996fdf5acd5b63d8fb (patch)
tree9872e40787f7a2c92d27ff1f389155216376e8d5 /amiga/bitmap.c
parent59784ba8528182089c77e710f5ff31b3c78d6dc1 (diff)
downloadnetsurf-8b31fc0e7880fed1da176c996fdf5acd5b63d8fb.tar.gz
netsurf-8b31fc0e7880fed1da176c996fdf5acd5b63d8fb.tar.bz2
Fix mask calculation (thanks to Fredrik Wikstrom)
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r--amiga/bitmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 97e00f302..ee1506525 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -478,24 +478,24 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
uint32 *bmi = (uint32 *) bitmap->pixdata;
UBYTE maskbit = 0;
ULONG bm_width;
- int y, x, w;
+ int y, x, bpr;
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;
bm_width = GetBitMapAttr(n_bm, BMA_WIDTH);
+ bpr = RASSIZE(bm_width, 1);
bitmap->native_mask = AllocRaster(bm_width, height);
-
- int bpr = RASSIZE(bm_width, 1);
+ SetMem(bitmap->native_mask, 0, bpr * height);
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*bpr) + (x/8)] =
- (bitmap->native_mask[(y*bpr) + (x/8)] << 1) | maskbit;
+ bitmap->native_mask[(y*bpr) + (x/8)] |=
+ maskbit << (7 - (x % 8));
}
}