mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Enable autodetection of upscaling filter
This commit is contained in:
parent
7694e2da4b
commit
0c03e0b7c7
@ -335,25 +335,22 @@ EUpscalingFilter ScreenHandler::loadUpscalingFilter() const
|
||||
if (filter != EUpscalingFilter::AUTO)
|
||||
return filter;
|
||||
|
||||
// for now - always fallback to no filter
|
||||
return EUpscalingFilter::NONE;
|
||||
|
||||
// else - autoselect
|
||||
// Point outputResolution = getRenderResolution();
|
||||
// Point logicalResolution = getPreferredLogicalResolution();
|
||||
//
|
||||
// float scaleX = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||
// float scaleY = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||
// float scaling = std::min(scaleX, scaleY);
|
||||
//
|
||||
// if (scaling <= 1.0f)
|
||||
// return EUpscalingFilter::NONE;
|
||||
// if (scaling <= 2.0f)
|
||||
// return EUpscalingFilter::XBRZ_2;
|
||||
// if (scaling <= 3.0f)
|
||||
// return EUpscalingFilter::XBRZ_3;
|
||||
//
|
||||
// return EUpscalingFilter::XBRZ_4;
|
||||
Point outputResolution = getRenderResolution();
|
||||
Point logicalResolution = getPreferredLogicalResolution();
|
||||
|
||||
float scaleX = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||
float scaleY = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||
float scaling = std::min(scaleX, scaleY);
|
||||
|
||||
if (scaling <= 1.001f)
|
||||
return EUpscalingFilter::NONE; // running at original resolution or even lower than that - no need for xbrz
|
||||
if (scaling <= 2.001f)
|
||||
return EUpscalingFilter::XBRZ_2; // resolutions below 1200p (including 1080p / FullHD)
|
||||
if (scaling <= 3.001f)
|
||||
return EUpscalingFilter::XBRZ_3; // resolutions below 2400p (including 1440p and 2160p / 4K)
|
||||
|
||||
return EUpscalingFilter::XBRZ_4; // Only for massive displays, e.g. 8K
|
||||
}
|
||||
|
||||
void ScreenHandler::selectUpscalingFilter()
|
||||
|
Loading…
x
Reference in New Issue
Block a user