summaryrefslogtreecommitdiffstats
path: root/hw/display/tc6393xb.c
diff options
context:
space:
mode:
authorPeter Maydell2021-02-15 11:32:10 +0100
committerPeter Maydell2021-03-06 14:30:38 +0100
commit0dc51b002482d4b5e60f634dcbcd8a3a906d7b97 (patch)
treec8b240d56a9d7ea53da06af99b665c23ddc956ec /hw/display/tc6393xb.c
parenthw/display/tc6393xb: Expand out macros in template header (diff)
downloadqemu-0dc51b002482d4b5e60f634dcbcd8a3a906d7b97.tar.gz
qemu-0dc51b002482d4b5e60f634dcbcd8a3a906d7b97.tar.xz
qemu-0dc51b002482d4b5e60f634dcbcd8a3a906d7b97.zip
hw/display/tc6393xb: Inline tc6393xb_draw_graphic32() at its callsite
The function tc6393xb_draw_graphic32() is called in exactly one place, so just inline the function body at its callsite. This allows us to drop the template header entirely. The code move includes a single added space after 'for' to fix the coding style. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20210215103215.4944-5-peter.maydell@linaro.org
Diffstat (limited to 'hw/display/tc6393xb.c')
-rw-r--r--hw/display/tc6393xb.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index 4cddb1a99a..1f28223c7b 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -410,12 +410,27 @@ static void tc6393xb_nand_writeb(TC6393xbState *s, hwaddr addr, uint32_t value)
(uint32_t) addr, value & 0xff);
}
-#define BITS 32
-#include "tc6393xb_template.h"
-
static void tc6393xb_draw_graphic(TC6393xbState *s, int full_update)
{
- tc6393xb_draw_graphic32(s);
+ DisplaySurface *surface = qemu_console_surface(s->con);
+ int i;
+ uint16_t *data_buffer;
+ uint8_t *data_display;
+
+ data_buffer = s->vram_ptr;
+ data_display = surface_data(surface);
+ for (i = 0; i < s->scr_height; i++) {
+ int j;
+ for (j = 0; j < s->scr_width; j++, data_display += 4, data_buffer++) {
+ uint16_t color = *data_buffer;
+ uint32_t dest_color = rgb_to_pixel32(
+ ((color & 0xf800) * 0x108) >> 11,
+ ((color & 0x7e0) * 0x41) >> 9,
+ ((color & 0x1f) * 0x21) >> 2
+ );
+ *(uint32_t *)data_display = dest_color;
+ }
+ }
dpy_gfx_update_full(s->con);
}