fix mask
This commit is contained in:
parent
0210ef066b
commit
59784ba852
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ struct bitmap {
|
|||
|
||||
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
|
||||
int width, int height, struct BitMap *friendbm);
|
||||
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);
|
||||
|
||||
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
|
||||
struct bitmap *ami_bitmap_from_datatype(char *filename);
|
||||
|
|
|
@ -3845,7 +3845,7 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
|
|||
minterm = 0xc0;
|
||||
} else {
|
||||
tag = BLITA_MaskPlane;
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16);
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16, bm);
|
||||
minterm = (ABC|ABNC|ANBC);
|
||||
}
|
||||
|
||||
|
@ -3928,7 +3928,7 @@ void gui_window_set_search_ico(hlcache_handle *ico)
|
|||
minterm = 0xc0;
|
||||
} else {
|
||||
tag = BLITA_MaskPlane;
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(ico_bitmap, 16, 16);
|
||||
tag_data = (ULONG)ami_bitmap_get_mask(ico_bitmap, 16, 16, bm);
|
||||
minterm = (ABC|ABNC|ANBC);
|
||||
}
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
|
|||
minterm = 0xc0;
|
||||
} else {
|
||||
tag = BLITA_MaskPlane;
|
||||
if(tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height))
|
||||
if(tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm))
|
||||
minterm = (ABC|ABNC|ANBC);
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
|
|||
bfbm.height = height;
|
||||
bfbm.offsetx = ox;
|
||||
bfbm.offsety = oy;
|
||||
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height);;
|
||||
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
|
||||
bfh = AllocVec(sizeof(struct Hook),MEMF_CLEAR);
|
||||
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
|
||||
bfh->h_SubEntry = 0;
|
||||
|
|
Loading…
Reference in New Issue