Commit MetaInfo

Revisione8f4e64a2b140c0251cff600bb3048cc4e723d5a (tree)
Time2019-12-31 17:40:04
Authoringlorion <homemicro@ingl...>
Commiteringlorion

Log Message

emulator: only update modified parts of the display

Change Summary

Incremental Difference

diff -r 83e3392fdbe8 -r e8f4e64a2b14 emulator/xcb.c
--- a/emulator/xcb.c Mon Dec 30 23:40:41 2019 +0000
+++ b/emulator/xcb.c Tue Dec 31 08:40:04 2019 +0000
@@ -139,15 +139,20 @@
139139 }
140140
141141 void update_display(xcb_data *gui, const uint8_t *ram) {
142- unsigned int x, y;
142+ unsigned int idx, x, y;
143+ uint8_t gfx;
143144 for (y = 0; y < 200; y++) {
144145 for (x = 0; x < 40; x++) {
146+ idx = (320 * (y >> 3)) + (x << 3) + (y & 7);
147+ gfx = ram[0x2000 + idx];
148+ if (gui->oldgfx[idx] == gfx) continue;
145149 xcb_copy_area(gui->xcb, gui->pixmap, gui->win, gui->gc,
146150 0,
147- ram[0x2000 + (320 * (y >> 3)) + (x << 3) + (y & 7)] * gui->scale,
151+ (size_t) gfx * gui->scale,
148152 (x << 3) * gui->scale + gui->xoffset,
149153 y * gui->scale + gui->yoffset,
150154 8 * gui->scale, gui->scale);
155+ gui->oldgfx[idx] = gfx;
151156 }
152157 }
153158 xcb_flush(gui->xcb);
diff -r 83e3392fdbe8 -r e8f4e64a2b14 emulator/xcb.h
--- a/emulator/xcb.h Mon Dec 30 23:40:41 2019 +0000
+++ b/emulator/xcb.h Tue Dec 31 08:40:04 2019 +0000
@@ -13,6 +13,7 @@
1313 xcb_gcontext_t gc;
1414 xcb_pixmap_t pixmap;
1515 uint8_t keymap[256];
16+ uint8_t oldgfx[8000];
1617 } xcb_data;
1718
1819 void get_window_size(xcb_data *gui,
Show on old repository browser