mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 06:58:11 +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,13 +282,17 @@ void DisplayBuffer::print(int x, int y, Font *font, Color color, TextAlign align
|
||||||
int scan_x1, scan_y1, scan_width, scan_height;
|
int scan_x1, scan_y1, scan_width, scan_height;
|
||||||
glyph.scan_area(&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++) {
|
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)) {
|
if (glyph.get_pixel(glyph_x, glyph_y)) {
|
||||||
this->draw_pixel_at(glyph_x + x_at, glyph_y + y_start, color);
|
this->draw_pixel_at(glyph_x + x_at, glyph_y + y_start, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
x_at += glyph.glyph_data_->width + glyph.glyph_data_->offset_x;
|
x_at += glyph.glyph_data_->width + glyph.glyph_data_->offset_x;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue