aboutsummaryrefslogtreecommitdiff
path: root/hw/tcx.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-07-16 13:45:57 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-07-16 13:45:57 +0000
commitd3ffcafe25b5966b351ea6100160c2156688f22f (patch)
tree2ba16a07bf5ebb4cd5a06f020e2beff0eb484481 /hw/tcx.c
parent24d904eab3e806dc4d1ccdabbc3b4dcb64ddf497 (diff)
downloadqemu-d3ffcafe25b5966b351ea6100160c2156688f22f.zip
qemu-d3ffcafe25b5966b351ea6100160c2156688f22f.tar.gz
qemu-d3ffcafe25b5966b351ea6100160c2156688f22f.tar.bz2
Sparc32: fix SDL zooming with TCX
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/tcx.c')
-rw-r--r--hw/tcx.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/hw/tcx.c b/hw/tcx.c
index d9b07cc..76acae8 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;
}