mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-17 00:15:47 -04:00
HostDisplay: Add stretch option
This commit is contained in:
@ -148,9 +148,11 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float*
|
||||
float* out_top_padding, float* out_scale, float* out_x_scale,
|
||||
bool apply_aspect_ratio /* = true */) const
|
||||
{
|
||||
const float window_ratio = static_cast<float>(window_width) / static_cast<float>(window_height);
|
||||
const float display_aspect_ratio = m_display_stretch ? window_ratio : m_display_aspect_ratio;
|
||||
const float x_scale =
|
||||
apply_aspect_ratio ?
|
||||
(m_display_aspect_ratio / (static_cast<float>(m_display_width) / static_cast<float>(m_display_height))) :
|
||||
(display_aspect_ratio / (static_cast<float>(m_display_width) / static_cast<float>(m_display_height))) :
|
||||
1.0f;
|
||||
const float display_width = static_cast<float>(m_display_width) * x_scale;
|
||||
const float display_height = static_cast<float>(m_display_height);
|
||||
@ -162,8 +164,6 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float*
|
||||
*out_x_scale = x_scale;
|
||||
|
||||
// now fit it within the window
|
||||
const float window_ratio = static_cast<float>(window_width) / static_cast<float>(window_height);
|
||||
|
||||
float scale;
|
||||
if ((display_width / display_height) >= window_ratio)
|
||||
{
|
||||
|
@ -196,6 +196,7 @@ public:
|
||||
void SetDisplayTopMargin(s32 height) { m_display_top_margin = height; }
|
||||
void SetDisplayIntegerScaling(bool enabled) { m_display_integer_scaling = enabled; }
|
||||
void SetDisplayAlignment(Alignment alignment) { m_display_alignment = alignment; }
|
||||
void SetDisplayStretch(bool stretch) { m_display_stretch = stretch; }
|
||||
|
||||
/// Sets the software cursor to the specified texture. Ownership of the texture is transferred.
|
||||
void SetSoftwareCursor(std::unique_ptr<HostDisplayTexture> texture, float scale = 1.0f);
|
||||
@ -276,4 +277,5 @@ protected:
|
||||
bool m_display_linear_filtering = false;
|
||||
bool m_display_changed = false;
|
||||
bool m_display_integer_scaling = false;
|
||||
bool m_display_stretch = false;
|
||||
};
|
||||
|
@ -109,6 +109,7 @@ bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
||||
// set host display settings
|
||||
m_display->SetDisplayLinearFiltering(g_settings.display_linear_filtering);
|
||||
m_display->SetDisplayIntegerScaling(g_settings.display_integer_scaling);
|
||||
m_display->SetDisplayStretch(g_settings.display_stretch);
|
||||
|
||||
// create the audio stream. this will never fail, since we'll just fall back to null
|
||||
CreateAudioStream();
|
||||
@ -545,6 +546,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
si.SetBoolValue("Display", "Force4_3For24Bit", false);
|
||||
si.SetBoolValue("Display", "LinearFiltering", true);
|
||||
si.SetBoolValue("Display", "IntegerScaling", false);
|
||||
si.SetBoolValue("Display", "Stretch", false);
|
||||
si.SetBoolValue("Display", "PostProcessing", false);
|
||||
si.SetBoolValue("Display", "ShowOSDMessages", true);
|
||||
si.SetBoolValue("Display", "ShowFPS", false);
|
||||
@ -593,8 +595,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
si.SetStringValue("MemoryCards", "Card2Path", "memcards" FS_OSPATH_SEPARATOR_STR "shared_card_2.mcd");
|
||||
si.SetBoolValue("MemoryCards", "UsePlaylistTitle", true);
|
||||
|
||||
si.SetStringValue("ControllerPorts", "MultitapMode",
|
||||
Settings::GetMultitapModeName(Settings::DEFAULT_MULTITAP_MODE));
|
||||
si.SetStringValue("ControllerPorts", "MultitapMode", Settings::GetMultitapModeName(Settings::DEFAULT_MULTITAP_MODE));
|
||||
|
||||
si.SetStringValue("Logging", "LogLevel", Settings::GetLogLevelName(Settings::DEFAULT_LOG_LEVEL));
|
||||
si.SetStringValue("Logging", "LogFilter", "");
|
||||
@ -655,6 +656,12 @@ void HostInterface::FixIncompatibleSettings(bool display_osd_messages)
|
||||
g_settings.display_linear_filtering = false;
|
||||
}
|
||||
|
||||
if (g_settings.display_stretch && g_settings.display_linear_filtering)
|
||||
{
|
||||
Log_WarningPrintf("Disabling stretch due to integer upscaling.");
|
||||
g_settings.display_stretch = false;
|
||||
}
|
||||
|
||||
if (g_settings.gpu_pgxp_enable)
|
||||
{
|
||||
if (g_settings.gpu_renderer == GPURenderer::Software)
|
||||
@ -884,11 +891,17 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings)
|
||||
if (g_settings.multitap_mode != old_settings.multitap_mode)
|
||||
System::UpdateMultitaps();
|
||||
|
||||
if (m_display && g_settings.display_linear_filtering != old_settings.display_linear_filtering)
|
||||
m_display->SetDisplayLinearFiltering(g_settings.display_linear_filtering);
|
||||
if (m_display)
|
||||
{
|
||||
if (g_settings.display_linear_filtering != old_settings.display_linear_filtering)
|
||||
m_display->SetDisplayLinearFiltering(g_settings.display_linear_filtering);
|
||||
|
||||
if (m_display && g_settings.display_integer_scaling != old_settings.display_integer_scaling)
|
||||
m_display->SetDisplayIntegerScaling(g_settings.display_integer_scaling);
|
||||
if (g_settings.display_integer_scaling != old_settings.display_integer_scaling)
|
||||
m_display->SetDisplayIntegerScaling(g_settings.display_integer_scaling);
|
||||
|
||||
if (g_settings.display_stretch != old_settings.display_stretch)
|
||||
m_display->SetDisplayStretch(g_settings.display_stretch);
|
||||
}
|
||||
}
|
||||
|
||||
void HostInterface::SetUserDirectoryToProgramDirectory()
|
||||
|
@ -214,6 +214,7 @@ void Settings::Load(SettingsInterface& si)
|
||||
display_line_end_offset = static_cast<s8>(si.GetIntValue("Display", "LineEndOffset", 0));
|
||||
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
||||
display_integer_scaling = si.GetBoolValue("Display", "IntegerScaling", false);
|
||||
display_stretch = si.GetBoolValue("Display", "Stretch", false);
|
||||
display_post_processing = si.GetBoolValue("Display", "PostProcessing", false);
|
||||
display_show_osd_messages = si.GetBoolValue("Display", "ShowOSDMessages", true);
|
||||
display_show_fps = si.GetBoolValue("Display", "ShowFPS", false);
|
||||
@ -382,6 +383,7 @@ void Settings::Save(SettingsInterface& si) const
|
||||
si.SetStringValue("Display", "AspectRatio", GetDisplayAspectRatioName(display_aspect_ratio));
|
||||
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
||||
si.SetBoolValue("Display", "IntegerScaling", display_integer_scaling);
|
||||
si.SetBoolValue("Display", "Stretch", display_stretch);
|
||||
si.SetBoolValue("Display", "PostProcessing", display_post_processing);
|
||||
si.SetBoolValue("Display", "ShowOSDMessages", display_show_osd_messages);
|
||||
si.SetBoolValue("Display", "ShowFPS", display_show_fps);
|
||||
|
@ -134,6 +134,7 @@ struct Settings
|
||||
bool gpu_24bit_chroma_smoothing = false;
|
||||
bool display_linear_filtering = true;
|
||||
bool display_integer_scaling = false;
|
||||
bool display_stretch = false;
|
||||
bool display_post_processing = false;
|
||||
bool display_show_osd_messages = false;
|
||||
bool display_show_fps = false;
|
||||
|
Reference in New Issue
Block a user