HostDisplay: Add stretch option

This commit is contained in:
Connor McLaughlin
2021-02-27 13:53:03 +10:00
parent f18babb97e
commit e17d37b8bc
10 changed files with 65 additions and 21 deletions

View File

@@ -35,6 +35,8 @@ DisplaySettingsWidget::DisplaySettingsWidget(QtHostInterface* host_interface, QW
"LinearFiltering");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayIntegerScaling, "Display",
"IntegerScaling");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayStretch, "Display",
"Stretch");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, "Display", "VSync");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayAllFrames, "Display", "DisplayAllFrames",
false);
@@ -99,6 +101,9 @@ DisplaySettingsWidget::DisplaySettingsWidget(QtHostInterface* host_interface, QW
m_ui.displayIntegerScaling, tr("Integer Upscaling"), tr("Unchecked"),
tr("Adds padding to the display area to ensure that the ratio between pixels on the host to "
"pixels in the console is an integer number. <br>May result in a sharper image in some 2D games."));
dialog->registerWidgetHelp(
m_ui.displayIntegerScaling, tr("Stretch To Fill"), tr("Unchecked"),
tr("Fills the window with the active display area, regardless of the aspect ratio."));
dialog->registerWidgetHelp(
m_ui.vsync, tr("VSync"), tr("Checked"),
tr("Enable this option to match DuckStation's refresh rate with your current monitor or screen. "
@@ -268,4 +273,5 @@ void DisplaySettingsWidget::onGPUFullscreenModeIndexChanged()
void DisplaySettingsWidget::onIntegerFilteringChanged()
{
m_ui.displayLinearFiltering->setEnabled(!m_ui.displayIntegerScaling->isChecked());
}
m_ui.displayStretch->setEnabled(!m_ui.displayIntegerScaling->isChecked());
}

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>448</width>
<height>430</height>
<width>485</width>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
@@ -134,18 +134,25 @@
<widget class="QComboBox" name="gpuDownsampleMode"/>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="displayLinearFiltering">
<widget class="QCheckBox" name="displayIntegerScaling">
<property name="text">
<string>Linear Upscaling</string>
<string>Integer Upscaling</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="displayIntegerScaling">
<widget class="QCheckBox" name="displayStretch">
<property name="text">
<string>Integer Upscaling</string>
<string>Stretch To Fill</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="displayLinearFiltering">
<property name="text">
<string>Linear Upscaling</string>
</property>
</widget>
</item>

View File

@@ -447,11 +447,11 @@ void QtHostInterface::onDisplayWindowMouseWheelEvent(const QPoint& delta_angle)
void QtHostInterface::onDisplayWindowResized(int width, int height)
{
Log_WarningPrintf("resize %dx%d", width, height);
// this can be null if it was destroyed and the main thread is late catching up
if (!m_display)
return;
Log_DevPrintf("Display window resized to %dx%d", width, height);
m_display->ResizeRenderWindow(width, height);
OnHostDisplayResized(width, height, m_display->GetWindowScale());