From 0905aefa0a1e7ab2a0467dd34efd66dc8c35debb Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 1 Jan 2017 00:45:45 +0000 Subject: [PATCH] Pass canvas to gr_rect --- common/2d/canvas.cpp | 2 +- common/2d/rect.cpp | 9 +++++---- common/editor/autosave.cpp | 2 +- common/include/fwd-gr.h | 2 +- common/ui/button.cpp | 8 ++++---- common/ui/inputbox.cpp | 4 ++-- common/ui/listbox.cpp | 6 +++--- common/ui/scroll.cpp | 4 ++-- d2x-rebirth/main/movie.cpp | 2 +- similar/2d/font.cpp | 2 +- similar/editor/med.cpp | 6 +++--- similar/main/console.cpp | 4 ++-- similar/main/game.cpp | 4 ++-- similar/main/gamerend.cpp | 2 +- similar/main/gauges.cpp | 18 +++++++++--------- similar/main/hud.cpp | 2 +- similar/main/kconfig.cpp | 32 ++++++++++++++++---------------- similar/main/newmenu.cpp | 18 +++++++++--------- similar/main/render.cpp | 6 +++--- 19 files changed, 67 insertions(+), 66 deletions(-) diff --git a/common/2d/canvas.cpp b/common/2d/canvas.cpp index 04480369f..3b32b89a6 100644 --- a/common/2d/canvas.cpp +++ b/common/2d/canvas.cpp @@ -92,7 +92,7 @@ void _gr_set_current_canvas(grs_canvas *canv) void gr_clear_canvas(color_t color) { - gr_rect(0,0,GWIDTH-1,GHEIGHT-1, color); + gr_rect(*grd_curcanv, 0, 0, GWIDTH-1, GHEIGHT-1, color); } void gr_settransblend(grs_canvas &canvas, const int fade_level, const uint8_t blend_func) diff --git a/common/2d/rect.cpp b/common/2d/rect.cpp index 8ff974e12..169dcb106 100644 --- a/common/2d/rect.cpp +++ b/common/2d/rect.cpp @@ -47,16 +47,17 @@ void gr_urect(grs_canvas &canvas, const int left, const int top, const int right #endif } -void gr_rect(int left,int top,int right,int bot, const uint8_t color) +void gr_rect(grs_canvas &canvas, const int left, const int top, const int right, const int bot, const uint8_t color) { #if DXX_USE_OGL - if (TYPE == bm_mode::ogl) { - ogl_urect(*grd_curcanv, left, top, right, bot, color); + if (canvas.cv_bitmap.get_type() == bm_mode::ogl) + { + ogl_urect(canvas, left, top, right, bot, color); return; } #endif for ( int i=top; i<=bot; i++ ) - gr_scanline(*grd_curcanv, left, right, i, color); + gr_scanline(canvas, left, right, i, color); } } diff --git a/common/editor/autosave.cpp b/common/editor/autosave.cpp index 17f78d151..69b24a4f6 100644 --- a/common/editor/autosave.cpp +++ b/common/editor/autosave.cpp @@ -121,7 +121,7 @@ static void print_clock() message[0] = 0; gr_get_string_size(message.data(), &w, &h, nullptr); const uint8_t color = CGREY; - gr_rect( 700, 0, 799, h+1, color); + gr_rect(*grd_curcanv, 700, 0, 799, h + 1, color); gr_string(700, 0, message.data()); gr_set_fontcolor( CBLACK, CWHITE ); } diff --git a/common/include/fwd-gr.h b/common/include/fwd-gr.h index b8a22fad9..5dac4348f 100644 --- a/common/include/fwd-gr.h +++ b/common/include/fwd-gr.h @@ -221,7 +221,7 @@ void gr_ubitmapm(grs_canvas &, unsigned x, unsigned y, grs_bitmap &bm); #endif // Draw a rectangle into the current canvas. -void gr_rect(int left,int top,int right,int bot, uint8_t color); +void gr_rect(grs_canvas &, int left,int top,int right,int bot, uint8_t color); void gr_urect(grs_canvas &, int left,int top,int right,int bot, uint8_t color); // Draw a filled circle diff --git a/common/ui/button.cpp b/common/ui/button.cpp index c1c95b46c..4ea1d782a 100644 --- a/common/ui/button.cpp +++ b/common/ui/button.cpp @@ -83,16 +83,16 @@ void ui_draw_button(UI_DIALOG *dlg, UI_GADGET_BUTTON * button) ui_draw_box_out( 0, 0, button->width-1, button->height-1 ); ui_string_centered(Middle(button->width), Middle(button->height), button->text.c_str()); } else { - gr_rect( 0, 0, button->width, button->height, CBLACK); - gr_rect( 1, 1, button->width-1, button->height-1, color); + gr_rect(*grd_curcanv, 0, 0, button->width, button->height, CBLACK); + gr_rect(*grd_curcanv, 1, 1, button->width-1, button->height-1, color); } } else { if (!button->text.empty()) { ui_draw_box_in( 0, 0, button->width-1, button->height-1 ); ui_string_centered(Middle(button->width)+1, Middle(button->height)+1, button->text.c_str()); } else { - gr_rect( 0, 0, button->width, button->height, CBLACK); - gr_rect( 2, 2, button->width, button->height, color); + gr_rect(*grd_curcanv, 0, 0, button->width, button->height, CBLACK); + gr_rect(*grd_curcanv, 2, 2, button->width, button->height, color); } } } diff --git a/common/ui/inputbox.cpp b/common/ui/inputbox.cpp index 6d0af4a79..64f3d7367 100644 --- a/common/ui/inputbox.cpp +++ b/common/ui/inputbox.cpp @@ -40,7 +40,7 @@ void ui_draw_inputbox( UI_DIALOG *dlg, UI_GADGET_INPUTBOX * inputbox ) { gr_set_current_canvas( inputbox->canvas ); - gr_rect( 0, 0, inputbox->width-1, inputbox->height-1, CBLACK); + gr_rect(*grd_curcanv, 0, 0, inputbox->width-1, inputbox->height-1, CBLACK); int w, h; gr_get_string_size(inputbox->text.get(), &w, &h, nullptr); @@ -49,7 +49,7 @@ void ui_draw_inputbox( UI_DIALOG *dlg, UI_GADGET_INPUTBOX * inputbox ) if (inputbox->first_time) { gr_set_fontcolor( CBLACK, -1 ); - gr_rect(2, 2, 2 + w, 2 + h, CRED); + gr_rect(*grd_curcanv, 2, 2, 2 + w, 2 + h, CRED); } else gr_set_fontcolor( CRED, -1 ); diff --git a/common/ui/listbox.cpp b/common/ui/listbox.cpp index 557b866ce..a0763e183 100644 --- a/common/ui/listbox.cpp +++ b/common/ui/listbox.cpp @@ -57,7 +57,7 @@ void ui_draw_listbox( UI_DIALOG *dlg, UI_GADGET_LISTBOX * listbox ) w = listbox->width; h = listbox->height; - gr_rect( 0, 0, w-1, h-1, CBLACK); + gr_rect(*grd_curcanv, 0, 0, w-1, h-1, CBLACK); gr_draw_sunken_border( -2, -2, w+listbox->scrollbar->width+4, h+1); @@ -73,7 +73,7 @@ void ui_draw_listbox( UI_DIALOG *dlg, UI_GADGET_LISTBOX * listbox ) uint8_t color = (i == listbox->current_item) ? CGREY : CBLACK; - gr_rect(x, y, listbox->width - 1, y + h - 1, color); + gr_rect(*grd_curcanv, x, y, listbox->width - 1, y + h - 1, color); if (i !=listbox->current_item) { @@ -96,7 +96,7 @@ void ui_draw_listbox( UI_DIALOG *dlg, UI_GADGET_LISTBOX * listbox ) if (stop < listbox->num_items_displayed-1 ) { - gr_rect( x, y, listbox->width-1, listbox->height-1, CBLACK); + gr_rect(*grd_curcanv, x, y, listbox->width-1, listbox->height-1, CBLACK); } //gr_ubox( -1, -1, listbox->width, listbox->height); diff --git a/common/ui/scroll.cpp b/common/ui/scroll.cpp index 7c611398b..98a974414 100644 --- a/common/ui/scroll.cpp +++ b/common/ui/scroll.cpp @@ -45,8 +45,8 @@ void ui_draw_scrollbar( UI_DIALOG *dlg, UI_GADGET_SCROLLBAR * scrollbar ) ? CRED : CGREY; - gr_rect(0, 0, scrollbar->width-1, scrollbar->fake_position-1, color); - gr_rect(0, scrollbar->fake_position+scrollbar->fake_size, scrollbar->width-1, scrollbar->height-1, color); + gr_rect(*grd_curcanv, 0, 0, scrollbar->width-1, scrollbar->fake_position-1, color); + gr_rect(*grd_curcanv, 0, scrollbar->fake_position+scrollbar->fake_size, scrollbar->width-1, scrollbar->height-1, color); ui_draw_box_out(0, scrollbar->fake_position, scrollbar->width-1, scrollbar->fake_position+scrollbar->fake_size-1 ); } diff --git a/d2x-rebirth/main/movie.cpp b/d2x-rebirth/main/movie.cpp index 19be2e7b6..2a02af76e 100644 --- a/d2x-rebirth/main/movie.cpp +++ b/d2x-rebirth/main/movie.cpp @@ -662,7 +662,7 @@ static void draw_subtitles(int frame_num) //erase old subtitles if necessary if (must_erase) { - gr_rect(0,y,grd_curcanv->cv_bitmap.bm_w-1,grd_curcanv->cv_bitmap.bm_h-1, 0); + gr_rect(*grd_curcanv, 0,y,grd_curcanv->cv_bitmap.bm_w-1,grd_curcanv->cv_bitmap.bm_h-1, 0); } //now draw the current subtitles diff --git a/similar/2d/font.cpp b/similar/2d/font.cpp index cc3631940..40582fa26 100644 --- a/similar/2d/font.cpp +++ b/similar/2d/font.cpp @@ -663,7 +663,7 @@ static int ogl_internal_string(int x, int y, const char *s ) if (underline) { const uint8_t color = grd_curcanv->cv_font_fg_color; - gr_rect(xx, yy + cv_font.ft_baseline + 2, xx + cv_font.ft_w, yy + cv_font.ft_baseline + 3, color); + gr_rect(*grd_curcanv, xx, yy + cv_font.ft_baseline + 2, xx + cv_font.ft_w, yy + cv_font.ft_baseline + 3, color); } continue; diff --git a/similar/editor/med.cpp b/similar/editor/med.cpp index bf85acc95..20fc826f8 100644 --- a/similar/editor/med.cpp +++ b/similar/editor/med.cpp @@ -179,7 +179,7 @@ static void print_status_bar( char message[DIAGNOSTIC_MESSAGE_MAX] ) { gr_get_string_size( message, &w, &h, nullptr); gr_string(4, 583, message, w, h); gr_set_fontcolor( CBLACK, CWHITE ); - gr_rect(4+w, 583, 799, 599, CGREY); + gr_rect(*grd_curcanv, 4+w, 583, 799, 599, CGREY); } static char status_line[DIAGNOSTIC_MESSAGE_MAX] = ""; @@ -1076,7 +1076,7 @@ window_event_result editor_handler(UI_DIALOG *, const d_event &event, unused_ui_ // Draw status box gr_set_current_canvas( NULL ); - gr_rect(STATUS_X,STATUS_Y,STATUS_X+STATUS_W-1,STATUS_Y+STATUS_H-1, CGREY); + gr_rect(*grd_curcanv, STATUS_X,STATUS_Y,STATUS_X+STATUS_W-1,STATUS_Y+STATUS_H-1, CGREY); medlisp_update_screen(); calc_frame_time(); @@ -1289,7 +1289,7 @@ window_event_result editor_handler(UI_DIALOG *, const d_event &event, unused_ui_ y = GameViewBox->b1_drag_y2; gr_set_current_canvas( GameViewBox->canvas ); - gr_rect( x-1, y-1, x+1, y+1, 15); + gr_rect(*grd_curcanv, x-1, y-1, x+1, y+1, 15); } // Set current segment and side by clicking on a polygon in game window. diff --git a/similar/main/console.cpp b/similar/main/console.cpp index b230b7d00..655a34d3f 100644 --- a/similar/main/console.cpp +++ b/similar/main/console.cpp @@ -166,7 +166,7 @@ static void con_draw(void) const auto &&fspacy1 = FSPACY(1); const auto &&line_spacing = LINE_SPACING; y = fspacy1 + (line_spacing * con_size); - gr_rect(0, 0, SWIDTH, y, color); + gr_rect(*grd_curcanv, 0, 0, SWIDTH, y, color); gr_settransblend(*grd_curcanv, GR_FADE_OFF, GR_BLEND_NORMAL); i+=con_scroll_offset; @@ -188,7 +188,7 @@ static void con_draw(void) if (y<=0 || CON_LINES_MAX-1-i <= 0 || i < 0) break; } - gr_rect(0, 0, SWIDTH, line_spacing, color); + gr_rect(*grd_curcanv, 0, 0, SWIDTH, line_spacing, color); gr_set_fontcolor(BM_XRGB(255,255,255),-1); gr_printf(fspacx1, fspacy1, "%s LOG", DESCENT_VERSION); gr_string(SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL"); diff --git a/similar/main/game.cpp b/similar/main/game.cpp index c359df29d..33af2b915 100644 --- a/similar/main/game.cpp +++ b/similar/main/game.cpp @@ -238,8 +238,8 @@ void init_cockpit() const unsigned y = (gsm_height - h) / 2; const uint8_t color = 0; - gr_rect(x, 0, w, gsm_height - h, color); - gr_rect(x, gsm_height - h, w, gsm_height, color); + gr_rect(*grd_curcanv, x, 0, w, gsm_height - h, color); + gr_rect(*grd_curcanv, x, gsm_height - h, w, gsm_height, color); game_init_render_sub_buffers( x, y, w, h ); break; diff --git a/similar/main/gamerend.cpp b/similar/main/gamerend.cpp index 28e619bd1..ce20bfa61 100644 --- a/similar/main/gamerend.cpp +++ b/similar/main/gamerend.cpp @@ -148,7 +148,7 @@ static void show_netplayerinfo() gr_settransblend(*grd_curcanv, 14, GR_BLEND_NORMAL); const uint8_t color000 = BM_XRGB(0, 0, 0); - gr_rect((SWIDTH / 2) - fspacx120, (SHEIGHT / 2) - fspacy84, (SWIDTH / 2) + fspacx120, (SHEIGHT / 2) + fspacy84, color000); + gr_rect(*grd_curcanv, (SWIDTH / 2) - fspacx120, (SHEIGHT / 2) - fspacy84, (SWIDTH / 2) + fspacx120, (SHEIGHT / 2) + fspacy84, color000); gr_settransblend(*grd_curcanv, GR_FADE_OFF, GR_BLEND_NORMAL); // general game information diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index 6dccef8ff..6ab925dfc 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -779,7 +779,7 @@ static void sb_show_score(const player_info &player_info, const local_multires_g //erase old score const uint8_t color = BM_XRGB(0, 0, 0); - gr_rect(x,y,HUD_SCALE_X(SB_SCORE_RIGHT),y+LINE_SPACING, color); + gr_rect(*grd_curcanv, x,y,HUD_SCALE_X(SB_SCORE_RIGHT),y+LINE_SPACING, color); gr_string(x, y, score_str, w, h); } @@ -821,7 +821,7 @@ static void sb_show_score_added(const local_multires_gauge_graphic multires_gaug } else { //erase old score const uint8_t color = BM_XRGB(0, 0, 0); - gr_rect(x,HUD_SCALE_Y(SB_SCORE_ADDED_Y),HUD_SCALE_X(SB_SCORE_ADDED_RIGHT),HUD_SCALE_Y(SB_SCORE_ADDED_Y)+LINE_SPACING, color); + gr_rect(*grd_curcanv, x,HUD_SCALE_Y(SB_SCORE_ADDED_Y),HUD_SCALE_X(SB_SCORE_ADDED_RIGHT),HUD_SCALE_Y(SB_SCORE_ADDED_Y)+LINE_SPACING, color); score_time = 0; score_display = 0; } @@ -1654,7 +1654,7 @@ static void sb_show_lives(const player_info &player_info, const local_multires_g int w, h; gr_get_string_size(killed_str, &w, &h, nullptr); const auto x = HUD_SCALE_X(SB_SCORE_RIGHT)-w-FSPACX(1); - gr_rect(exchange(last_x[multires_gauge_graphic.is_hires()], x), HUD_SCALE_Y(y), HUD_SCALE_X(SB_SCORE_RIGHT), HUD_SCALE_Y(y)+LINE_SPACING, color); + gr_rect(*grd_curcanv, exchange(last_x[multires_gauge_graphic.is_hires()], x), HUD_SCALE_Y(y), HUD_SCALE_X(SB_SCORE_RIGHT), HUD_SCALE_Y(y)+LINE_SPACING, color); gr_string(x, HUD_SCALE_Y(y), killed_str, w, h); return; } @@ -1662,7 +1662,7 @@ static void sb_show_lives(const player_info &player_info, const local_multires_g const int x = SB_LIVES_X; //erase old icons auto &bm = GameBitmaps[GET_GAUGE_INDEX(GAUGE_LIVES)]; - gr_rect(HUD_SCALE_X(x), HUD_SCALE_Y(y), HUD_SCALE_X(SB_SCORE_RIGHT), HUD_SCALE_Y(y + bm.bm_h), color); + gr_rect(*grd_curcanv, HUD_SCALE_X(x), HUD_SCALE_Y(y), HUD_SCALE_X(SB_SCORE_RIGHT), HUD_SCALE_Y(y + bm.bm_h), color); if (get_local_player().lives-1 > 0) { gr_set_curfont( GAME_FONT ); @@ -2057,7 +2057,7 @@ static void draw_afterburner_bar(int afterburner, const local_multires_gauge_gra const int right = HUD_SCALE_X(afterburner_gauge_x + ab.r + 1); for (int i = HUD_SCALE_Y(y), j = HUD_SCALE_Y(++y); i < j; ++i) { - gr_rect (left, base_top + i, right, base_bottom + i, color); + gr_rect (*grd_curcanv, left, base_top + i, right, base_bottom + i, color); } } gr_set_current_canvas( NULL ); @@ -2142,7 +2142,7 @@ static void draw_player_ship(const player_info &player_info, const int cloak_sta auto &bm = GameBitmaps[GET_GAUGE_INDEX(GAUGE_SHIPS+color)]; hud_bitblt( HUD_SCALE_X(x), HUD_SCALE_Y(y), bm, multires_gauge_graphic); gr_settransblend(*grd_curcanv, cloak_fade_value, GR_BLEND_NORMAL); - gr_rect(HUD_SCALE_X(x - 3), HUD_SCALE_Y(y - 3), HUD_SCALE_X(x + bm.bm_w + 3), HUD_SCALE_Y(y + bm.bm_h + 3), 0); + gr_rect(*grd_curcanv, HUD_SCALE_X(x - 3), HUD_SCALE_Y(y - 3), HUD_SCALE_X(x + bm.bm_w + 3), HUD_SCALE_Y(y + bm.bm_h + 3), 0); gr_settransblend(*grd_curcanv, GR_FADE_OFF, GR_BLEND_NORMAL); gr_set_current_canvas( NULL ); @@ -2200,9 +2200,9 @@ static void draw_weapon_info_sub(const player_info &player_info, const int info_ //clear the window const uint8_t color = BM_XRGB(0, 0, 0); #if defined(DXX_BUILD_DESCENT_I) - gr_rect(HUD_SCALE_X(box->left),HUD_SCALE_Y(box->top),HUD_SCALE_X(box->right),HUD_SCALE_Y(box->bot+1), color); + gr_rect(*grd_curcanv, HUD_SCALE_X(box->left),HUD_SCALE_Y(box->top),HUD_SCALE_X(box->right),HUD_SCALE_Y(box->bot+1), color); #elif defined(DXX_BUILD_DESCENT_II) - gr_rect(HUD_SCALE_X(box->left),HUD_SCALE_Y(box->top),HUD_SCALE_X(box->right),HUD_SCALE_Y(box->bot), color); + gr_rect(*grd_curcanv, HUD_SCALE_X(box->left),HUD_SCALE_Y(box->top),HUD_SCALE_X(box->right),HUD_SCALE_Y(box->bot), color); #endif const auto &picture = #if defined(DXX_BUILD_DESCENT_II) @@ -2414,7 +2414,7 @@ static void draw_weapon_box(const player_info &player_info, const int weapon_typ int boxofs = (PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX; gr_settransblend(*grd_curcanv, fade_value, GR_BLEND_NORMAL); - gr_rect(HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].left),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].top),HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].right),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].bot), 0); + gr_rect(*grd_curcanv, HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].left),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].top),HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].right),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].bot), 0); gr_settransblend(*grd_curcanv, GR_FADE_OFF, GR_BLEND_NORMAL); } diff --git a/similar/main/hud.cpp b/similar/main/hud.cpp index 0a2774e04..db8ac6178 100644 --- a/similar/main/hud.cpp +++ b/similar/main/hud.cpp @@ -258,7 +258,7 @@ void player_dead_message(void) gr_settransblend(*grd_curcanv, 14, GR_BLEND_NORMAL); const uint8_t color = BM_XRGB(0, 0, 0); - gr_rect(x, y, x + w, y + h, color); + gr_rect(*grd_curcanv, x, y, x + w, y + h, color); gr_settransblend(*grd_curcanv, GR_FADE_OFF, GR_BLEND_NORMAL); gr_string(0x8000, (GHEIGHT - h)/2 + h/8, TXT_GAME_OVER, gw, gh); diff --git a/similar/main/kconfig.cpp b/similar/main/kconfig.cpp index c93765aa8..d2c419b6b 100644 --- a/similar/main/kconfig.cpp +++ b/similar/main/kconfig.cpp @@ -904,18 +904,18 @@ static void kconfig_draw(kc_menu *menu) const auto &&fspacx98 = fspacx(98); const auto &&fspacx128 = fspacx(128); const auto &&fspacy42 = fspacy(42); - gr_rect(fspacx98, fspacy42, fspacx(106), fspacy42, color); // horiz/left - gr_rect(fspacx(120), fspacy42, fspacx128, fspacy42, color); // horiz/right + gr_rect(*grd_curcanv, fspacx98, fspacy42, fspacx(106), fspacy42, color); // horiz/left + gr_rect(*grd_curcanv, fspacx(120), fspacy42, fspacx128, fspacy42, color); // horiz/right const auto &&fspacy44 = fspacy(44); - gr_rect(fspacx98, fspacy42, fspacx98, fspacy44, color); // vert/left - gr_rect(fspacx128, fspacy42, fspacx128, fspacy44, color); // vert/right + gr_rect(*grd_curcanv, fspacx98, fspacy42, fspacx98, fspacy44, color); // vert/left + gr_rect(*grd_curcanv, fspacx128, fspacy42, fspacx128, fspacy44, color); // vert/right const auto &&fspacx253 = fspacx(253); const auto &&fspacx283 = fspacx(283); - gr_rect(fspacx253, fspacy42, fspacx(261), fspacy42, color); // horiz/left - gr_rect(fspacx(275), fspacy42, fspacx283, fspacy42, color); // horiz/right - gr_rect(fspacx253, fspacy42, fspacx253, fspacy44, color); // vert/left - gr_rect(fspacx283, fspacy42, fspacx283, fspacy44, color); // vert/right + gr_rect(*grd_curcanv, fspacx253, fspacy42, fspacx(261), fspacy42, color); // horiz/left + gr_rect(*grd_curcanv, fspacx(275), fspacy42, fspacx283, fspacy42, color); // horiz/right + gr_rect(*grd_curcanv, fspacx253, fspacy42, fspacx253, fspacy44, color); // vert/left + gr_rect(*grd_curcanv, fspacx283, fspacy42, fspacx283, fspacy44, color); // vert/right kc_gr_2y_string("OR", fspacy(40), fspacx(109), fspacx(264)); } @@ -939,19 +939,19 @@ static void kconfig_draw(kc_menu *menu) const uint8_t color = BM_XRGB(31, 27, 6); const auto &&fspacx115 = fspacx(115); const auto &&fspacy40 = fspacy(40); - gr_rect(fspacx115, fspacy40, fspacx(123), fspacy40, color); // horiz/left + gr_rect(*grd_curcanv, fspacx115, fspacy40, fspacx(123), fspacy40, color); // horiz/left const auto &&fspacx145 = fspacx(145); - gr_rect(fspacx(137), fspacy40, fspacx145, fspacy40, color); // horiz/right + gr_rect(*grd_curcanv, fspacx(137), fspacy40, fspacx145, fspacy40, color); // horiz/right const auto &&fspacx261 = fspacx(261); - gr_rect(fspacx261, fspacy40, fspacx(269), fspacy40, color); // horiz/left + gr_rect(*grd_curcanv, fspacx261, fspacy40, fspacx(269), fspacy40, color); // horiz/left const auto &&fspacx291 = fspacx(291); - gr_rect(fspacx(283), fspacy40, fspacx291, fspacy40, color); // horiz/right + gr_rect(*grd_curcanv, fspacx(283), fspacy40, fspacx291, fspacy40, color); // horiz/right const auto &&fspacy42 = fspacy(42); - gr_rect(fspacx115, fspacy40, fspacx115, fspacy42, color); // vert/left - gr_rect(fspacx145, fspacy40, fspacx145, fspacy42, color); // vert/right - gr_rect(fspacx261, fspacy40, fspacx261, fspacy42, color); // vert/left - gr_rect(fspacx291, fspacy40, fspacx291, fspacy42, color); // vert/right + gr_rect(*grd_curcanv, fspacx115, fspacy40, fspacx115, fspacy42, color); // vert/left + gr_rect(*grd_curcanv, fspacx145, fspacy40, fspacx145, fspacy42, color); // vert/right + gr_rect(*grd_curcanv, fspacx261, fspacy40, fspacx261, fspacy42, color); // vert/left + gr_rect(*grd_curcanv, fspacx291, fspacy40, fspacx291, fspacy42, color); // vert/right const auto &&fspacy38 = fspacy(38); kc_gr_2y_string("OR", fspacy38, fspacx(126), fspacx(272)); diff --git a/similar/main/newmenu.cpp b/similar/main/newmenu.cpp index 579ac45c4..44ec29d8d 100644 --- a/similar/main/newmenu.cpp +++ b/similar/main/newmenu.cpp @@ -307,15 +307,15 @@ static void nm_string_black( int w1,int x, int y, const char * s ) const auto &&fspacy = FSPACY(); { const uint8_t color = BM_XRGB(5, 5, 5); - gr_rect(x - fspacx(2), y - fspacy(1), x + w1, y + h, color); + gr_rect(*grd_curcanv, x - fspacx(2), y - fspacy(1), x + w1, y + h, color); } { const uint8_t color = BM_XRGB(2, 2, 2); - gr_rect(x - fspacx(2), y - fspacy(1), x, y + h, color); + gr_rect(*grd_curcanv, x - fspacx(2), y - fspacy(1), x, y + h, color); } { const uint8_t color = BM_XRGB(0, 0, 0); - gr_rect(x - fspacx(1), y - fspacy(1), x + w1 - fspacx(1), y + h, color); + gr_rect(*grd_curcanv, x - fspacx(1), y - fspacy(1), x + w1 - fspacx(1), y + h, color); } gr_string(x, y, s, w, h); @@ -1967,14 +1967,14 @@ static window_event_result listbox_draw(window *, listbox *lb) const uint8_t color2 = BM_XRGB(2, 2, 2); const uint8_t color0 = BM_XRGB(0, 0, 0); if ( i >= lb->nitems ) { - gr_rect(lb->box_x + lb->box_w - fspacx(1), y - fspacy(1), lb->box_x + lb->box_w, y + line_spacing, color5); - gr_rect(lb->box_x - fspacx(1), y - fspacy(1), lb->box_x, y + line_spacing, color2); - gr_rect(lb->box_x, y - fspacy(1), lb->box_x + lb->box_w - fspacx(1), y + line_spacing, color0); + gr_rect(*grd_curcanv, lb->box_x + lb->box_w - fspacx(1), y - fspacy(1), lb->box_x + lb->box_w, y + line_spacing, color5); + gr_rect(*grd_curcanv, lb->box_x - fspacx(1), y - fspacy(1), lb->box_x, y + line_spacing, color2); + gr_rect(*grd_curcanv, lb->box_x, y - fspacy(1), lb->box_x + lb->box_w - fspacx(1), y + line_spacing, color0); } else { gr_set_curfont(( i == lb->citem )?MEDIUM2_FONT:MEDIUM1_FONT); - gr_rect(lb->box_x + lb->box_w - fspacx(1), y - fspacy(1), lb->box_x + lb->box_w, y + line_spacing, color5); - gr_rect(lb->box_x - fspacx(1), y - fspacy(1), lb->box_x, y + line_spacing, color2); - gr_rect(lb->box_x, y - fspacy(1), lb->box_x + lb->box_w - fspacx(1), y + line_spacing, color0); + gr_rect(*grd_curcanv, lb->box_x + lb->box_w - fspacx(1), y - fspacy(1), lb->box_x + lb->box_w, y + line_spacing, color5); + gr_rect(*grd_curcanv, lb->box_x - fspacx(1), y - fspacy(1), lb->box_x, y + line_spacing, color2); + gr_rect(*grd_curcanv, lb->box_x, y - fspacy(1), lb->box_x + lb->box_w - fspacx(1), y + line_spacing, color0); RAIIdmem shrtstr; const char *showstr; diff --git a/similar/main/render.cpp b/similar/main/render.cpp index 409b2f8ae..0800ca640 100644 --- a/similar/main/render.cpp +++ b/similar/main/render.cpp @@ -576,7 +576,7 @@ static void render_object_search(const vobjptridx_t obj) // Point smoothing would change the pixel to dark grey, but it MUST be black. // Making a 3x3 rectangle wouldn't matter // (but it only seems to draw a single pixel anyway) - gr_rect(_search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1, color); + gr_rect(*grd_curcanv, _search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1, color); ogl_start_frame(); #else @@ -591,7 +591,7 @@ static void render_object_search(const vobjptridx_t obj) const uint8_t color = 1; #if DXX_USE_OGL ogl_end_frame(); - gr_rect(_search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1, color); + gr_rect(*grd_curcanv, _search_x - 1, _search_y - 1, _search_x + 1, _search_y + 1, color); ogl_start_frame(); #else gr_pixel(*grd_curcanv, _search_x, _search_y, color); @@ -1510,7 +1510,7 @@ void render_mine(const vcsegidx_t start_seg_num,fix eye_offset, window_rendered_ else #endif //NOTE LINK TO ABOVE! - gr_rect(rw.left, rw.top, rw.right, rw.bot, color); + gr_rect(*grd_curcanv, rw.left, rw.top, rw.right, rw.bot, color); } } }