Pass gr_set_transparent arg by &
This commit is contained in:
parent
e5acd8056d
commit
26f4aaa51b
|
@ -144,18 +144,6 @@ void decode_data(ubyte *data, uint_fast32_t num_pixels, array<color_t, 256> &col
|
|||
std::transform(data, data + num_pixels, data, a);
|
||||
}
|
||||
|
||||
void gr_set_transparent (grs_bitmap *pbm, int bTransparent)
|
||||
{
|
||||
if (bTransparent)
|
||||
{
|
||||
gr_set_bitmap_flags(*pbm, pbm->bm_flags | BM_FLAG_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
gr_set_bitmap_flags(*pbm, pbm->bm_flags & ~BM_FLAG_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
void gr_set_super_transparent (grs_bitmap *pbm, int bTransparent)
|
||||
{
|
||||
if (bTransparent)
|
||||
|
@ -201,7 +189,7 @@ void gr_remap_bitmap( grs_bitmap * bmp, palette_array_t &palette, int transparen
|
|||
decode_data(bmp->bm_data, bmp->bm_w * bmp->bm_h, colormap, freq );
|
||||
|
||||
if ( (transparent_color>=0) && (transparent_color<=255) && (freq[transparent_color]>0) )
|
||||
gr_set_transparent (bmp, 1);
|
||||
gr_set_transparent(*bmp, 1);
|
||||
|
||||
if ( (super_transparent_color>=0) && (super_transparent_color<=255) && (freq[super_transparent_color]>0) )
|
||||
gr_set_super_transparent (bmp, 0);
|
||||
|
@ -228,7 +216,7 @@ void gr_remap_bitmap_good( grs_bitmap * bmp, palette_array_t &palette, int trans
|
|||
}
|
||||
|
||||
if ( (transparent_color>=0) && (transparent_color<=255) && (freq[transparent_color]>0) )
|
||||
gr_set_transparent (bmp, 1);
|
||||
gr_set_transparent(*bmp, 1);
|
||||
|
||||
if ( (super_transparent_color>=0) && (super_transparent_color<=255) && (freq[super_transparent_color]>0) )
|
||||
gr_set_super_transparent (bmp, 1);
|
||||
|
@ -243,7 +231,7 @@ void gr_bitmap_check_transparency( grs_bitmap * bmp )
|
|||
for (int y=0; y<bmp->bm_h; y++ ) {
|
||||
for (int x=0; x<bmp->bm_w; x++ ) {
|
||||
if (*data++ == TRANSPARENCY_COLOR ) {
|
||||
gr_set_transparent (bmp, 1);
|
||||
gr_set_transparent(*bmp, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,7 +270,12 @@ static inline void gr_set_bitmap_flags(grs_bitmap &bm, uint8_t flags)
|
|||
bm.bm_flags = flags;
|
||||
}
|
||||
|
||||
void gr_set_transparent(grs_bitmap *pbm, int bTransparent);
|
||||
static inline void gr_set_transparent(grs_bitmap &bm, bool bTransparent)
|
||||
{
|
||||
auto bm_flags = bm.bm_flags;
|
||||
gr_set_bitmap_flags(bm, bTransparent ? bm_flags | BM_FLAG_TRANSPARENT : bm_flags & ~BM_FLAG_TRANSPARENT);
|
||||
}
|
||||
|
||||
void gr_set_super_transparent(grs_bitmap *pbm, int bTransparent);
|
||||
void gr_set_bitmap_data(grs_bitmap &bm, unsigned char *data);
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ static void ogl_init_font(grs_font * font)
|
|||
MALLOC(data, ubyte, tw*th);
|
||||
memset(data, TRANSPARENCY_COLOR, tw * th); // map the whole data with transparency so we won't have borders if using gap
|
||||
gr_init_bitmap(font->ft_parent_bitmap,BM_LINEAR,0,0,tw,th,tw,data);
|
||||
gr_set_transparent(&font->ft_parent_bitmap, 1);
|
||||
gr_set_transparent(font->ft_parent_bitmap, 1);
|
||||
|
||||
if (!(font->ft_flags & FT_COLOR))
|
||||
oglflags |= OGL_FLAG_NOCOLOR;
|
||||
|
|
|
@ -1802,7 +1802,7 @@ static void cockpit_decode_alpha(grs_bitmap *bm)
|
|||
ogl_freebmtexture(*bm);
|
||||
#endif
|
||||
gr_init_bitmap(deccpt, 0, 0, 0, bm->bm_w, bm->bm_h, bm->bm_w, cockpitbuf);
|
||||
gr_set_transparent(&deccpt,1);
|
||||
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
|
||||
#endif
|
||||
|
|
|
@ -4910,7 +4910,7 @@ void init_hoard_data()
|
|||
for (i=0;i<n_orb_frames;i++) {
|
||||
Vclip[orb_vclip].frames[i].index = bitmap_num;
|
||||
gr_init_bitmap(GameBitmaps[bitmap_num],BM_LINEAR,0,0,orb_w,orb_h,orb_w,bitmap_data1);
|
||||
gr_set_transparent (&GameBitmaps[bitmap_num], 1);
|
||||
gr_set_transparent(GameBitmaps[bitmap_num], 1);
|
||||
bitmap_data1 += orb_w*orb_h;
|
||||
bitmap_num++;
|
||||
Assert(bitmap_num < MAX_BITMAP_FILES);
|
||||
|
@ -4966,7 +4966,7 @@ void init_hoard_data()
|
|||
icon_h = PHYSFSX_readShort(ifile);
|
||||
MALLOC( bitmap_data2, ubyte, icon_w*icon_h );
|
||||
gr_init_bitmap(Orb_icons[i],BM_LINEAR,0,0,icon_w,icon_h,icon_w,bitmap_data2);
|
||||
gr_set_transparent (&Orb_icons[i], 1);
|
||||
gr_set_transparent(Orb_icons[i], 1);
|
||||
PHYSFS_read(ifile,&palette[0],sizeof(palette[0]),palette.size());
|
||||
PHYSFS_read(ifile,Orb_icons[i].bm_data,1,icon_w*icon_h);
|
||||
gr_remap_bitmap_good( &Orb_icons[i], palette, 255, -1 );
|
||||
|
|
Loading…
Reference in a new issue