From d3ffcafe25b5966b351ea6100160c2156688f22f Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Thu, 16 Jul 2009 13:45:57 +0000 Subject: [PATCH] Sparc32: fix SDL zooming with TCX Signed-off-by: Blue Swirl --- hw/tcx.c | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/hw/tcx.c b/hw/tcx.c index d9b07cc8df..76acae809d 100644 --- a/hw/tcx.c +++ b/hw/tcx.c @@ -49,8 +49,25 @@ typedef struct TCXState { static void tcx_screen_dump(void *opaque, const char *filename); static void tcx24_screen_dump(void *opaque, const char *filename); -static void tcx_invalidate_display(void *opaque); -static void tcx24_invalidate_display(void *opaque); + +static void tcx_set_dirty(TCXState *s) +{ + unsigned int i; + + for (i = 0; i < MAXX * MAXY; i += TARGET_PAGE_SIZE) { + cpu_physical_memory_set_dirty(s->vram_offset + i); + } +} + +static void tcx24_set_dirty(TCXState *s) +{ + unsigned int i; + + for (i = 0; i < MAXX * MAXY * 4; i += TARGET_PAGE_SIZE) { + cpu_physical_memory_set_dirty(s->vram24_offset + i); + cpu_physical_memory_set_dirty(s->cplane_offset + i); + } +} static void update_palette_entries(TCXState *s, int start, int end) { @@ -75,10 +92,11 @@ static void update_palette_entries(TCXState *s, int start, int end) break; } } - if (s->depth == 24) - tcx24_invalidate_display(s); - else - tcx_invalidate_display(s); + if (s->depth == 24) { + tcx24_set_dirty(s); + } else { + tcx_set_dirty(s); + } } static void tcx_draw_line32(TCXState *s1, uint8_t *d, @@ -344,23 +362,18 @@ static void tcx24_update_display(void *opaque) static void tcx_invalidate_display(void *opaque) { TCXState *s = opaque; - int i; - for (i = 0; i < MAXX*MAXY; i += TARGET_PAGE_SIZE) { - cpu_physical_memory_set_dirty(s->vram_offset + i); - } + tcx_set_dirty(s); + qemu_console_resize(s->ds, s->width, s->height); } static void tcx24_invalidate_display(void *opaque) { TCXState *s = opaque; - int i; - tcx_invalidate_display(s); - for (i = 0; i < MAXX*MAXY * 4; i += TARGET_PAGE_SIZE) { - cpu_physical_memory_set_dirty(s->vram24_offset + i); - cpu_physical_memory_set_dirty(s->cplane_offset + i); - } + tcx_set_dirty(s); + tcx24_set_dirty(s); + qemu_console_resize(s->ds, s->width, s->height); } static void tcx_save(QEMUFile *f, void *opaque) @@ -399,10 +412,11 @@ static int tcx_load(QEMUFile *f, void *opaque, int version_id) qemu_get_8s(f, &s->dac_index); qemu_get_8s(f, &s->dac_state); update_palette_entries(s, 0, 256); - if (s->depth == 24) - tcx24_invalidate_display(s); - else - tcx_invalidate_display(s); + if (s->depth == 24) { + tcx24_set_dirty(s); + } else { + tcx_set_dirty(s); + } return 0; } -- 2.11.0