Pass color to gr_ubox

This commit is contained in:
Kp 2016-02-12 04:02:28 +00:00
parent 23047b1165
commit de08a67321
5 changed files with 13 additions and 17 deletions

View file

@ -26,7 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
namespace dcx {
static void gr_ubox0(int left,int top,int right,int bot)
static void gr_ubox0(int left,int top,int right,int bot, const uint8_t color)
{
int d;
unsigned char * ptr2;
@ -34,7 +34,6 @@ static void gr_ubox0(int left,int top,int right,int bot)
ptr2 = ptr1;
d = right - left;
const auto color = COLOR;
std::fill_n(ptr1 + 1, (right - left) - 1, color);
for (uint_fast32_t i = bot - top + 1; i--;)
{
@ -53,7 +52,8 @@ static void gr_box0(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uin
if (bot > MAXY ) bot = MAXY;
if (right > MAXX ) right = MAXX;
gr_ubox0(left,top,right,bot);
const auto color = COLOR;
gr_ubox0(left,top,right,bot, color);
}
@ -92,10 +92,10 @@ static void gr_box12(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,ui
}
void gr_ubox(int left,int top,int right,int bot)
void gr_ubox(int left,int top,int right,int bot, const uint8_t color)
{
if (TYPE==BM_LINEAR)
gr_ubox0( left, top, right, bot );
gr_ubox0(left, top, right, bot, color);
else
gr_ubox12( left, top, right, bot );
}

View file

@ -229,7 +229,7 @@ int gr_ucircle(fix x,fix y,fix r);
// Draw an unfilled rectangle into the current canvas
void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot);
void gr_ubox(int left,int top,int right,int bot);
void gr_ubox(int left,int top,int right,int bot, uint8_t color);
void gr_scanline(int x1, int x2, unsigned y, uint8_t color);
#ifndef OGL

View file

@ -136,7 +136,7 @@ static void menu_draw(MENU *menu)
if ( menu != &Menu[0] )
{
gr_setcolor( CBLACK );
gr_ubox( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
gr_ubox(menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1, CBLACK);
}
// Draw the items

View file

@ -41,12 +41,11 @@ void ui_draw_userbox( UI_DIALOG *dlg, UI_GADGET_USERBOX * userbox )
gr_set_current_canvas( userbox->canvas );
if (dlg->keyboard_focus_gadget == userbox)
gr_setcolor( CRED );
else
gr_setcolor( CBRIGHT );
gr_ubox( -1, -1, userbox->width, userbox->height );
const uint8_t color = (dlg->keyboard_focus_gadget == userbox)
? CRED
: CBRIGHT;
gr_setcolor(color);
gr_ubox(-1, -1, userbox->width, userbox->height, color);
}
}

View file

@ -3316,10 +3316,7 @@ void do_cockpit_window_view(int win,const vobjptr_t viewer,int rear_view_flag,in
if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
int small_window_bottom,big_window_bottom,extra_part_h;
{
gr_setcolor(BM_XRGB(0,0,32));
gr_ubox(0,0,grd_curcanv->cv_bitmap.bm_w,grd_curcanv->cv_bitmap.bm_h);
}
gr_ubox(0, 0, grd_curcanv->cv_bitmap.bm_w, grd_curcanv->cv_bitmap.bm_h, BM_XRGB(0,0,32));
//if the window only partially overlaps the big 3d window, copy
//the extra part to the visible screen