@samitouri / QOSamiQemu / commits / 80eea7dd75

ui/console-vc: vga_putcharxy()->vt100_putcharxy()

Have the character rendering function operate on QemuVT100 directly instead of taking a QemuConsole and extracting the VT100 state internally. This decouples glyph rendering from the console object, continuing the QemuVT100 abstraction introduced in the previous commits. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Feb 19, 2026 at 11:40 UTC 80eea7dd755a32c7e628116979a789e37c529435
1 file changed +8 -9
ui/console-vc.c
+8 -9
@@ -154,14 +154,13 @@ static void image_bitblt(pixman_image_t *image,
154 xs, ys, 0, 0, xd, yd, w, h);
155 }
156
157 -static void vga_putcharxy(QemuConsole *s, int x, int y, int ch,
158 - TextAttributes *t_attrib)
157 +static void vt100_putcharxy(QemuVT100 *vt, int x, int y, int ch,
158 + TextAttributes *t_attrib)
159 {
160 static pixman_image_t *glyphs[256];
161 - pixman_image_t *image = QEMU_TEXT_CONSOLE(s)->vt.image;
161 pixman_color_t fgcol, bgcol;
162
164 - assert(image);
163 + assert(vt->image);
164 if (t_attrib->invers) {
165 bgcol = color_table_rgb[t_attrib->bold][t_attrib->fgcol];
166 fgcol = color_table_rgb[t_attrib->bold][t_attrib->bgcol];
@@ -173,7 +172,7 @@ static void vga_putcharxy(QemuConsole *s, int x, int y, int ch,
172 if (!glyphs[ch]) {
173 glyphs[ch] = qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, ch);
174 }
176 - qemu_pixman_glyph_render(glyphs[ch], image,
175 + qemu_pixman_glyph_render(glyphs[ch], vt->image,
176 &fgcol, &bgcol, x, y, FONT_WIDTH, FONT_HEIGHT);
177 }
178
@@ -216,9 +215,9 @@ static void console_show_cursor(QemuTextConsole *s, int show)
215 if (show && cursor_visible_phase) {
216 TextAttributes t_attrib = TEXT_ATTRIBUTES_DEFAULT;
217 t_attrib.invers = !(t_attrib.invers); /* invert fg and bg */
219 - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &t_attrib);
218 + vt100_putcharxy(&s->vt, x, y, c->ch, &t_attrib);
219 } else {
221 - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch, &(c->t_attrib));
220 + vt100_putcharxy(&s->vt, x, y, c->ch, &(c->t_attrib));
221 }
222 invalidate_xy(s, x, y);
223 }
@@ -244,7 +243,7 @@ static void console_refresh(QemuTextConsole *s)
243 for (y = 0; y < vt->height; y++) {
244 c = vt->cells + y1 * vt->width;
245 for (x = 0; x < vt->width; x++) {
247 - vga_putcharxy(QEMU_CONSOLE(s), x, y, c->ch,
246 + vt100_putcharxy(vt, x, y, c->ch,
247 &(c->t_attrib));
248 c++;
249 }
@@ -590,7 +589,7 @@ static void vc_update_xy(VCChardev *vc, int x, int y)
589 x = vt->width - 1;
590 }
591 c = &vt->cells[y1 * vt->width + x];
593 - vga_putcharxy(QEMU_CONSOLE(s), x, y2, c->ch,
592 + vt100_putcharxy(vt, x, y2, c->ch,
593 &(c->t_attrib));
594 invalidate_xy(s, x, y2);
595 }