optimize drawChar (-126 bytes)

This commit is contained in:
Josh Goebel 2017-03-21 14:57:41 -04:00 committed by Scott Allen
parent 6e13fc019f
commit ae8e284d41
1 changed files with 5 additions and 8 deletions

View File

@ -1159,7 +1159,9 @@ size_t Arduboy2::write(uint8_t c)
void Arduboy2::drawChar
(int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t size)
{
uint8_t line;
bool draw_background = bg != color;
uint8_t *bitmap = font + c*5;
if ((x >= WIDTH) || // Clip right
(y >= HEIGHT) || // Clip bottom
@ -1170,17 +1172,12 @@ void Arduboy2::drawChar
return;
}
for (int8_t i=0; i<6; i++ )
for (uint8_t i=0; i<6; i++ )
{
uint8_t line;
if (i == 5)
{
line = pgm_read_byte(bitmap++);
if (i == 5) {
line = 0x0;
}
else
{
line = pgm_read_byte(font+(c*5)+i);
}
for (int8_t j = 0; j<8; j++)
{