mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
[display] Small display print performance improvement (#4788)
This commit is contained in:
parent
535003014b
commit
a8b821c213
1 changed files with 8 additions and 4 deletions
|
@ -282,10 +282,14 @@ void DisplayBuffer::print(int x, int y, Font *font, Color color, TextAlign align
|
|||
int scan_x1, scan_y1, scan_width, scan_height;
|
||||
glyph.scan_area(&scan_x1, &scan_y1, &scan_width, &scan_height);
|
||||
|
||||
for (int glyph_x = scan_x1; glyph_x < scan_x1 + scan_width; glyph_x++) {
|
||||
for (int glyph_y = scan_y1; glyph_y < scan_y1 + scan_height; glyph_y++) {
|
||||
if (glyph.get_pixel(glyph_x, glyph_y)) {
|
||||
this->draw_pixel_at(glyph_x + x_at, glyph_y + y_start, color);
|
||||
{
|
||||
const int glyph_x_max = scan_x1 + scan_width;
|
||||
const int glyph_y_max = scan_y1 + scan_height;
|
||||
for (int glyph_x = scan_x1; glyph_x < glyph_x_max; glyph_x++) {
|
||||
for (int glyph_y = scan_y1; glyph_y < glyph_y_max; glyph_y++) {
|
||||
if (glyph.get_pixel(glyph_x, glyph_y)) {
|
||||
this->draw_pixel_at(glyph_x + x_at, glyph_y + y_start, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue