feat: expand Intel GPU display management

This commit is contained in:
2026-07-30 17:12:08 +01:00
parent 86de3400a9
commit 471903bafb
25 changed files with 1715 additions and 16 deletions
+39 -5
View File
@@ -161,24 +161,58 @@ struct Canvas {
// ---- Text ----
void text_bitmap(int x, int y, const char* str, Color c, int scale = 1) {
if (!str || !font_data || scale <= 0) return;
uint32_t pixel = c.to_pixel();
int cx = x;
for (int i = 0; str[i]; i++, cx += FONT_WIDTH * scale) {
const uint8_t* glyph =
&font_data[(unsigned char)str[i] * FONT_HEIGHT];
for (int row = 0; row < FONT_HEIGHT; row++) {
uint8_t bits = glyph[row];
if (!bits) continue;
for (int col = 0; col < FONT_WIDTH; col++) {
if (!(bits & (0x80 >> col))) continue;
int px = cx + col * scale;
int py = y + row * scale;
for (int sy = 0; sy < scale; sy++) {
int dy = py + sy;
if (dy < 0 || dy >= h) continue;
for (int sx = 0; sx < scale; sx++) {
int dx = px + sx;
if (dx >= 0 && dx < w) pixels[dy * w + dx] = pixel;
}
}
}
}
}
}
void text(int x, int y, const char* str, Color c) {
if (fonts::system_font && fonts::system_font->valid) {
fonts::system_font->draw_to_buffer(pixels, w, h, x, y, str, c, fonts::UI_SIZE);
if (fonts::system_font->draw_to_buffer(
pixels, w, h, x, y, str, c, fonts::UI_SIZE))
return;
}
text_bitmap(x, y, str, c);
}
void text_2x(int x, int y, const char* str, Color c) {
if (fonts::system_font && fonts::system_font->valid) {
fonts::system_font->draw_to_buffer(pixels, w, h, x, y, str, c, fonts::LARGE_SIZE);
if (fonts::system_font->draw_to_buffer(
pixels, w, h, x, y, str, c, fonts::LARGE_SIZE))
return;
}
text_bitmap(x, y, str, c, 2);
}
void text_mono(int x, int y, const char* str, Color c) {
if (fonts::mono && fonts::mono->valid) {
fonts::mono->draw_to_buffer(pixels, w, h, x, y, str, c, fonts::TERM_SIZE);
return;
if (fonts::mono->draw_to_buffer(
pixels, w, h, x, y, str, c, fonts::TERM_SIZE))
return;
}
text(x, y, str, c);
text_bitmap(x, y, str, c);
}
// ---- Icons ----