mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
OPT: Reduce render calls when zooming
This commit is contained in:
@@ -119,15 +119,18 @@ static void user_window_resize(Window *win, int w, int h) {
|
|||||||
extern void kfree(void* ptr);
|
extern void kfree(void* ptr);
|
||||||
extern void serial_write(const char *str);
|
extern void serial_write(const char *str);
|
||||||
|
|
||||||
|
|
||||||
if (win->pixels) kfree(win->pixels);
|
if (win->pixels) kfree(win->pixels);
|
||||||
if (win->comp_pixels) kfree(win->comp_pixels);
|
if (win->comp_pixels) kfree(win->comp_pixels);
|
||||||
|
|
||||||
win->pixels = (uint32_t *)kmalloc(w * h * sizeof(uint32_t));
|
win->pixels = (uint32_t *)kmalloc(w * h * sizeof(uint32_t));
|
||||||
win->comp_pixels = (uint32_t *)kmalloc(w * h * sizeof(uint32_t));
|
win->comp_pixels = (uint32_t *)kmalloc(w * h * sizeof(uint32_t));
|
||||||
|
|
||||||
|
win->w = w;
|
||||||
|
win->h = h;
|
||||||
|
|
||||||
if (win->pixels) {
|
if (win->pixels) {
|
||||||
for (int i = 0; i < w * h; i++) win->pixels[i] = 0;
|
extern void mem_memset(void *dest, int val, size_t len);
|
||||||
|
mem_memset(win->pixels, 0, w * h * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user