From a1ef15a783f37cf260819d9742991ed677f931a4 Mon Sep 17 00:00:00 2001 From: kub Date: Wed, 28 Sep 2022 18:46:32 +0000 Subject: [PATCH] platform sdl, fix screen clearing if line pitch isn't width --- platform/common/plat_sdl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index cb02919b..79664c3d 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -191,7 +191,7 @@ void plat_video_flip(void) g_screen_ptr = plat_sdl_screen->pixels; plat_video_set_buffer(g_screen_ptr); if (clear_buf_cnt) { - memset(g_screen_ptr, 0, plat_sdl_screen->w*plat_sdl_screen->h * 2); + memset(g_screen_ptr, 0, plat_sdl_screen->pitch*plat_sdl_screen->h); clear_buf_cnt--; } } @@ -225,7 +225,7 @@ void plat_video_clear_buffers(void) if (plat_sdl_overlay || plat_sdl_gl_active) memset(shadow_fb, 0, g_menuscreen_w * g_menuscreen_h * 2); else { - memset(g_screen_ptr, 0, plat_sdl_screen->w*plat_sdl_screen->h * 2); + memset(g_screen_ptr, 0, plat_sdl_screen->pitch*plat_sdl_screen->h); clear_buf_cnt = 3; // do it thrice in case of triple buffering } } -- 2.39.5