aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Pfau <pfau@peak3d.de>2018-10-31 09:41:05 +0100
committerGitHub <noreply@github.com>2018-10-31 09:41:05 +0100
commit5b29afbf1aab164ebce6a600a88c4215e90ef92d (patch)
tree1288e5608544ae2ad139fcac904f78d4e2c5eab6
parentabaf6171b166e3a4a95e7f27a6105899a10d4bda (diff)
parente8c158606000f19fef478184e20898f8ff8bd5c4 (diff)
Merge pull request #14744 from peak3d/calibration
Fix RES_DESKTOP calibration setting assignement
-rw-r--r--xbmc/settings/DisplaySettings.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp
index b51c8c98aa..b73613d2e6 100644
--- a/xbmc/settings/DisplaySettings.cpp
+++ b/xbmc/settings/DisplaySettings.cpp
@@ -497,7 +497,7 @@ void CDisplaySettings::ApplyCalibrations()
for (ResolutionInfos::const_iterator itCal = m_calibrations.begin(); itCal != m_calibrations.end(); ++itCal)
{
// find resolutions
- for (size_t res = 0; res < m_resolutions.size(); ++res)
+ for (size_t res = RES_DESKTOP; res < m_resolutions.size(); ++res)
{
if (res == RES_WINDOW)
continue;
@@ -548,23 +548,23 @@ void CDisplaySettings::ApplyCalibrations()
void CDisplaySettings::UpdateCalibrations()
{
CSingleLock lock(m_critical);
- for (size_t res = RES_DESKTOP; res < m_resolutions.size(); ++res)
+
+ // Add new (unique) resolutions
+ for (ResolutionInfos::const_iterator res(m_resolutions.cbegin() + RES_DESKTOP + 1); res != m_resolutions.cend(); ++res)
+ if (std::find_if(m_calibrations.cbegin(), m_calibrations.cend(),
+ [&](const RESOLUTION_INFO& info) { return StringUtils::EqualsNoCase(res->strMode, info.strMode); }) == m_resolutions.cend())
+ m_calibrations.push_back(*res);
+
+ for (auto &cal : m_calibrations)
{
- // find calibration
- bool found = false;
- for (ResolutionInfos::iterator itCal = m_calibrations.begin(); itCal != m_calibrations.end(); ++itCal)
+ ResolutionInfos::const_iterator res(std::find_if(m_resolutions.cbegin()+ RES_DESKTOP, m_resolutions.cend(),
+ [&](const RESOLUTION_INFO& info) { return StringUtils::EqualsNoCase(cal.strMode, info.strMode); }));
+
+ if (res != m_resolutions.cend())
{
- if (StringUtils::EqualsNoCase(itCal->strMode, m_resolutions[res].strMode))
- {
- //! @todo erase calibrations with default values
- *itCal = m_resolutions[res];
- found = true;
- break;
- }
+ //! @todo erase calibrations with default values
+ cal = *res;
}
-
- if (!found)
- m_calibrations.push_back(m_resolutions[res]);
}
}