diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-02-11 11:06:28 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-02-11 11:06:28 +0100 |
commit | 2d71f1099f0eb3ef6e17316a520d3d710dec1ac0 (patch) | |
tree | 32d2db34046c1496f20650e1d3857aa5d3f9c2d7 /examples | |
parent | ed275e1296defb6cc5450cf5996cf97c1fa32dfa (diff) | |
download | reduced_system_layer-2d71f1099f0eb3ef6e17316a520d3d710dec1ac0.zip |
Memory buffer fixes
Diffstat (limited to 'examples')
-rw-r--r-- | examples/screenshot.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c index c3c0ebd..11b2385 100644 --- a/examples/screenshot.c +++ b/examples/screenshot.c @@ -1,23 +1,34 @@ #include "../graphics.c" -i64 width = 0; -i64 height = 0; -b8 has_screenshot = 0; +enum { + MAX_NUM_PIXELS = 10 * 1024 * 1024, +}; + +b8 has_screenshot = 0; +i64 width = 0; +i64 height = 0; +vec4_f32 pixels[MAX_NUM_PIXELS] = {0}; void update_and_render_frame(void) { if (!has_screenshot) { - take_screenshot(MAX_NUM_PIXELS, &width, &height, g_platform.sketch); + take_screenshot(MAX_NUM_PIXELS, &width, &height, pixels); has_screenshot = 1; } handle_main_window_events(); - draw_pixels((Brush) { .quick = 1, }, 0, 0, g_platform.real_width, g_platform.real_height, (Pixel_Buffer) { - .width = width, - .height = height, - .stride = width, - .pixels = g_platform.sketch, - }); + draw_pixels_quick( + (Box) { + .width = g_platform.real_width, + .height = g_platform.real_height, + }, + (Pixel_Buffer) { + .width = width, + .height = height, + .stride = width, + .pixels = pixels, + } + ); render_main_window_frame(); } |