allocate our bitmaps as BMF_DISPLAYABLE as this can improve performance when blitting to the screen

This commit is contained in:
Chris Young 2012-08-09 22:31:10 +01:00
parent e4d2677c80
commit bc5918ebbc
2 changed files with 14 additions and 9 deletions

View File

@ -125,9 +125,9 @@ void bitmap_destroy(void *bitmap)
if(bm->dto) {
DisposeDTObject(bm->dto);
}
#ifdef AMI_CUSTOM_MASK
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
#endif
FreeVec(bm->pixdata);
bm->pixdata = NULL;
bm->nativebm = NULL;
@ -178,8 +178,9 @@ void bitmap_modified(void *bitmap) {
p96FreeBitMap(bm->nativebm);
if(bm->dto) DisposeDTObject(bm->dto);
#ifdef AMI_CUSTOM_MASK
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
#endif
bm->nativebm = NULL;
bm->dto = NULL;
bm->native_mask = NULL;
@ -485,7 +486,7 @@ static PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height
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;
@ -535,14 +536,17 @@ static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
GetDTAttrs(bitmap->dto,
PDTA_DestBitMap, &dtbm,
//PDTA_MaskPlane, &bitmap->native_mask,
#ifndef AMI_CUSTOM_MASK
PDTA_MaskPlane, &bitmap->native_mask,
#endif
TAG_END);
bitmap->nativebmwidth = width;
bitmap->nativebmheight = height;
#ifdef AMI_CUSTOM_MASK
ami_bitmap_get_mask(bitmap, width, height);
#endif
return dtbm;
}

View File

@ -154,10 +154,11 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
gg->tmprasbuf = AllocVec(width * height, MEMF_PRIVATE | MEMF_CLEAR);
if(palette_mapped == true) {
gg->bm = AllocBitMap(width, height, depth, BMF_INTERLEAVED, friend);
gg->bm = AllocBitMap(width, height, depth,
BMF_INTERLEAVED | BMF_DISPLAYABLE, friend);
} else {
gg->bm = p96AllocBitMap(width, height, 32,
BMF_INTERLEAVED, friend, RGBFB_A8R8G8B8);
BMF_INTERLEAVED | BMF_DISPLAYABLE, friend, RGBFB_A8R8G8B8);
}
if(!gg->bm) warn_user("NoMemory","");