steamcompmgr: Add STRETCH scaling mode

This commit is contained in:
Joshua Ashton 2022-10-28 02:20:19 +01:00
parent f302a23069
commit a7203603fe
2 changed files with 8 additions and 0 deletions

View file

@ -34,6 +34,7 @@ enum class GamescopeUpscaleScaler : uint32_t
INTEGER, INTEGER,
FIT, FIT,
FILL, FILL,
STRETCH,
}; };
extern GamescopeUpscaleFilter g_upscaleFilter; extern GamescopeUpscaleFilter g_upscaleFilter;

View file

@ -901,6 +901,13 @@ void calc_scale_factor(float &out_scale_x, float &out_scale_y, float sourceWidth
float XRatio = (float)g_nNestedWidth / sourceWidth; float XRatio = (float)g_nNestedWidth / sourceWidth;
float YRatio = (float)g_nNestedHeight / sourceHeight; float YRatio = (float)g_nNestedHeight / sourceHeight;
if (g_upscaleScaler == GamescopeUpscaleScaler::STRETCH)
{
out_scale_x = XRatio * XOutputRatio;
out_scale_y = YRatio * YOutputRatio;
return;
}
if (g_upscaleScaler != GamescopeUpscaleScaler::FILL) if (g_upscaleScaler != GamescopeUpscaleScaler::FILL)
{ {
out_scale_x = std::min(XRatio, YRatio); out_scale_x = std::min(XRatio, YRatio);