Customized fork of github.com/rxi/lite

Added rencache invalidation on window-exposed event

Fixes #63

rxi 35b642d4 35ce3d32

Changed files
+11 -2
src
+4 -1
src/api/system.c
··· 6 6 #include <errno.h> 7 7 #include <sys/stat.h> 8 8 #include "api.h" 9 + #include "rencache.h" 9 10 #ifdef _WIN32 10 11 #include <windows.h> 11 12 #endif ··· 56 57 lua_pushnumber(L, e.window.data2); 57 58 return 3; 58 59 } else if (e.window.event == SDL_WINDOWEVENT_EXPOSED) { 59 - SDL_UpdateWindowSurface(window); 60 + rencache_invalidate(); 61 + lua_pushstring(L, "exposed"); 62 + return 1; 60 63 } 61 64 /* on some systems, when alt-tabbing to the window SDL will queue up 62 65 ** several KEYDOWN events for the `tab` key; we flush all keydown
+6 -1
src/rencache.c
··· 150 150 } 151 151 152 152 153 + void rencache_invalidate(void) { 154 + memset(cells_prev, 0xff, sizeof(cells_buf1)); 155 + } 156 + 157 + 153 158 void rencache_begin_frame(void) { 154 159 /* reset all cells if the screen width/height has changed */ 155 160 int w, h; ··· 157 162 if (screen_rect.width != w || h != screen_rect.height) { 158 163 screen_rect.width = w; 159 164 screen_rect.height = h; 160 - memset(cells_prev, 0xff, sizeof(cells_buf1)); 165 + rencache_invalidate(); 161 166 } 162 167 } 163 168
+1
src/rencache.h
··· 9 9 void rencache_set_clip_rect(RenRect rect); 10 10 void rencache_draw_rect(RenRect rect, RenColor color); 11 11 int rencache_draw_text(RenFont *font, const char *text, int x, int y, RenColor color); 12 + void rencache_invalidate(void); 12 13 void rencache_begin_frame(void); 13 14 void rencache_end_frame(void); 14 15