From a44ed0b047925b712d2819348fc90bca51c7d61e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 24 Feb 2020 18:01:30 -0800 Subject: [PATCH] Allow initial destination position to be used as an offset with scaleSourceToDestinationSurface() --- app/streaming/streamutils.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/streaming/streamutils.cpp b/app/streaming/streamutils.cpp index 5b3ccf1d..c8c8c8e6 100644 --- a/app/streaming/streamutils.cpp +++ b/app/streaming/streamutils.cpp @@ -12,14 +12,12 @@ void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst) int dstW = dst->h * src->w / src->h; if (dstH > dst->h) { - dst->y = 0; - dst->x = (dst->w - dstW) / 2; + dst->x += (dst->w - dstW) / 2; dst->w = dstW; SDL_assert(dst->w * src->h / src->w <= dst->h); } else { - dst->x = 0; - dst->y = (dst->h - dstH) / 2; + dst->y += (dst->h - dstH) / 2; dst->h = dstH; SDL_assert(dst->h * src->w / src->h <= dst->w); }