mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-04-27 09:35:42 -04:00
GPU: Add Bilinear (Integer) scaling option
This commit is contained in:
parent
313496e843
commit
a4a35b7e58
@ -1987,6 +1987,7 @@ bool GPU::RenderDisplay(GPUTexture* target, const Common::Rectangle<s32>& draw_r
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DisplayScalingMode::BilinearSmooth:
|
case DisplayScalingMode::BilinearSmooth:
|
||||||
|
case DisplayScalingMode::BlinearInteger:
|
||||||
texture_filter_linear = true;
|
texture_filter_linear = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2297,6 +2298,8 @@ Common::Rectangle<float> GPU::CalculateDrawRect(s32 window_width, s32 window_hei
|
|||||||
float* out_top_padding, float* out_scale, float* out_x_scale,
|
float* out_top_padding, float* out_scale, float* out_x_scale,
|
||||||
bool apply_aspect_ratio /* = true */) const
|
bool apply_aspect_ratio /* = true */) const
|
||||||
{
|
{
|
||||||
|
const bool integer_scale = (g_settings.display_scaling == DisplayScalingMode::NearestInteger ||
|
||||||
|
g_settings.display_scaling == DisplayScalingMode::BlinearInteger);
|
||||||
const float window_ratio = static_cast<float>(window_width) / static_cast<float>(window_height);
|
const float window_ratio = static_cast<float>(window_width) / static_cast<float>(window_height);
|
||||||
const float x_scale =
|
const float x_scale =
|
||||||
apply_aspect_ratio ?
|
apply_aspect_ratio ?
|
||||||
@ -2325,12 +2328,12 @@ Common::Rectangle<float> GPU::CalculateDrawRect(s32 window_width, s32 window_hei
|
|||||||
{
|
{
|
||||||
// align in middle vertically
|
// align in middle vertically
|
||||||
scale = static_cast<float>(window_width) / display_width;
|
scale = static_cast<float>(window_width) / display_width;
|
||||||
if (g_settings.display_scaling == DisplayScalingMode::NearestInteger)
|
if (integer_scale)
|
||||||
scale = std::max(std::floor(scale), 1.0f);
|
scale = std::max(std::floor(scale), 1.0f);
|
||||||
|
|
||||||
if (out_left_padding)
|
if (out_left_padding)
|
||||||
{
|
{
|
||||||
if (g_settings.display_scaling == DisplayScalingMode::NearestInteger)
|
if (integer_scale)
|
||||||
*out_left_padding = std::max<float>((static_cast<float>(window_width) - display_width * scale) / 2.0f, 0.0f);
|
*out_left_padding = std::max<float>((static_cast<float>(window_width) - display_width * scale) / 2.0f, 0.0f);
|
||||||
else
|
else
|
||||||
*out_left_padding = 0.0f;
|
*out_left_padding = 0.0f;
|
||||||
@ -2359,7 +2362,7 @@ Common::Rectangle<float> GPU::CalculateDrawRect(s32 window_width, s32 window_hei
|
|||||||
{
|
{
|
||||||
// align in middle horizontally
|
// align in middle horizontally
|
||||||
scale = static_cast<float>(window_height) / display_height;
|
scale = static_cast<float>(window_height) / display_height;
|
||||||
if (g_settings.display_scaling == DisplayScalingMode::NearestInteger)
|
if (integer_scale)
|
||||||
scale = std::max(std::floor(scale), 1.0f);
|
scale = std::max(std::floor(scale), 1.0f);
|
||||||
|
|
||||||
if (out_left_padding)
|
if (out_left_padding)
|
||||||
@ -2384,7 +2387,7 @@ Common::Rectangle<float> GPU::CalculateDrawRect(s32 window_width, s32 window_hei
|
|||||||
|
|
||||||
if (out_top_padding)
|
if (out_top_padding)
|
||||||
{
|
{
|
||||||
if (g_settings.display_scaling == DisplayScalingMode::NearestInteger)
|
if (integer_scale)
|
||||||
*out_top_padding = std::max<float>((static_cast<float>(window_height) - (display_height * scale)) / 2.0f, 0.0f);
|
*out_top_padding = std::max<float>((static_cast<float>(window_height) - (display_height * scale)) / 2.0f, 0.0f);
|
||||||
else
|
else
|
||||||
*out_top_padding = 0.0f;
|
*out_top_padding = 0.0f;
|
||||||
|
@ -1417,15 +1417,17 @@ const char* Settings::GetDisplayAlignmentDisplayName(DisplayAlignment alignment)
|
|||||||
|
|
||||||
static constexpr const std::array s_display_scaling_names = {
|
static constexpr const std::array s_display_scaling_names = {
|
||||||
"Nearest",
|
"Nearest",
|
||||||
"BilinearSmooth",
|
|
||||||
"NearestInteger",
|
"NearestInteger",
|
||||||
|
"BilinearSmooth",
|
||||||
"BilinearSharp",
|
"BilinearSharp",
|
||||||
|
"BilinearInteger",
|
||||||
};
|
};
|
||||||
static constexpr const std::array s_display_scaling_display_names = {
|
static constexpr const std::array s_display_scaling_display_names = {
|
||||||
TRANSLATE_NOOP("DisplayScalingMode", "Nearest-Neighbor"),
|
TRANSLATE_NOOP("DisplayScalingMode", "Nearest-Neighbor"),
|
||||||
TRANSLATE_NOOP("DisplayScalingMode", "Bilinear (Smooth)"),
|
|
||||||
TRANSLATE_NOOP("DisplayScalingMode", "Nearest-Neighbor (Integer)"),
|
TRANSLATE_NOOP("DisplayScalingMode", "Nearest-Neighbor (Integer)"),
|
||||||
|
TRANSLATE_NOOP("DisplayScalingMode", "Bilinear (Smooth)"),
|
||||||
TRANSLATE_NOOP("DisplayScalingMode", "Bilinear (Sharp)"),
|
TRANSLATE_NOOP("DisplayScalingMode", "Bilinear (Sharp)"),
|
||||||
|
TRANSLATE_NOOP("DisplayScalingMode", "Bilinear (Integer)"),
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<DisplayScalingMode> Settings::ParseDisplayScaling(const char* str)
|
std::optional<DisplayScalingMode> Settings::ParseDisplayScaling(const char* str)
|
||||||
|
@ -155,9 +155,10 @@ enum class DisplayAlignment : u8
|
|||||||
enum class DisplayScalingMode : u8
|
enum class DisplayScalingMode : u8
|
||||||
{
|
{
|
||||||
Nearest,
|
Nearest,
|
||||||
BilinearSmooth,
|
|
||||||
NearestInteger,
|
NearestInteger,
|
||||||
|
BilinearSmooth,
|
||||||
BilinearSharp,
|
BilinearSharp,
|
||||||
|
BlinearInteger,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user