From 453fe6aea0944f90edab89bea16b8a1a19c545fd Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 14 Oct 2022 21:09:32 -0500 Subject: [PATCH] Ensure the target window size is always even --- app/streaming/session.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 09fb751c..04fcec39 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -932,12 +932,14 @@ void Session::getWindowDimensions(int& x, int& y, SDL_Rect usableBounds; if (SDL_GetDisplayUsableBounds(displayIndex, &usableBounds) == 0) { // Don't use more than 80% of the display to leave room for system UI + // and ensure the target size is not odd (otherwise one of the sides + // of the image will have a one-pixel black bar next to it). SDL_Rect src, dst; src.x = src.y = dst.x = dst.y = 0; src.w = m_StreamConfig.width; src.h = m_StreamConfig.height; - dst.w = (int)SDL_roundf(usableBounds.w * 0.80f); - dst.h = (int)SDL_roundf(usableBounds.h * 0.80f); + dst.w = ((int)SDL_roundf(usableBounds.w * 0.80f) & ~0x1); + dst.h = ((int)SDL_roundf(usableBounds.h * 0.80f) & ~0x1); // Scale the window size while preserving aspect ratio StreamUtils::scaleSourceToDestinationSurface(&src, &dst);