Pass bm_mode to gr_init_bitmap

This commit is contained in:
Kp 2016-05-28 17:31:27 +00:00
parent 3c5add9d0e
commit 82a8f6ebb0
6 changed files with 13 additions and 13 deletions

View file

@ -61,11 +61,11 @@ grs_bitmap_ptr gr_create_bitmap(uint16_t w, uint16_t h )
grs_bitmap_ptr gr_create_bitmap_raw(uint16_t w, uint16_t h, unsigned char * raw_data )
{
auto n = make_unique<grs_main_bitmap>();
gr_init_bitmap(*n.get(), 0, 0, 0, w, h, w, raw_data);
gr_init_bitmap(*n.get(), bm_mode::linear, 0, 0, w, h, w, raw_data);
return n;
}
void gr_init_bitmap(grs_bitmap &bm, uint8_t mode, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bytesperline, const uint8_t *data) // TODO: virtualize
void gr_init_bitmap(grs_bitmap &bm, const bm_mode mode, const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h, const uint16_t bytesperline, const uint8_t *const data) // TODO: virtualize
{
bm.bm_x = x;
bm.bm_y = y;

View file

@ -143,7 +143,7 @@ void gr_clear_canvas(color_t color);
// Bitmap functions:
// these are the two workhorses, the others just use these
void gr_init_bitmap(grs_bitmap &bm, uint8_t mode, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bytesperline, const uint8_t* data);
void gr_init_bitmap(grs_bitmap &bm, bm_mode mode, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bytesperline, const uint8_t* data);
void gr_init_sub_bitmap (grs_bitmap &bm, grs_bitmap &bmParent, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void gr_init_bitmap_alloc(grs_bitmap &bm, bm_mode mode, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bytesperline);

View file

@ -300,7 +300,7 @@ static int load_pigpog(const d_fname &pogname)
GameBitmapOffset[x] = 0; // not in pig
*bmp = {};
gr_init_bitmap(*bmp, 0, 0, 0, cip->width, cip->height, cip->width, p);
gr_init_bitmap(*bmp, bm_mode::linear, 0, 0, cip->width, cip->height, cip->width, p);
gr_set_bitmap_flags(*bmp, cip->flags & 255);
bmp->avg_color = cip->flags >> 8;

View file

@ -1778,7 +1778,7 @@ static void cockpit_decode_alpha(grs_bitmap *const bm, const local_multires_gaug
#ifdef OGL
ogl_freebmtexture(*bm);
#endif
gr_init_bitmap(deccpt, 0, 0, 0, bm->bm_w, bm->bm_h, bm->bm_w, cockpitbuf);
gr_init_bitmap(deccpt, bm_mode::linear, 0, 0, bm->bm_w, bm->bm_h, bm->bm_w, cockpitbuf);
gr_set_transparent(deccpt,1);
#ifdef OGL
ogl_ubitmapm_cs (0, 0, -1, -1, deccpt, 255, F1_0); // render one time to init the texture

View file

@ -521,7 +521,7 @@ static int convert_rgb15(grs_bitmap &bm,iff_bitmap_header &bmheader)
//copy an iff header structure to a grs_bitmap structure
static void copy_iff_to_grs(grs_bitmap &bm,iff_bitmap_header &bmheader)
{
gr_init_bitmap(bm, bmheader.type, 0, 0, bmheader.w, bmheader.h, bmheader.w, bmheader.raw_data.release());
gr_init_bitmap(bm, static_cast<bm_mode>(bmheader.type), 0, 0, bmheader.w, bmheader.h, bmheader.w, bmheader.raw_data.release());
}
//if bm->bm_data is set, use it (making sure w & h are correct), else

View file

@ -451,7 +451,7 @@ int properties_init()
bogus_data[i*64+i] = c;
bogus_data[i*64+(63-i)] = c;
}
gr_init_bitmap(bogus_bitmap, 0, 0, 0, 64, 64, 64, bogus_data.data());
gr_init_bitmap(bogus_bitmap, bm_mode::linear, 0, 0, 64, 64, 64, bogus_data.data());
piggy_register_bitmap( &bogus_bitmap, "bogus", 1 );
#ifdef ALLEGRO
bogus_sound.len = 64*64;
@ -549,7 +549,7 @@ int properties_init()
strcpy( temp_name, temp_name_read );
grs_bitmap temp_bitmap{};
gr_init_bitmap(temp_bitmap, 0, 0, 0,
gr_init_bitmap(temp_bitmap, bm_mode::linear, 0, 0,
(bmh.dflags & DBM_FLAG_LARGE) ? bmh.width + 256 : bmh.width, bmh.height,
(bmh.dflags & DBM_FLAG_LARGE) ? bmh.width + 256 : bmh.width, Piggy_bitmap_cache_data);
temp_bitmap.bm_flags |= BM_FLAG_PAGED_OUT;
@ -681,7 +681,7 @@ void piggy_init_pigfile(const char *filename)
else
strcpy( temp_name, temp_name_read );
width = bmh.width + ((short) (bmh.wh_extra & 0x0f) << 8);
gr_init_bitmap(*bm, 0, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
gr_init_bitmap(*bm, bm_mode::linear, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
bm->bm_flags = BM_FLAG_PAGED_OUT;
bm->avg_color = bmh.avg_color;
@ -793,7 +793,7 @@ void piggy_new_pigfile(char *pigname)
width = bmh.width + ((short) (bmh.wh_extra & 0x0f) << 8);
gr_set_bitmap_data(*bm, NULL); // free ogl texture
gr_init_bitmap(*bm, 0, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
gr_init_bitmap(*bm, bm_mode::linear, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
bm->bm_flags = BM_FLAG_PAGED_OUT;
bm->avg_color = bmh.avg_color;
@ -1134,7 +1134,7 @@ int properties_init(void)
bogus_data[i*64+i] = c;
bogus_data[i*64+(63-i)] = c;
}
gr_init_bitmap(GameBitmaps[Num_bitmap_files], 0, 0, 0, 64, 64, 64, bogus_data.data());
gr_init_bitmap(GameBitmaps[Num_bitmap_files], bm_mode::linear, 0, 0, 64, 64, 64, bogus_data.data());
piggy_register_bitmap(&GameBitmaps[Num_bitmap_files], "bogus", 1);
bogus_sound.length = 64*64;
bogus_sound.data = bogus_data.data();
@ -1748,7 +1748,7 @@ void load_bitmap_replacements(const char *level_name)
width = bmh.width + ((short) (bmh.wh_extra & 0x0f) << 8);
gr_set_bitmap_data(*bm, NULL); // free ogl texture
gr_init_bitmap(*bm, 0, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
gr_init_bitmap(*bm, bm_mode::linear, 0, 0, width, bmh.height + ((short) (bmh.wh_extra & 0xf0) << 4), width, NULL);
bm->avg_color = bmh.avg_color;
bm->bm_data = (ubyte *) (size_t)bmh.offset;
@ -1801,7 +1801,7 @@ static void bitmap_read_d1( grs_bitmap *bitmap, /* read into this bitmap */
width = bmh->width + ((short) (bmh->wh_extra & 0x0f) << 8);
gr_set_bitmap_data(*bitmap, NULL); // free ogl texture
gr_init_bitmap(*bitmap, 0, 0, 0, width, bmh->height + ((short) (bmh->wh_extra & 0xf0) << 4), width, NULL);
gr_init_bitmap(*bitmap, bm_mode::linear, 0, 0, width, bmh->height + ((short) (bmh->wh_extra & 0xf0) << 4), width, NULL);
bitmap->avg_color = bmh->avg_color;
gr_set_bitmap_flags(*bitmap, bmh->flags & BM_FLAGS_TO_COPY);