diff --git a/common/2d/rle.cpp b/common/2d/rle.cpp index 41f4ae7e7..531852cdc 100644 --- a/common/2d/rle.cpp +++ b/common/2d/rle.cpp @@ -563,26 +563,26 @@ void rle_swap_0_255(grs_bitmap *bmp) /* * remaps all entries using colormap in an RLE bitmap without uncompressing it */ -void rle_remap(grs_bitmap *bmp, array &colormap) +void rle_remap(grs_bitmap &bmp, array &colormap) { int len, rle_big; unsigned char *start; unsigned short line_size; - rle_big = bmp->bm_flags & BM_FLAG_RLE_BIG; + rle_big = bmp.bm_flags & BM_FLAG_RLE_BIG; RAIIdmem temp; - MALLOC(temp, uint8_t[], MAX_BMP_SIZE(bmp->bm_w, bmp->bm_h) + 30000); + MALLOC(temp, uint8_t[], MAX_BMP_SIZE(bmp.bm_w, bmp.bm_h) + 30000); - const std::size_t pointer_offset = rle_big ? 4 + 2 * bmp->bm_h : 4 + bmp->bm_h; - auto ptr = &bmp->bm_data[pointer_offset]; + const std::size_t pointer_offset = rle_big ? 4 + 2 * bmp.bm_h : 4 + bmp.bm_h; + auto ptr = &bmp.get_bitmap_data()[pointer_offset]; auto ptr2 = &temp[pointer_offset]; - for (int i = 0; i < bmp->bm_h; i++) { + for (int i = 0; i < bmp.bm_h; i++) { start = ptr2; if (rle_big) - line_size = INTEL_SHORT(*((unsigned short *)&bmp->bm_data[4 + 2 * i])); + line_size = INTEL_SHORT(*((unsigned short *)&bmp.get_bitmap_data()[4 + 2 * i])); else - line_size = bmp->bm_data[4 + i]; + line_size = bmp.get_bitmap_data()[4 + i]; for (int j = 0; j < line_size; j++) { if ( ! IS_RLE_CODE(ptr[j])) { if (IS_RLE_CODE(colormap[ptr[j]])) @@ -604,5 +604,5 @@ void rle_remap(grs_bitmap *bmp, array &colormap) } len = ptr2 - temp; *((int *)(unsigned char *)temp) = len; // set total size - memcpy(bmp->get_bitmap_data(), temp, len); + memcpy(bmp.get_bitmap_data(), temp, len); } diff --git a/common/include/rle.h b/common/include/rle.h index 2e3f0e83f..8677985d5 100644 --- a/common/include/rle.h +++ b/common/include/rle.h @@ -78,7 +78,7 @@ static inline const grs_bitmap *rle_expand_texture(const grs_bitmap &bmp) void rle_cache_close(); void rle_cache_flush(); void rle_swap_0_255(grs_bitmap *bmp); -void rle_remap(grs_bitmap *bmp, array &colormap); +void rle_remap(grs_bitmap &bmp, array &colormap); void gr_rle_expand_scanline_generic(grs_bitmap &dest, int dx, int dy, const ubyte *src, int x1, int x2 ); #endif diff --git a/similar/main/piggy.cpp b/similar/main/piggy.cpp index c5be574a9..3ea1f15a7 100644 --- a/similar/main/piggy.cpp +++ b/similar/main/piggy.cpp @@ -1841,7 +1841,7 @@ static void bitmap_read_d1( grs_bitmap *bitmap, /* read into this bitmap */ swap_0_255(bitmap); } if (bmh->flags & BM_FLAG_RLE) - rle_remap(bitmap, colormap); + rle_remap(*bitmap, colormap); else gr_remap_bitmap_good(*bitmap, d1_palette, TRANSPARENCY_COLOR, -1); if (bmh->flags & BM_FLAG_RLE) { // size of bitmap could have changed!