Commit c6cc926e authored by Robey Pointer's avatar Robey Pointer
Browse files

switch to a framebuffer for nefarious reasons

parent d3260912
......@@ -118,15 +118,20 @@ void text_display_invert(bool invert) {
text_inverting = invert;
}
void text_display_render(void) {
oled_on();
oled_home();
oled_start_render();
for (int i = 0; i < DisplayWidth * DisplayHeight / 8; i++) oled_render(framebuffer[i]);
oled_finish_render();
}
void text_display_flush(void) {
if (!text_dirty) return;
uint8_t x_offset = (DisplayWidth - text_width * text_font->width) / 2;
int stride = (text_font->height + 7) / 8;
oled_on();
oled_home();
oled_start_render();
int i = 0;
uint8_t cursor = 0;
for (uint8_t y = 0; y < text_height; y++) {
if (y < text_roll) {
......@@ -139,28 +144,24 @@ void text_display_flush(void) {
// back up if we're drawing the later row of a tall font
if (row > 0) cursor -= text_width;
for (uint8_t pad = 0; pad < x_offset; pad++) oled_render(0);
for (uint8_t pad = 0; pad < x_offset; pad++) framebuffer[i++] = 0;
for (uint8_t x = 0; x < text_width; x++) {
int offset = (text_cells[cursor] & 0x7f) * text_font->width * stride;
for (uint8_t column = 0; column < text_font->width; column++) {
uint8_t pixels = pgm_read_byte((uint8_t *)text_font->glyphs + offset + column * stride + row);
if (text_invert[cursor >> 3] & (1 << (cursor & 7))) pixels = ~pixels;
oled_render(pixels);
framebuffer[i++] = pixels;
}
cursor++;
}
}
for (uint8_t pad = 0; pad < x_offset; pad++) oled_render(0);
for (uint8_t pad = 0; pad < x_offset; pad++) framebuffer[i++] = 0;
}
if (text_roll == 1 && text_font->height > 8) {
// skip row
for (uint8_t x = 0; x < DisplayWidth; x++) oled_render(0);
}
oled_finish_render();
text_display_render();
text_dirty = false;
}
void text_display_render(void) {
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment