mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Allow initial destination position to be used as an offset with scaleSourceToDestinationSurface()
This commit is contained in:
@@ -12,14 +12,12 @@ void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst)
|
|||||||
int dstW = dst->h * src->w / src->h;
|
int dstW = dst->h * src->w / src->h;
|
||||||
|
|
||||||
if (dstH > dst->h) {
|
if (dstH > dst->h) {
|
||||||
dst->y = 0;
|
dst->x += (dst->w - dstW) / 2;
|
||||||
dst->x = (dst->w - dstW) / 2;
|
|
||||||
dst->w = dstW;
|
dst->w = dstW;
|
||||||
SDL_assert(dst->w * src->h / src->w <= dst->h);
|
SDL_assert(dst->w * src->h / src->w <= dst->h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dst->x = 0;
|
dst->y += (dst->h - dstH) / 2;
|
||||||
dst->y = (dst->h - dstH) / 2;
|
|
||||||
dst->h = dstH;
|
dst->h = dstH;
|
||||||
SDL_assert(dst->h * src->w / src->h <= dst->w);
|
SDL_assert(dst->h * src->w / src->h <= dst->w);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user