Pass color to gr_scanline

This commit is contained in:
Kp 2016-02-12 04:02:28 +00:00
parent 228bbe999a
commit fabe774291
4 changed files with 17 additions and 14 deletions

View file

@ -42,7 +42,7 @@ static void gr_linear_darken(uint8_t *const dest, unsigned darkening_level, unsi
#ifdef OGL
static
#endif
void gr_uscanline(unsigned x1, unsigned x2, unsigned y)
void gr_uscanline(const unsigned x1, const unsigned x2, const unsigned y, const uint8_t color)
{
switch(TYPE)
{
@ -55,7 +55,7 @@ void gr_uscanline(unsigned x1, unsigned x2, unsigned y)
const auto cv_fade_level = grd_curcanv->cv_fade_level;
const auto count = x2 - x1 + 1;
if (cv_fade_level >= gr_fade_table.size())
gr_linear_stosd(data, static_cast<uint8_t>(COLOR), count);
gr_linear_stosd(data, static_cast<uint8_t>(color), count);
else
gr_linear_darken(data, cv_fade_level, count, gr_fade_table);
}
@ -63,7 +63,7 @@ void gr_uscanline(unsigned x1, unsigned x2, unsigned y)
}
}
void gr_scanline(int x1, int x2, unsigned y)
void gr_scanline(int x1, int x2, const unsigned y, const uint8_t color)
{
if (y >= MAXY)
return;
@ -76,7 +76,7 @@ void gr_scanline(int x1, int x2, unsigned y)
if (x1 < MINX) x1 = MINX;
if (x2 > MAXX) x2 = MAXX;
gr_uscanline(x1, x2, y);
gr_uscanline(x1, x2, y, color);
}
}

View file

@ -34,26 +34,27 @@ int gr_disk(fix xc1,fix yc1,fix r1)
if ( (yc+r) < 0 ) return 1;
if ( (yc-r) > GHEIGHT ) return 1;
const auto color = COLOR;
while(x<y)
{
// Draw the first octant
gr_scanline( xc-y, xc+y, yc-x );
gr_scanline( xc-y, xc+y, yc+x );
gr_scanline(xc-y, xc+y, yc-x, color);
gr_scanline(xc-y, xc+y, yc+x, color);
if (p<0)
p=p+(x<<2)+6;
else {
// Draw the second octant
gr_scanline( xc-x, xc+x, yc-y );
gr_scanline( xc-x, xc+x, yc+y );
gr_scanline(xc-x, xc+x, yc-y, color);
gr_scanline(xc-x, xc+x, yc+y, color);
p=p+((x-y)<<2)+10;
y--;
}
x++;
}
if(x==y) {
gr_scanline( xc-x, xc+x, yc-y );
gr_scanline( xc-x, xc+x, yc+y );
gr_scanline(xc-x, xc+x, yc-y, color);
gr_scanline(xc-x, xc+x, yc+y, color);
}
return 0;
}

View file

@ -41,8 +41,9 @@ void gr_urect(int left,int top,int right,int bot)
return;
}
#else
const auto color = COLOR;
for ( int i=top; i<=bot; i++ )
gr_uscanline( left, right, i );
gr_uscanline(left, right, i, color);
#endif
}
@ -54,8 +55,9 @@ void gr_rect(int left,int top,int right,int bot)
return;
}
#endif
const auto color = COLOR;
for ( int i=top; i<=bot; i++ )
gr_scanline( left, right, i );
gr_scanline(left, right, i, color);
}
}

View file

@ -231,9 +231,9 @@ int gr_ucircle(fix x,fix y,fix r);
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_scanline(int x1, int x2, unsigned y);
void gr_scanline(int x1, int x2, unsigned y, uint8_t color);
#ifndef OGL
void gr_uscanline(unsigned x1, unsigned x2, unsigned y);
void gr_uscanline(unsigned x1, unsigned x2, unsigned y, uint8_t color);
#endif
void gr_close_font(std::unique_ptr<grs_font> font);