Pass canvas to show_fullscr

This commit is contained in:
Kp 2017-01-01 00:45:43 +00:00
parent 250bf58e51
commit 1b57e9a5ff
8 changed files with 18 additions and 18 deletions

View file

@ -486,14 +486,14 @@ inside:
}
}
void show_fullscr(grs_bitmap &bm)
void show_fullscr(grs_canvas &canvas, grs_bitmap &bm)
{
auto &scr = grd_curcanv->cv_bitmap;
auto &scr = canvas.cv_bitmap;
#if DXX_USE_OGL
if (bm.get_type() == bm_mode::linear && scr.get_type() == bm_mode::ogl &&
bm.bm_w <= grd_curscreen->get_screen_width() && bm.bm_h <= grd_curscreen->get_screen_height()) // only scale with OGL if bitmap is not bigger than screen size
{
ogl_ubitmapm_cs(*grd_curcanv, 0, 0, -1, -1, bm, ogl_colors::white, F1_0);//use opengl to scale, faster and saves ram. -MPM
ogl_ubitmapm_cs(canvas, 0, 0, -1, -1, bm, ogl_colors::white, F1_0);//use opengl to scale, faster and saves ram. -MPM
return;
}
#endif
@ -502,7 +502,7 @@ void show_fullscr(grs_bitmap &bm)
grs_bitmap_ptr p = gr_create_bitmap(scr.bm_w, scr.bm_h);
auto &tmp = *p.get();
gr_bitmap_scale_to(bm, tmp);
gr_bitmap(*grd_curcanv, 0, 0, tmp);
gr_bitmap(canvas, 0, 0, tmp);
return;
}
gr_bitmap_scale_to(bm, scr);

View file

@ -208,7 +208,7 @@ void gr_uline(grs_canvas &canvas, fix x0,fix y0,fix x1,fix y1, uint8_t color);
// Draw the bitmap into the current canvas at the specified location.
void gr_bitmap(grs_canvas &, unsigned x,unsigned y,grs_bitmap &bm);
void gr_ubitmap(grs_canvas &, grs_bitmap &bm);
void show_fullscr(grs_bitmap &bm);
void show_fullscr(grs_canvas &, grs_bitmap &bm);
// Find transparent area in bitmap
void gr_bitblt_find_transparent_area(const grs_bitmap &bm, unsigned &minx, unsigned &miny, unsigned &maxx, unsigned &maxy);

View file

