Commit d3ffcafe25b5966b351ea6100160c2156688f22f

Authored by Blue Swirl
1 parent 24d904ea

Sparc32: fix SDL zooming with TCX

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Showing 1 changed file with 34 additions and 20 deletions
hw/tcx.c
@@ -49,8 +49,25 @@ typedef struct TCXState { @@ -49,8 +49,25 @@ typedef struct TCXState {
49 49
50 static void tcx_screen_dump(void *opaque, const char *filename); 50 static void tcx_screen_dump(void *opaque, const char *filename);
51 static void tcx24_screen_dump(void *opaque, const char *filename); 51 static void tcx24_screen_dump(void *opaque, const char *filename);
52 -static void tcx_invalidate_display(void *opaque);  
53 -static void tcx24_invalidate_display(void *opaque); 52 +
  53 +static void tcx_set_dirty(TCXState *s)
  54 +{
  55 + unsigned int i;
  56 +
  57 + for (i = 0; i < MAXX * MAXY; i += TARGET_PAGE_SIZE) {
  58 + cpu_physical_memory_set_dirty(s->vram_offset + i);
  59 + }
  60 +}
  61 +
  62 +static void tcx24_set_dirty(TCXState *s)
  63 +{
  64 + unsigned int i;
  65 +
  66 + for (i = 0; i < MAXX * MAXY * 4; i += TARGET_PAGE_SIZE) {
  67 + cpu_physical_memory_set_dirty(s->vram24_offset + i);
  68 + cpu_physical_memory_set_dirty(s->cplane_offset + i);
  69 + }
  70 +}
54 71
55 static void update_palette_entries(TCXState *s, int start, int end) 72 static void update_palette_entries(TCXState *s, int start, int end)
56 { 73 {
@@ -75,10 +92,11 @@ 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)
75 break; 92 break;
76 } 93 }
77 } 94 }
78 - if (s->depth == 24)  
79 - tcx24_invalidate_display(s);  
80 - else  
81 - tcx_invalidate_display(s); 95 + if (s->depth == 24) {
  96 + tcx24_set_dirty(s);
  97 + } else {
  98 + tcx_set_dirty(s);
  99 + }
82 } 100 }
83 101
84 static void tcx_draw_line32(TCXState *s1, uint8_t *d, 102 static void tcx_draw_line32(TCXState *s1, uint8_t *d,
@@ -344,23 +362,18 @@ static void tcx24_update_display(void *opaque) @@ -344,23 +362,18 @@ static void tcx24_update_display(void *opaque)
344 static void tcx_invalidate_display(void *opaque) 362 static void tcx_invalidate_display(void *opaque)
345 { 363 {
346 TCXState *s = opaque; 364 TCXState *s = opaque;
347 - int i;  
348 365
349 - for (i = 0; i < MAXX*MAXY; i += TARGET_PAGE_SIZE) {  
350 - cpu_physical_memory_set_dirty(s->vram_offset + i);  
351 - } 366 + tcx_set_dirty(s);
  367 + qemu_console_resize(s->ds, s->width, s->height);
352 } 368 }
353 369
354 static void tcx24_invalidate_display(void *opaque) 370 static void tcx24_invalidate_display(void *opaque)
355 { 371 {
356 TCXState *s = opaque; 372 TCXState *s = opaque;
357 - int i;  
358 373
359 - tcx_invalidate_display(s);  
360 - for (i = 0; i < MAXX*MAXY * 4; i += TARGET_PAGE_SIZE) {  
361 - cpu_physical_memory_set_dirty(s->vram24_offset + i);  
362 - cpu_physical_memory_set_dirty(s->cplane_offset + i);  
363 - } 374 + tcx_set_dirty(s);
  375 + tcx24_set_dirty(s);
  376 + qemu_console_resize(s->ds, s->width, s->height);
364 } 377 }
365 378
366 static void tcx_save(QEMUFile *f, void *opaque) 379 static void tcx_save(QEMUFile *f, void *opaque)
@@ -399,10 +412,11 @@ static int tcx_load(QEMUFile *f, void *opaque, int version_id) @@ -399,10 +412,11 @@ static int tcx_load(QEMUFile *f, void *opaque, int version_id)
399 qemu_get_8s(f, &s->dac_index); 412 qemu_get_8s(f, &s->dac_index);
400 qemu_get_8s(f, &s->dac_state); 413 qemu_get_8s(f, &s->dac_state);
401 update_palette_entries(s, 0, 256); 414 update_palette_entries(s, 0, 256);
402 - if (s->depth == 24)  
403 - tcx24_invalidate_display(s);  
404 - else  
405 - tcx_invalidate_display(s); 415 + if (s->depth == 24) {
  416 + tcx24_set_dirty(s);
  417 + } else {
  418 + tcx_set_dirty(s);
  419 + }
406 420
407 return 0; 421 return 0;
408 } 422 }