From 9742bda77fe82423b0510d6568ca9e7a5b1726c3 Mon Sep 17 00:00:00 2001 From: kub Date: Mon, 14 Dec 2020 21:15:32 +0100 Subject: [PATCH] SDL, better handling of 2x overlay mode --- platform/common/plat_sdl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index b98b16e5..e1024f79 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -135,12 +135,12 @@ void bgr_to_uyvy_init(void) } } -void rgb565_to_uyvy(void *d, const void *s, int pixels) +void rgb565_to_uyvy(void *d, const void *s, int pixels, int x2) { uint32_t *dst = d; const uint16_t *src = s; - if (plat_sdl_overlay->w > 2*plat_sdl_overlay->h) + if (x2) for (; pixels > 0; src += 4, dst += 4, pixels -= 4) { struct uyvy *uyvy0 = yuv_uyvy + src[0], *uyvy1 = yuv_uyvy + src[1]; @@ -169,7 +169,8 @@ void plat_video_flip(void) SDL_LockYUVOverlay(plat_sdl_overlay); rgb565_to_uyvy(plat_sdl_overlay->pixels[0], shadow_fb, - g_screen_ppitch * g_screen_height); + g_screen_ppitch * g_screen_height, + plat_sdl_overlay->w > 2*plat_sdl_overlay->h); SDL_UnlockYUVOverlay(plat_sdl_overlay); SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect); } @@ -246,7 +247,7 @@ void plat_video_menu_end(void) SDL_LockYUVOverlay(plat_sdl_overlay); rgb565_to_uyvy(plat_sdl_overlay->pixels[0], shadow_fb, - g_menuscreen_pp * g_menuscreen_h); + g_menuscreen_pp * g_menuscreen_h, 0); SDL_UnlockYUVOverlay(plat_sdl_overlay); SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect); -- 2.39.2