Pass color to gr_box

This commit is contained in:
Kp 2016-02-12 04:02:28 +00:00
parent 8135577315
commit edd2acc86b
3 changed files with 18 additions and 16 deletions

View file

@ -44,19 +44,17 @@ static void gr_ubox0(int left,int top,int right,int bot, const uint8_t color)
std::fill_n(ptr2 + 1, (right - left) - 1, color);
}
static void gr_box0(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot)
#ifdef EDITOR
static void gr_box0(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color)
{
if (top > MAXY ) return;
if (left > MAXX ) return;
if (bot > MAXY ) bot = MAXY;
if (right > MAXX ) right = MAXX;
const auto color = COLOR;
gr_ubox0(left,top,right,bot, color);
}
#endif
static void gr_ubox12(int left,int top,int right,int bot, const uint8_t color)
{
@ -79,18 +77,17 @@ static void gr_ubox12(int left,int top,int right,int bot, const uint8_t color)
gr_uline(i2f(left), i2f(bot), i2f(right), i2f(bot), color);
}
static void gr_box12(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot)
#ifdef EDITOR
static void gr_box12(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color)
{
if (top > MAXY ) return;
if (left > MAXX ) return;
if (bot > MAXY ) bot = MAXY;
if (right > MAXX ) right = MAXX;
const auto color = COLOR;
gr_ubox12(left, top, right, bot, color);
}
#endif
void gr_ubox(int left,int top,int right,int bot, const uint8_t color)
{
@ -100,12 +97,14 @@ void gr_ubox(int left,int top,int right,int bot, const uint8_t color)
gr_ubox12(left, top, right, bot, color);
}
void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot)
#ifdef EDITOR
void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color)
{
if (TYPE==BM_LINEAR)
gr_box0( left, top, right, bot );
gr_box0(left, top, right, bot, color);
else
gr_box12( left, top, right, bot );
gr_box12(left, top, right, bot, color);
}
#endif
}

View file

@ -228,7 +228,9 @@ int gr_disk(fix x,fix y,fix r);
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);
#ifdef EDITOR
void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, uint8_t color);
#endif
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);

View file

@ -110,9 +110,10 @@ void plot_parametric(vms_equation *coeffs, fix min_t, fix max_t, fix del_t) {
fix t, dt;
gr_setcolor(15);
gr_box( 75, 40, 325, 290 );
gr_box( 75, 310, 325, 560 );
gr_box( 475, 310, 725, 560 );
const uint8_t color = 15;
gr_box( 75, 40, 325, 290, color);
gr_box( 75, 310, 325, 560, color);
gr_box(475, 310, 725, 560, color);
//gr_pal_fade_in( grd_curscreen->pal );
for (t=min_t;t<max_t-del_t;t+=del_t) {