@ -624,7 +624,7 @@ static void draw_automap(automap *am)
am->leave_mode = 1;
gr_set_current_canvas(NULL);
show_fullscr(am->automap_background);
show_fullscr(*grd_curcanv, am->automap_background);
gr_set_curfont(HUGE_FONT);
gr_set_fontcolor(BM_XRGB(20, 20, 20), -1);
{

View file

@ -183,7 +183,7 @@ static window_event_result credits_handler(window *, const d_event &event, credi
}
y = cr->first_line_offset - cr->row;
show_fullscr(cr->backdrop);
show_fullscr(*grd_curcanv, cr->backdrop);
for (uint_fast32_t j=0; j != NUM_LINES; ++j, y += ROW_SPACING)
{
l = (cr->buffer_line + j + 1 ) % NUM_LINES;
@ -252,7 +252,7 @@ static void credits_show_common(RAIIPHYSFS_File file, const int have_bin_file)
gr_remap_bitmap_good(cr->backdrop,backdrop_palette, -1, -1);
gr_set_current_canvas(NULL);
show_fullscr(cr->backdrop);
show_fullscr(*grd_curcanv, cr->backdrop);
gr_palette_load( gr_palette );
key_flush();

View file

@ -1023,7 +1023,7 @@ static int draw_endlevel_background(newmenu *,const d_event &event, grs_bitmap *
{
case EVENT_WINDOW_DRAW:
gr_set_current_canvas(NULL);
show_fullscr(*background);
show_fullscr(*grd_curcanv, *background);
break;
default:

View file

@ -187,7 +187,7 @@ static void kmatrix_redraw(kmatrix_screen *km)
playernum_array_t sorted;
gr_set_current_canvas(NULL);
show_fullscr(km->background);
show_fullscr(*grd_curcanv, km->background);
if (Game_mode & GM_MULTI_COOP)
{

View file

@ -142,7 +142,7 @@ static void nm_draw_background1(const char * filename)
(void)pcx_error;
}
gr_palette_load( gr_palette );
show_fullscr(nm_background1);
show_fullscr(*grd_curcanv, nm_background1);
}
#if defined(DXX_BUILD_DESCENT_II)
strcpy(last_palette_loaded,""); //force palette load next time
@ -191,14 +191,14 @@ void nm_draw_background(int x1, int y1, int x2, int y2 )
gr_set_current_canvas(tmp);
gr_palette_load( gr_palette );
show_fullscr(nm_background); // show so we load all necessary data for the sub-bitmap
show_fullscr(*grd_curcanv, nm_background); // show so we load all necessary data for the sub-bitmap
if (!init_sub && ((nm_background_sub->bm_w != w*((static_cast<float>(nm_background.bm_w))/SWIDTH)) || (nm_background_sub->bm_h != h*((static_cast<float>(nm_background.bm_h))/SHEIGHT))))
{
init_sub=1;
}
if (init_sub)
nm_background_sub = gr_create_sub_bitmap(nm_background,0,0,w*((static_cast<float>(nm_background.bm_w))/SWIDTH),h*((static_cast<float>(nm_background.bm_h))/SHEIGHT));
show_fullscr(*nm_background_sub.get());
show_fullscr(*grd_curcanv, *nm_background_sub.get());
gr_set_current_canvas(old);

View file

@ -143,7 +143,7 @@ static window_event_result title_handler(window *, const d_event &event, title_s
case EVENT_WINDOW_DRAW:
gr_set_current_canvas( NULL );
show_fullscr(ts->title_bm);
show_fullscr(*grd_curcanv, ts->title_bm);
break;
case EVENT_WINDOW_CLOSE:
@ -1129,7 +1129,7 @@ static void show_briefing_bitmap(grs_bitmap *bmp)
auto bitmap_canv = gr_create_sub_canvas(*grd_curcanv, rescale_x(220), rescale_y(55), bmp->bm_w*scale, bmp->bm_h*scale);
curcanv_save = grd_curcanv;
gr_set_current_canvas(bitmap_canv);
show_fullscr(*bmp);
show_fullscr(*grd_curcanv, *bmp);
gr_set_current_canvas(curcanv_save);
}
@ -1282,7 +1282,7 @@ static int load_briefing_screen(briefing *br, const char *fname)
gr_palette[0].r = gr_palette[0].g = gr_palette[0].b = 0;
gr_palette[255].r = gr_palette[255].g = gr_palette[255].b = 63;
}
show_fullscr(br->background);
show_fullscr(*grd_curcanv, br->background);
gr_palette_load(gr_palette);
set_briefing_fontcolor(NULL);
@ -1303,7 +1303,7 @@ static int load_briefing_screen(briefing *br, const char *fname)
if ((pcx_error = pcx_read_bitmap(fname, br->background, gr_palette))!=PCX_ERROR_NONE)
Error( "Error loading briefing screen <%s>, PCX load error: %s (%i)\n",fname, pcx_errormsg(pcx_error), pcx_error);
show_fullscr(br->background);
show_fullscr(*grd_curcanv, br->background);
if (EMULATING_D1 && !d_stricmp(fname, "brief03.pcx")) // HACK, FIXME: D1 missions should use their own palette (PALETTE.256), but texture replacements not complete
gr_use_palette_table("groupa.256");
@ -1524,7 +1524,7 @@ static window_event_result briefing_handler(window *, const d_event &event, brie
check_text_pos(br);
if (br->background.bm_data)
show_fullscr(br->background);
show_fullscr(*grd_curcanv, br->background);
if (br->guy_bitmap_show)
show_briefing_bitmap(&br->guy_bitmap);