Skip to content

Commit

Permalink
MythDisplay: Add option to ignore video mode aspect override
Browse files Browse the repository at this point in the history
- as it shouldn't apply when windowed (rather than fullscreen)
  • Loading branch information
mark-kendall committed Jan 15, 2020
1 parent c2e13bb commit 0bc822e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions mythtv/libs/libmythui/mythdisplay.cpp
Expand Up @@ -257,13 +257,11 @@ int MythDisplay::GetScreenCount(void)

double MythDisplay::GetPixelAspectRatio(void)
{
if (m_physicalSize.width() > 0 && m_physicalSize.height() > 0 &&
m_resolution.width() > 0 && m_resolution.height() > 0)
{
return (m_physicalSize.width() / static_cast<double>(m_resolution.width())) /
(m_physicalSize.height() / static_cast<double>(m_resolution.height()));
}
return 1.0;
if (m_physicalSize.isEmpty() || m_resolution.isEmpty())
return 1.0;

return (m_physicalSize.width() / static_cast<double>(m_resolution.width())) /
(m_physicalSize.height() / static_cast<double>(m_resolution.height()));
}

QSize MythDisplay::GetGUIResolution(void)
Expand Down Expand Up @@ -778,13 +776,13 @@ const vector<MythDisplayMode> &MythDisplay::GetVideoModes(void)
* calculated, then we fallback to the screen resolution (i.e. assume square pixels)
* and finally a guess at 16:9.
*/
double MythDisplay::GetAspectRatio(QString &Source)
double MythDisplay::GetAspectRatio(QString &Source, bool IgnoreModeOverride)
{
auto valid = [](double Aspect) { return (Aspect > 0.1 && Aspect < 10.0); };

// Override for this video mode
// Is this behaviour still needed?
if (valid(m_aspectRatioOverride))
if (!IgnoreModeOverride && valid(m_aspectRatioOverride))
{
Source = tr("Video mode override");
return m_aspectRatioOverride;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythdisplay.h
Expand Up @@ -44,7 +44,7 @@ class MUI_PUBLIC MythDisplay : public QObject, public ReferenceCounter
QSize GetPhysicalSize (void);
double GetRefreshRate (void);
int GetRefreshInterval (int Fallback);
double GetAspectRatio (QString &Source);
double GetAspectRatio (QString &Source, bool IgnoreModeOverride = false);
double EstimateVirtualAspectRatio(void);
MythEDID& GetEDID (void);
std::vector<double> GetRefreshRates(QSize Size);
Expand Down

0 comments on commit 0bc822e

Please sign in to comment.