Ensure we are only accessing pixel data using amiga_bitmap_get_buffer()

This commit is contained in:
Chris Young 2016-03-22 22:55:31 +00:00
parent 8a7d030af7
commit 7a7d99e004

View File

@ -217,7 +217,7 @@ bool amiga_bitmap_test_opaque(void *bitmap)
struct bitmap *bm = bitmap; struct bitmap *bm = bitmap;
uint32 p = bm->width * bm->height; uint32 p = bm->width * bm->height;
uint32 a = 0; uint32 a = 0;
uint32 *bmi = (uint32 *) bm->pixdata; uint32 *bmi = (uint32 *)amiga_bitmap_get_buffer(bm);
assert(bitmap); assert(bitmap);
@ -302,7 +302,7 @@ static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
void bitmap_dump(struct bitmap *bitmap) void bitmap_dump(struct bitmap *bitmap)
{ {
int x,y; int x,y;
ULONG *bm = (ULONG *)bitmap->pixdata; ULONG *bm = (ULONG *)amiga_bitmap_get_buffer(bitmap);
printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n", printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n",
bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false", bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false",
@ -415,7 +415,8 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
{ {
if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0, if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0,
friendbm, AMI_BITMAP_FORMAT))) { friendbm, AMI_BITMAP_FORMAT))) {
ami_rtg_writepixelarray(bitmap->pixdata, tbm, bitmap->width, bitmap->height, ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap),
tbm, bitmap->width, bitmap->height,
bitmap->width * 4, AMI_BITMAP_FORMAT); bitmap->width * 4, AMI_BITMAP_FORMAT);
} }
@ -494,7 +495,7 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm) int height, struct BitMap *n_bm)
{ {
uint32 *bmi = (uint32 *) bitmap->pixdata; uint32 *bmi = (uint32 *) amiga_bitmap_get_buffer(bitmap);
UBYTE maskbit = 0; UBYTE maskbit = 0;
ULONG bm_width; ULONG bm_width;
int y, x, bpr; int y, x, bpr;
@ -621,7 +622,7 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
BLITA_Height, bitmap->height, BLITA_Height, bitmap->height,
BLITA_Source, bm_globals.bm, BLITA_Source, bm_globals.bm,
BLITA_SrcType, BLITT_BITMAP, BLITA_SrcType, BLITT_BITMAP,
BLITA_Dest, bitmap->pixdata, BLITA_Dest, amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32, BLITA_DestType, BLITT_ARGB32,
BLITA_DestBytesPerRow, 4 * bitmap->width, BLITA_DestBytesPerRow, 4 * bitmap->width,
BLITA_DestX, 0, BLITA_DestX, 0,