Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you replace this function in the project, the text is displayed in the 2-3 times faster. Depending on whether there is a back color.
// Draw a character void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size) { if((x >= _width) || // Clip right (y >= _height) || // Clip bottom ((x + 6 * size - 1) < 0) || // Clip left ((y + 8 * size - 1) < 0)) // Clip top return;
if(!_cp437 && (c >= 176)) c++; // Handle 'classic' charset behavior uint8_t line; bool Fill; uint8_t SF; for (int8_t i=0; i<6; i++, x+=size) { if (i == 5) line = 0x0; else line = pgm_read_byte(font+(c*5)+i); Fill = line & 0x1; SF = 0; for (int8_t j = 1, jy=size; j<9; j++, jy+=size) { line >>= 1; if ((Fill == (line & 0x1)) && j!=8) continue; if (Fill) fillRect(x, y+SF, size, jy-SF, color); else if (bg != color) fillRect(x, y+SF, size, jy-SF, bg); Fill = line & 0x1; SF = jy; } } }
Good luck!
The text was updated successfully, but these errors were encountered:
If you replace this function in the project, the text is displayed in the 2-3 times faster. Depending on whether there is a back color.
// Draw a character
void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
uint16_t color, uint16_t bg, uint8_t size)
{
if((x >= _width) || // Clip right
(y >= _height) || // Clip bottom
((x + 6 * size - 1) < 0) || // Clip left
((y + 8 * size - 1) < 0)) // Clip top
return;
if(!_cp437 && (c >= 176)) c++; // Handle 'classic' charset behavior
uint8_t line;
bool Fill; uint8_t SF;
for (int8_t i=0; i<6; i++, x+=size)
{
if (i == 5) line = 0x0;
else line = pgm_read_byte(font+(c*5)+i);
Fill = line & 0x1; SF = 0;
for (int8_t j = 1, jy=size; j<9; j++, jy+=size)
{
line >>= 1;
if ((Fill == (line & 0x1)) && j!=8) continue;
if (Fill) fillRect(x, y+SF, size, jy-SF, color);
else if (bg != color) fillRect(x, y+SF, size, jy-SF, bg);
Fill = line & 0x1; SF = jy;
}
}
}
Good luck!
The text was updated successfully, but these errors were encountered: