diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-07 23:01:25 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-07 23:01:25 +0000 |
commit | b115bb3febe985bbc81d4dcfd82966fe94c54277 (patch) | |
tree | 4999cda9172a85b7aa887dacee1340c9d4346b00 /hw/ssd0323.c | |
parent | 28e1071183b2bfd27628b7dc1600cf9a3556a6ce (diff) |
Eliminate spurous screen updates.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4857 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ssd0323.c')
-rw-r--r-- | hw/ssd0323.c | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/hw/ssd0323.c b/hw/ssd0323.c index 11afca0c63..e496fe7840 100644 --- a/hw/ssd0323.c +++ b/hw/ssd0323.c @@ -184,78 +184,80 @@ static void ssd0323_update_display(void *opaque) char *p; int dest_width; - if (s->redraw) { + if (!s->redraw) + return; + + switch (s->ds->depth) { + case 0: + return; + case 15: + dest_width = 2; + break; + case 16: + dest_width = 2; + break; + case 24: + dest_width = 3; + break; + case 32: + dest_width = 4; + break; + default: + BADF("Bad color depth\n"); + return; + } + p = colortab; + for (i = 0; i < 16; i++) { + int n; + colors[i] = p; switch (s->ds->depth) { - case 0: - return; case 15: - dest_width = 2; + n = i * 2 + (i >> 3); + p[0] = n | (n << 5); + p[1] = (n << 2) | (n >> 3); break; case 16: - dest_width = 2; + n = i * 2 + (i >> 3); + p[0] = n | (n << 6) | ((n << 1) & 0x20); + p[1] = (n << 3) | (n >> 2); break; case 24: - dest_width = 3; - break; case 32: - dest_width = 4; + n = (i << 4) | i; + p[0] = p[1] = p[2] = n; break; default: BADF("Bad color depth\n"); return; } - p = colortab; - for (i = 0; i < 16; i++) { - int n; - colors[i] = p; - switch (s->ds->depth) { - case 15: - n = i * 2 + (i >> 3); - p[0] = n | (n << 5); - p[1] = (n << 2) | (n >> 3); - break; - case 16: - n = i * 2 + (i >> 3); - p[0] = n | (n << 6) | ((n << 1) & 0x20); - p[1] = (n << 3) | (n >> 2); - break; - case 24: - case 32: - n = (i << 4) | i; - p[0] = p[1] = p[2] = n; - break; - default: - BADF("Bad color depth\n"); - return; - } - p += dest_width; - } - /* TODO: Implement row/column remapping. */ - dest = s->ds->data; - for (y = 0; y < 64; y++) { - line = y; - src = s->framebuffer + 64 * line; - for (x = 0; x < 64; x++) { - int val; - val = *src >> 4; - for (i = 0; i < MAGNIFY; i++) { - memcpy(dest, colors[val], dest_width); - dest += dest_width; - } - val = *src & 0xf; - for (i = 0; i < MAGNIFY; i++) { - memcpy(dest, colors[val], dest_width); - dest += dest_width; - } - src++; + p += dest_width; + } + /* TODO: Implement row/column remapping. */ + dest = s->ds->data; + for (y = 0; y < 64; y++) { + line = y; + src = s->framebuffer + 64 * line; + for (x = 0; x < 64; x++) { + int val; + val = *src >> 4; + for (i = 0; i < MAGNIFY; i++) { + memcpy(dest, colors[val], dest_width); + dest += dest_width; } - for (i = 1; i < MAGNIFY; i++) { - memcpy(dest, dest - dest_width * MAGNIFY * 128, - dest_width * 128 * MAGNIFY); - dest += dest_width * 128 * MAGNIFY; + val = *src & 0xf; + for (i = 0; i < MAGNIFY; i++) { + memcpy(dest, colors[val], dest_width); + dest += dest_width; } + src++; + } + for (i = 1; i < MAGNIFY; i++) { + memcpy(dest, dest - dest_width * MAGNIFY * 128, + dest_width * 128 * MAGNIFY); + dest += dest_width * 128 * MAGNIFY; } } + s->redraw = 0; dpy_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY); } |