From 08de1bbff0be775c06324bea32c7dce3352afb8b Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 12 Feb 2016 04:02:28 +0000 Subject: [PATCH] Remove cv_color It is only ever set to 0 or copied from other canvases. Set it to zero everywhere. --- common/2d/canvas.cpp | 2 -- common/include/gr.h | 1 - common/ui/button.cpp | 3 +-- similar/arch/ogl/gr.cpp | 1 - similar/arch/sdl/gr.cpp | 1 - similar/main/game.cpp | 2 +- similar/main/gauges.cpp | 4 ++-- 7 files changed, 4 insertions(+), 10 deletions(-) diff --git a/common/2d/canvas.cpp b/common/2d/canvas.cpp index b27e4acf3..f4a0def73 100644 --- a/common/2d/canvas.cpp +++ b/common/2d/canvas.cpp @@ -52,7 +52,6 @@ grs_subcanvas_ptr gr_create_sub_canvas(grs_canvas &canv, uint16_t x, uint16_t y, void gr_init_canvas(grs_canvas &canv, unsigned char * pixdata, uint8_t pixtype, uint16_t w, uint16_t h) { - canv.cv_color = 0; canv.cv_fade_level = GR_FADE_OFF; canv.cv_font = NULL; canv.cv_font_fg_color = 0; @@ -63,7 +62,6 @@ void gr_init_canvas(grs_canvas &canv, unsigned char * pixdata, uint8_t pixtype, void gr_init_sub_canvas(grs_canvas &n, grs_canvas &src, uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - n.cv_color = src.cv_color; n.cv_fade_level = src.cv_fade_level; n.cv_font = src.cv_font; n.cv_font_fg_color = src.cv_font_fg_color; diff --git a/common/include/gr.h b/common/include/gr.h index 17bcd47f9..59973d83a 100644 --- a/common/include/gr.h +++ b/common/include/gr.h @@ -101,7 +101,6 @@ struct grs_canvas : prohibit_void_ptr { grs_bitmap cv_bitmap; // the bitmap for this canvas const grs_font * cv_font; // the currently selected font - uint8_t cv_color; // current color short cv_font_fg_color; // current font foreground color (-1==Invisible) short cv_font_bg_color; // current font background color (-1==Invisible) int cv_fade_level; // transparency level diff --git a/common/ui/button.cpp b/common/ui/button.cpp index f27ab069a..8bfa79d9f 100644 --- a/common/ui/button.cpp +++ b/common/ui/button.cpp @@ -63,7 +63,7 @@ void ui_draw_button(UI_DIALOG *dlg, UI_GADGET_BUTTON * button) { ui_button_any_drawn = 1; gr_set_current_canvas( button->canvas ); - color_t color = button->canvas->cv_color; + color_t color = 0; if (dlg->keyboard_focus_gadget == button) gr_set_fontcolor( CRED, -1 ); @@ -95,7 +95,6 @@ void ui_draw_button(UI_DIALOG *dlg, UI_GADGET_BUTTON * button) gr_rect( 2, 2, button->width, button->height, color); } } - button->canvas->cv_color = color; } } diff --git a/similar/arch/ogl/gr.cpp b/similar/arch/ogl/gr.cpp index ccb438164..21b10d18b 100644 --- a/similar/arch/ogl/gr.cpp +++ b/similar/arch/ogl/gr.cpp @@ -780,7 +780,6 @@ int gr_init() grd_curscreen->sc_canvas.cv_bitmap.bm_data = NULL; // Set the mode. - grd_curscreen->sc_canvas.cv_color = 0; grd_curscreen->sc_canvas.cv_fade_level = GR_FADE_OFF; grd_curscreen->sc_canvas.cv_font = NULL; grd_curscreen->sc_canvas.cv_font_fg_color = 0; diff --git a/similar/arch/sdl/gr.cpp b/similar/arch/sdl/gr.cpp index 35b75b3b0..b07b59d5c 100644 --- a/similar/arch/sdl/gr.cpp +++ b/similar/arch/sdl/gr.cpp @@ -189,7 +189,6 @@ int gr_init() sdl_video_flags|=SDL_ASYNCBLIT; // Set the mode. - grd_curscreen->sc_canvas.cv_color = 0; grd_curscreen->sc_canvas.cv_fade_level = GR_FADE_OFF; grd_curscreen->sc_canvas.cv_font = NULL; grd_curscreen->sc_canvas.cv_font_fg_color = 0; diff --git a/similar/main/game.cpp b/similar/main/game.cpp index 1fd937be3..bd501ca83 100644 --- a/similar/main/game.cpp +++ b/similar/main/game.cpp @@ -238,7 +238,7 @@ void init_cockpit() const unsigned x = 0; const unsigned y = (gsm_height - h) / 2; - const auto color = grd_curcanv->cv_color; + const uint8_t color = 0; gr_rect(x, 0, w, gsm_height - h, color); gr_rect(x, gsm_height - h, w, gsm_height, color); diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index bf41c7aae..0cb19f477 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -1981,7 +1981,7 @@ static void draw_player_ship(int cloak_state,int x, int y, const local_multires_ 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(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), grd_curcanv->cv_color); + 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_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL); gr_set_current_canvas( NULL ); @@ -2251,7 +2251,7 @@ static void draw_weapon_box(int weapon_type,int weapon_num) int boxofs = (PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX; gr_settransblend(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), grd_curcanv->cv_color); + 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_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL); }