From 8b31fc0e7880fed1da176c996fdf5acd5b63d8fb Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 12 Aug 2012 11:02:12 +0100 Subject: Fix mask calculation (thanks to Fredrik Wikstrom) --- amiga/bitmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'amiga/bitmap.c') 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; ynative_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)); } } -- cgit v1.2.3