mirror of https://github.com/MLXXXp/Arduboy2.git
optimize drawChar (-126 bytes)
This commit is contained in:
parent
6e13fc019f
commit
ae8e284d41
|
@ -1159,7 +1159,9 @@ size_t Arduboy2::write(uint8_t c)
|
||||||
void Arduboy2::drawChar
|
void Arduboy2::drawChar
|
||||||
(int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t size)
|
(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;
|
bool draw_background = bg != color;
|
||||||
|
uint8_t *bitmap = font + c*5;
|
||||||
|
|
||||||
if ((x >= WIDTH) || // Clip right
|
if ((x >= WIDTH) || // Clip right
|
||||||
(y >= HEIGHT) || // Clip bottom
|
(y >= HEIGHT) || // Clip bottom
|
||||||
|
@ -1170,17 +1172,12 @@ void Arduboy2::drawChar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int8_t i=0; i<6; i++ )
|
for (uint8_t i=0; i<6; i++ )
|
||||||
{
|
{
|
||||||
uint8_t line;
|
line = pgm_read_byte(bitmap++);
|
||||||
if (i == 5)
|
if (i == 5) {
|
||||||
{
|
|
||||||
line = 0x0;
|
line = 0x0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
line = pgm_read_byte(font+(c*5)+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int8_t j = 0; j<8; j++)
|
for (int8_t j = 0; j<8; j++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue