Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
- index 57bffa3..95349a3 100644
- --- a/xbmc/Application.cpp
- +++ b/xbmc/Application.cpp
- @@ -1851,7 +1851,7 @@ void CApplication::RenderNoPresent()
- m_guiPointer.Render();
- // reset image scaling and effect states
- - g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetVideoResolution(), false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- RenderMemoryStatus();
- RenderScreenSaver();
- @@ -2113,7 +2113,7 @@ void CApplication::RenderMemoryStatus()
- // reset the window scaling and fade status
- RESOLUTION res = g_graphicsContext.GetVideoResolution();
- - g_graphicsContext.SetRenderingResolution(res, false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- static int yShift = 20;
- static int xShift = 40;
- @@ -2179,7 +2179,7 @@ void CApplication::RenderMemoryStatus()
- g_graphicsContext.SetScalingResolution(window->GetCoordsRes(), true);
- point.x *= g_graphicsContext.GetGUIScaleX();
- point.y *= g_graphicsContext.GetGUIScaleY();
- - g_graphicsContext.SetRenderingResolution(res, false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- }
- info.AppendFormat("Mouse: (%d,%d) ", (int)point.x, (int)point.y);
- if (window)
- diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp
- index 51ea49c..49908e9 100644
- --- a/xbmc/addons/AddonManager.cpp
- +++ b/xbmc/addons/AddonManager.cpp
- @@ -53,7 +53,6 @@ namespace ADDON
- cp_log_severity_t clog_to_cp(int lvl);
- void cp_fatalErrorHandler(const char *msg);
- void cp_logger(cp_log_severity_t level, const char *msg, const char *apid, void *user_data);
- -bool GetExtElementDeque(DEQUEELEMENTS &elements, cp_cfg_element_t *base, const char *path);
- /**********************************************************
- * CAddonMgr
- @@ -147,12 +146,11 @@ bool CAddonMgr::CheckUserDirs(const cp_cfg_element_t *settings)
- if (!userdirs)
- return false;
- - DEQUEELEMENTS elements;
- - bool status = GetExtElementDeque(elements, (cp_cfg_element_t *)userdirs, "userdir");
- - if (!status)
- + ELEMENTS elements;
- + if (!GetExtElements((cp_cfg_element_t *)userdirs, "userdir", elements))
- return false;
- - IDEQUEELEMENTS itr = elements.begin();
- + ELEMENTS::iterator itr = elements.begin();
- while (itr != elements.end())
- {
- CStdString path = GetExtValue(*itr++, "@path");
- @@ -548,25 +546,19 @@ const cp_cfg_element_t *CAddonMgr::GetExtElement(cp_cfg_element_t *base, const c
- return element;
- }
- -/* Returns all duplicate elements from a base element */
- -bool GetExtElementDeque(DEQUEELEMENTS &elements, cp_cfg_element_t *base, const char *path)
- +bool CAddonMgr::GetExtElements(cp_cfg_element_t *base, const char *path, ELEMENTS &elements)
- {
- - if (!base)
- + if (!base || !path)
- return false;
- - unsigned int i = 0;
- - while (true)
- + for (unsigned int i = 0; i < base->num_children; i++)
- {
- - if (i >= base->num_children)
- - break;
- - CStdString temp = (base->children+i)->name;
- + CStdString temp = base->children[i].name;
- if (!temp.compare(path))
- - elements.push_back(base->children+i);
- - i++;
- + elements.push_back(&base->children[i]);
- }
- - if (elements.empty()) return false;
- - return true;
- + return !elements.empty();
- }
- const cp_extension_t *CAddonMgr::GetExtension(const cp_plugin_info_t *props, const char *extension) const
- diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h
- index fb464e0..4e6c1a7 100644
- --- a/xbmc/addons/AddonManager.h
- +++ b/xbmc/addons/AddonManager.h
- @@ -24,6 +24,8 @@
- #include "tinyXML/tinyxml.h"
- #include "threads/CriticalSection.h"
- #include "utils/StdString.h"
- +#include "utils/Job.h"
- +#include "utils/Stopwatch.h"
- #include <vector>
- #include <map>
- #include <deque>
- @@ -39,8 +41,7 @@ namespace ADDON
- {
- typedef std::map<TYPE, VECADDONS> MAPADDONS;
- typedef std::map<TYPE, VECADDONS>::iterator IMAPADDONS;
- - typedef std::deque<cp_cfg_element_t*> DEQUEELEMENTS;
- - typedef std::deque<cp_cfg_element_t*>::iterator IDEQUEELEMENTS;
- + typedef std::vector<cp_cfg_element_t*> ELEMENTS;
- const CStdString ADDON_METAFILE = "description.xml";
- const CStdString ADDON_VIS_EXT = "*.vis";
- @@ -116,6 +117,14 @@ namespace ADDON
- /* libcpluff */
- CStdString GetExtValue(cp_cfg_element_t *base, const char *path);
- + /*! \brief Retrieve a vector of repeated elements from a given configuration element
- + \param base the base configuration element.
- + \param path the path to the configuration element from the base element.
- + \param result [out] returned list of elements.
- + \return true if the configuration element is present and the list of elements is non-empty
- + */
- + bool GetExtElements(cp_cfg_element_t *base, const char *path, ELEMENTS &result);
- +
- /*! \brief Retrieve a list of strings from a given configuration element
- Assumes the configuration element or attribute contains a whitespace separated list of values (eg xs:list schema).
- \param base the base configuration element.
- diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp
- index 675a116..802e2ec 100644
- --- a/xbmc/addons/Skin.cpp
- +++ b/xbmc/addons/Skin.cpp
- @@ -27,8 +27,12 @@
- #include "utils/URIUtils.h"
- #include "settings/Settings.h"
- #include "utils/log.h"
- +#include "utils/StringUtils.h"
- #include "settings/GUISettings.h"
- +// fallback for new skin resolution code
- +#include "filesystem/Directory.h"
- +
- using namespace std;
- using namespace XFILE;
- @@ -39,16 +43,44 @@ boost::shared_ptr<ADDON::CSkinInfo> g_SkinInfo;
- namespace ADDON
- {
- -CSkinInfo::CSkinInfo(const AddonProps &props, RESOLUTION res)
- - : CAddon(props), m_DefaultResolution(res), m_DefaultResolutionWide(res)
- +CSkinInfo::CSkinInfo(const AddonProps &props, const RESOLUTION_INFO &resolution)
- + : CAddon(props), m_defaultRes(resolution)
- {
- }
- CSkinInfo::CSkinInfo(const cp_extension_t *ext)
- : CAddon(ext)
- {
- - m_DefaultResolution = TranslateResolution(CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolution"), RES_PAL_4x3);
- - m_DefaultResolutionWide = TranslateResolution(CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolutionwide"), RES_INVALID);
- + ELEMENTS elements;
- + if (CAddonMgr::Get().GetExtElements(ext->configuration, "res", elements))
- + {
- + for (ELEMENTS::iterator i = elements.begin(); i != elements.end(); ++i)
- + {
- + float width = (float)atof(CAddonMgr::Get().GetExtValue(*i, "@width"));
- + float height = (float)atof(CAddonMgr::Get().GetExtValue(*i, "@height"));
- + bool defRes = CAddonMgr::Get().GetExtValue(*i, "@default").Equals("true");
- + CStdString folder = CAddonMgr::Get().GetExtValue(*i, "@folder");
- + float aspect = 0;
- + CStdStringArray fracs;
- + StringUtils::SplitString(CAddonMgr::Get().GetExtValue(*i, "@aspect"), ":", fracs);
- + if (fracs.size() == 2)
- + aspect = (float)atof(fracs[0].c_str())/atof(fracs[1].c_str());
- + if (width > 0 && height > 0)
- + {
- + RESOLUTION_INFO res(width, height, aspect, folder);
- + if (defRes)
- + m_defaultRes = res;
- + m_resolutions.push_back(res);
- + }
- + }
- + }
- + else
- + { // no resolutions specified -> backward compatibility
- + CStdString defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultwideresolution");
- + if (defaultWide.IsEmpty())
- + defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolution");
- + TranslateResolution(defaultWide, m_defaultRes);
- + }
- CStdString str = CAddonMgr::Get().GetExtValue(ext->configuration, "@effectslowdown");
- if (!str.IsEmpty())
- @@ -65,76 +97,69 @@ CSkinInfo::CSkinInfo(const cp_extension_t *ext)
- }
- CSkinInfo::~CSkinInfo()
- -{}
- +{
- +}
- -void CSkinInfo::Start(const CStdString& strSkinDir /* = "" */)
- +void CSkinInfo::Start(const CStdString &strBaseDir)
- {
- - CLog::Log(LOGINFO, "Default 4:3 resolution directory is %s", URIUtils::AddFileToFolder(Path(), GetDirFromRes(m_DefaultResolution)).c_str());
- - CLog::Log(LOGINFO, "Default 16:9 resolution directory is %s", URIUtils::AddFileToFolder(Path(), GetDirFromRes(m_DefaultResolutionWide)).c_str());
- + if (!m_resolutions.size())
- + { // try falling back to whatever resolutions exist in the directory
- + CFileItemList items;
- + CDirectory::GetDirectory(Path(), items, "", false);
- + for (int i = 0; i < items.Size(); i++)
- + {
- + RESOLUTION_INFO res;
- + if (items[i]->m_bIsFolder && TranslateResolution(items[i]->GetLabel(), res))
- + m_resolutions.push_back(res);
- + }
- + }
- LoadIncludes();
- }
- -CStdString CSkinInfo::GetSkinPath(const CStdString& strFile, RESOLUTION *res, const CStdString& strBaseDir /* = "" */) const
- +struct closestRes
- {
- + closestRes(const RESOLUTION_INFO &target) : m_target(target) { };
- + bool operator()(const RESOLUTION_INFO &i, const RESOLUTION_INFO &j)
- + {
- + float diff = fabs(i.DisplayRatio() - m_target.DisplayRatio()) - fabs(j.DisplayRatio() - m_target.DisplayRatio());
- + if (diff < 0) return true;
- + if (diff > 0) return false;
- + diff = fabs((float)i.iHeight - m_target.iHeight) - fabs((float)j.iHeight - m_target.iHeight);
- + if (diff < 0) return true;
- + if (diff > 0) return false;
- + return fabs((float)i.iWidth - m_target.iWidth) < fabs((float)j.iWidth - m_target.iWidth);
- + }
- + RESOLUTION_INFO m_target;
- +};
- +
- +CStdString CSkinInfo::GetSkinPath(const CStdString& strFile, RESOLUTION_INFO *res, const CStdString& strBaseDir /* = "" */) const
- +{
- + if (m_resolutions.empty())
- + return ""; // invalid skin
- +
- CStdString strPathToUse = Path();
- if (!strBaseDir.IsEmpty())
- strPathToUse = strBaseDir;
- // if the caller doesn't care about the resolution just use a temporary
- - RESOLUTION tempRes = RES_INVALID;
- + RESOLUTION_INFO tempRes;
- if (!res)
- res = &tempRes;
- - // first try and load from the current resolution's directory
- - *res = g_graphicsContext.GetVideoResolution();
- - if (*res >= RES_WINDOW)
- - {
- - unsigned int pixels = g_settings.m_ResInfo[*res].iHeight * g_settings.m_ResInfo[*res].iWidth;
- - if (pixels >= 1600 * 900)
- - {
- - *res = RES_HDTV_1080i;
- - }
- - else if (pixels >= 900 * 600)
- - {
- - *res = RES_HDTV_720p;
- - }
- - else if (((float)g_settings.m_ResInfo[*res].iWidth) / ((float)g_settings.m_ResInfo[*res].iHeight) > 8.0f / (3.0f * sqrt(3.0f)))
- - {
- - *res = RES_PAL_16x9;
- - }
- - else
- - {
- - *res = RES_PAL_4x3;
- - }
- - }
- - CStdString strPath = URIUtils::AddFileToFolder(strPathToUse, GetDirFromRes(*res));
- + // find the closest resolution
- + const RESOLUTION_INFO &target = g_graphicsContext.GetResInfo();
- + *res = *std::min_element(m_resolutions.begin(), m_resolutions.end(), closestRes(target));
- +
- + CStdString strPath = URIUtils::AddFileToFolder(strPathToUse, res->strMode);
- strPath = URIUtils::AddFileToFolder(strPath, strFile);
- if (CFile::Exists(strPath))
- return strPath;
- - // if we're in 1080i mode, try 720p next
- - if (*res == RES_HDTV_1080i)
- - {
- - *res = RES_HDTV_720p;
- - strPath = URIUtils::AddFileToFolder(strPathToUse, GetDirFromRes(*res));
- - strPath = URIUtils::AddFileToFolder(strPath, strFile);
- - if (CFile::Exists(strPath))
- - return strPath;
- - }
- - // that failed - drop to the default widescreen resolution if where in a widemode
- - if (*res == RES_PAL_16x9 || *res == RES_NTSC_16x9 || *res == RES_HDTV_480p_16x9 || *res == RES_HDTV_720p)
- - {
- - *res = m_DefaultResolutionWide;
- - strPath = URIUtils::AddFileToFolder(strPathToUse, GetDirFromRes(*res));
- - strPath = URIUtils::AddFileToFolder(strPath, strFile);
- - if (CFile::Exists(strPath))
- - return strPath;
- - }
- - // that failed - drop to the default resolution
- - *res = m_DefaultResolution;
- - strPath = URIUtils::AddFileToFolder(strPathToUse, GetDirFromRes(*res));
- +
- + // use the default resolution
- + *res = m_defaultRes;
- +
- + strPath = URIUtils::AddFileToFolder(strPathToUse, res->strMode);
- strPath = URIUtils::AddFileToFolder(strPath, strFile);
- - // check if we don't have any subdirectories
- - if (*res == RES_INVALID) *res = RES_PAL_4x3;
- return strPath;
- }
- @@ -143,39 +168,6 @@ bool CSkinInfo::HasSkinFile(const CStdString &strFile) const
- return CFile::Exists(GetSkinPath(strFile));
- }
- -CStdString CSkinInfo::GetDirFromRes(RESOLUTION res) const
- -{
- - CStdString strRes;
- - switch (res)
- - {
- - case RES_PAL_4x3:
- - strRes = "PAL";
- - break;
- - case RES_PAL_16x9:
- - strRes = "PAL16x9";
- - break;
- - case RES_NTSC_4x3:
- - case RES_HDTV_480p_4x3:
- - strRes = "NTSC";
- - break;
- - case RES_NTSC_16x9:
- - case RES_HDTV_480p_16x9:
- - strRes = "ntsc16x9";
- - break;
- - case RES_HDTV_720p:
- - strRes = "720p";
- - break;
- - case RES_HDTV_1080i:
- - strRes = "1080i";
- - break;
- - case RES_INVALID:
- - default:
- - strRes = "";
- - break;
- - }
- - return strRes;
- -}
- -
- double CSkinInfo::GetMinVersion()
- {
- return SKIN_MIN_VERSION;
- @@ -210,69 +202,45 @@ int CSkinInfo::GetStartWindow() const
- bool CSkinInfo::LoadStartupWindows(const cp_extension_t *ext)
- {
- m_startupWindows.clear();
- - /*{ // yay, run through and grab the startup windows
- - const TiXmlElement *window = startup->FirstChildElement("window");
- - while (window && window->FirstChild())
- - {
- - int id;
- - window->Attribute("id", &id);
- - CStdString name = window->FirstChild()->Value();
- - m_startupWindows.push_back(CStartupWindow(id + WINDOW_HOME, name));
- - window = window->NextSiblingElement("window");
- - }
- - }*/
- -
- - // ok, now see if we have any startup windows
- - if (!m_startupWindows.size())
- - { // nope - add the default ones
- - m_startupWindows.push_back(CStartupWindow(WINDOW_HOME, "513"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_PROGRAMS, "0"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_PICTURES, "1"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_MUSIC, "2"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_VIDEOS, "3"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_FILES, "7"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_SETTINGS_MENU, "5"));
- - m_startupWindows.push_back(CStartupWindow(WINDOW_WEATHER, "8"));
- - m_onlyAnimateToHome = true;
- - }
- - else
- - m_onlyAnimateToHome = false;
- + m_startupWindows.push_back(CStartupWindow(WINDOW_HOME, "513"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_PROGRAMS, "0"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_PICTURES, "1"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_MUSIC, "2"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_VIDEOS, "3"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_FILES, "7"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_SETTINGS_MENU, "5"));
- + m_startupWindows.push_back(CStartupWindow(WINDOW_WEATHER, "8"));
- + m_onlyAnimateToHome = true;
- return true;
- }
- -bool CSkinInfo::IsWide(RESOLUTION res) const
- -{
- - return (res == RES_PAL_16x9 || res == RES_NTSC_16x9 || res == RES_HDTV_480p_16x9 || res == RES_HDTV_720p || res == RES_HDTV_1080i);
- -}
- -
- void CSkinInfo::GetSkinPaths(std::vector<CStdString> &paths) const
- {
- - RESOLUTION resToUse = RES_INVALID;
- - GetSkinPath("Home.xml", &resToUse);
- - paths.push_back(URIUtils::AddFileToFolder(Path(), GetDirFromRes(resToUse)));
- - // see if we need to add other paths
- - if (resToUse != m_DefaultResolutionWide && IsWide(resToUse))
- - paths.push_back(URIUtils::AddFileToFolder(Path(), GetDirFromRes(m_DefaultResolutionWide)));
- - if (resToUse != m_DefaultResolution && (!IsWide(resToUse) || m_DefaultResolutionWide != m_DefaultResolution))
- - paths.push_back(URIUtils::AddFileToFolder(Path(), GetDirFromRes(m_DefaultResolution)));
- + RESOLUTION_INFO res;
- + GetSkinPath("Home.xml", &res);
- + if (!res.strMode.empty())
- + paths.push_back(URIUtils::AddFileToFolder(Path(), res.strMode));
- + if (res.strMode != m_defaultRes.strMode)
- + paths.push_back(URIUtils::AddFileToFolder(Path(), m_defaultRes.strMode));
- }
- -RESOLUTION CSkinInfo::TranslateResolution(const CStdString &res, RESOLUTION def)
- +bool CSkinInfo::TranslateResolution(const CStdString &name, RESOLUTION_INFO &res)
- {
- - if (res.Equals("pal"))
- - return RES_PAL_4x3;
- - else if (res.Equals("pal16x9"))
- - return RES_PAL_16x9;
- - else if (res.Equals("ntsc"))
- - return RES_NTSC_4x3;
- - else if (res.Equals("ntsc16x9"))
- - return RES_NTSC_16x9;
- - else if (res.Equals("720p"))
- - return RES_HDTV_720p;
- - else if (res.Equals("1080i"))
- - return RES_HDTV_1080i;
- - CLog::Log(LOGERROR, "%s invalid resolution specified for %s", __FUNCTION__, res.c_str());
- - return def;
- + if (name.Equals("pal"))
- + res = RESOLUTION_INFO(720, 576, 4.0f/3, "pal");
- + else if (name.Equals("pal16x9"))
- + res = RESOLUTION_INFO(720, 576, 16.0f/9, "pal16x9");
- + else if (name.Equals("ntsc"))
- + res = RESOLUTION_INFO(720, 480, 4.0f/3, "ntsc");
- + else if (name.Equals("ntsc16x9"))
- + res = RESOLUTION_INFO(720, 480, 16.0f/9, "ntsc16x9");
- + else if (name.Equals("720p"))
- + res = RESOLUTION_INFO(1280, 720, 0, "720p");
- + else if (name.Equals("1080i"))
- + res = RESOLUTION_INFO(1920, 1080, 0, "1080i");
- + else
- + return false;
- + return true;
- }
- int CSkinInfo::GetFirstWindow() const
- diff --git a/xbmc/addons/Skin.h b/xbmc/addons/Skin.h
- index e751b5c..11be79f 100644
- --- a/xbmc/addons/Skin.h
- +++ b/xbmc/addons/Skin.h
- @@ -46,7 +46,7 @@ public:
- };
- //FIXME remove this, kept for current repo handling
- - CSkinInfo(const ADDON::AddonProps &props, RESOLUTION res = RES_HDTV_720p);
- + CSkinInfo(const ADDON::AddonProps &props, const RESOLUTION_INFO &res = RESOLUTION_INFO());
- CSkinInfo(const cp_extension_t *ext);
- virtual ~CSkinInfo();
- @@ -64,7 +64,7 @@ public:
- \param baseDir [in] If non-empty, the given directory is searched instead of the skin's directory. Defaults to empty.
- \return path to the XML file
- */
- - CStdString GetSkinPath(const CStdString& file, RESOLUTION *res = NULL, const CStdString& baseDir = "") const;
- + CStdString GetSkinPath(const CStdString& file, RESOLUTION_INFO *res = NULL, const CStdString& baseDir = "") const;
- double GetVersion() const { return m_Version; };
- @@ -87,11 +87,11 @@ public:
- int GetStartWindow() const;
- /*! \brief Translate a resolution string
- - \param res the string to translate
- - \param def the default to use if res is invalid
- - \return the translated resolution
- + \param name the string to translate
- + \param res [out] the resolution structure if name is valid
- + \return true if the resolution is valid, false otherwise
- */
- - static RESOLUTION TranslateResolution(const CStdString &res, RESOLUTION def);
- + static bool TranslateResolution(const CStdString &name, RESOLUTION_INFO &res);
- void ResolveIncludes(TiXmlElement *node);
- @@ -125,10 +125,10 @@ protected:
- void LoadIncludes();
- bool LoadStartupWindows(const cp_extension_t *ext);
- - bool IsWide(RESOLUTION res) const;
- - RESOLUTION m_DefaultResolution; // default resolution for the skin in 4:3 modes
- - RESOLUTION m_DefaultResolutionWide; // default resolution for the skin in 16:9 modes
- + RESOLUTION_INFO m_defaultRes;
- + std::vector<RESOLUTION_INFO> m_resolutions;
- +
- double m_Version;
- float m_effectsSlowDown;
- diff --git a/xbmc/cores/DummyVideoPlayer.cpp b/xbmc/cores/DummyVideoPlayer.cpp
- index 821a39f..e6f9a10 100644
- --- a/xbmc/cores/DummyVideoPlayer.cpp
- +++ b/xbmc/cores/DummyVideoPlayer.cpp
- @@ -91,7 +91,7 @@ void CDummyVideoPlayer::Process()
- g_Windowing.Get3DDevice()->BeginScene();
- #endif
- g_graphicsContext.Clear();
- - g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetVideoResolution(), false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- Render();
- g_application.RenderNoPresent();
- #ifdef HAS_DX
- diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp
- index 7694380..4982d7b 100644
- --- a/xbmc/dialogs/GUIDialogContextMenu.cpp
- +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp
- @@ -151,11 +151,11 @@ void CGUIDialogContextMenu::SetupButtons()
- void CGUIDialogContextMenu::SetPosition(float posX, float posY)
- {
- - if (posY + GetHeight() > g_settings.m_ResInfo[m_coordsRes].iHeight)
- - posY = g_settings.m_ResInfo[m_coordsRes].iHeight - GetHeight();
- + if (posY + GetHeight() > m_coordsRes.iHeight)
- + posY = m_coordsRes.iHeight - GetHeight();
- if (posY < 0) posY = 0;
- - if (posX + GetWidth() > g_settings.m_ResInfo[m_coordsRes].iWidth)
- - posX = g_settings.m_ResInfo[m_coordsRes].iWidth - GetWidth();
- + if (posX + GetWidth() > m_coordsRes.iWidth)
- + posX = m_coordsRes.iWidth - GetWidth();
- if (posX < 0) posX = 0;
- // we currently hack the positioning of the buttons from y position 0, which
- // forces skinners to place the top image at a negative y value. Thus, we offset
- diff --git a/xbmc/guilib/GUIFontManager.cpp b/xbmc/guilib/GUIFontManager.cpp
- index 98c4bd0..383226a 100644
- --- a/xbmc/guilib/GUIFontManager.cpp
- +++ b/xbmc/guilib/GUIFontManager.cpp
- @@ -39,7 +39,6 @@ GUIFontManager g_fontManager;
- GUIFontManager::GUIFontManager(void)
- {
- - m_skinResolution=RES_INVALID;
- m_fontsetUnicode=false;
- m_canReload = true;
- }
- @@ -49,7 +48,7 @@ GUIFontManager::~GUIFontManager(void)
- Clear();
- }
- -void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, RESOLUTION sourceRes, bool preserveAspect) const
- +void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const
- {
- // set scaling resolution so that we can scale our font sizes correctly
- // as fonts aren't scaled at render time (due to aliasing) we must scale
- @@ -66,8 +65,7 @@ void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, RESOLU
- // font streched like the rest of the UI, aspect parameter being the original aspect
- // adjust aspect ratio
- - if (sourceRes == RES_PAL_16x9 || sourceRes == RES_PAL60_16x9 || sourceRes == RES_NTSC_16x9 || sourceRes == RES_HDTV_480p_16x9)
- - *aspect *= 0.75f;
- + *aspect *= sourceRes.fPixelRatio;
- *aspect *= g_graphicsContext.GetGUIScaleY() / g_graphicsContext.GetGUIScaleX();
- }
- @@ -75,7 +73,7 @@ void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, RESOLU
- *size /= g_graphicsContext.GetGUIScaleY();
- }
- -CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border, float lineSpacing, float aspect, RESOLUTION sourceRes, bool preserveAspect)
- +CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border, float lineSpacing, float aspect, const RESOLUTION_INFO *sourceRes, bool preserveAspect)
- {
- float originalAspect = aspect;
- @@ -84,11 +82,11 @@ CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdStrin
- if (pFont)
- return pFont;
- - if (sourceRes == RES_INVALID) // no source res specified, so assume the skin res
- - sourceRes = m_skinResolution;
- + if (!sourceRes) // no source res specified, so assume the skin res
- + sourceRes = &m_skinResolution;
- float newSize = (float)iSize;
- - RescaleFontSizeAndAspect(&newSize, &aspect, sourceRes, preserveAspect);
- + RescaleFontSizeAndAspect(&newSize, &aspect, *sourceRes, preserveAspect);
- // First try to load the font from the skin
- CStdString strPath;
- @@ -151,7 +149,7 @@ CGUIFont* GUIFontManager::LoadTTF(const CStdString& strFontName, const CStdStrin
- fontInfo.aspect = originalAspect;
- fontInfo.fontFilePath = strPath;
- fontInfo.fileName = strFilename;
- - fontInfo.sourceRes = sourceRes;
- + fontInfo.sourceRes = *sourceRes;
- fontInfo.preserveAspect = preserveAspect;
- fontInfo.border = border;
- m_vecFontInfo.push_back(fontInfo);
- @@ -307,7 +305,7 @@ CGUIFont* GUIFontManager::GetDefaultFont(bool border)
- { // create it
- CGUIFont *font13 = m_vecFonts[font13index];
- OrigFontInfo fontInfo = m_vecFontInfo[font13index];
- - font13border = LoadTTF("__defaultborder__", fontInfo.fileName, 0xFF000000, 0, fontInfo.size, font13->GetStyle(), true, 1.0f, fontInfo.aspect, fontInfo.sourceRes, fontInfo.preserveAspect);
- + font13border = LoadTTF("__defaultborder__", fontInfo.fileName, 0xFF000000, 0, fontInfo.size, font13->GetStyle(), true, 1.0f, fontInfo.aspect, &fontInfo.sourceRes, fontInfo.preserveAspect);
- }
- return font13border;
- }
- diff --git a/xbmc/guilib/GUIFontManager.h b/xbmc/guilib/GUIFontManager.h
- index acdc46b..f0237e2 100644
- --- a/xbmc/guilib/GUIFontManager.h
- +++ b/xbmc/guilib/GUIFontManager.h
- @@ -44,7 +44,7 @@ struct OrigFontInfo
- float aspect;
- CStdString fontFilePath;
- CStdString fileName;
- - RESOLUTION sourceRes;
- + RESOLUTION_INFO sourceRes;
- bool preserveAspect;
- bool border;
- };
- @@ -63,7 +63,7 @@ public:
- void Unload(const CStdString& strFontName);
- void LoadFonts(const CStdString& strFontSet);
- - CGUIFont* LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, RESOLUTION res = RES_INVALID, bool preserveAspect = false);
- + CGUIFont* LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, const RESOLUTION_INFO *res = NULL, bool preserveAspect = false);
- CGUIFont* GetFont(const CStdString& strFontName, bool fallback = true);
- /*! \brief return a default font
- @@ -80,7 +80,7 @@ public:
- bool GetFirstFontSetUnicode(CStdString& strFontSet);
- protected:
- - void RescaleFontSizeAndAspect(float *size, float *aspect, RESOLUTION sourceRes, bool preserveAspect) const;
- + void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const;
- void ReloadTTFFonts();
- void LoadFonts(const TiXmlNode* fontNode);
- CGUIFontTTFBase* GetFontFile(const CStdString& strFontFile);
- @@ -90,7 +90,7 @@ protected:
- std::vector<CGUIFontTTFBase*> m_vecFontFiles;
- std::vector<OrigFontInfo> m_vecFontInfo;
- bool m_fontsetUnicode;
- - RESOLUTION m_skinResolution;
- + RESOLUTION_INFO m_skinResolution;
- bool m_canReload;
- };
- diff --git a/xbmc/guilib/GUIWindow.cpp b/xbmc/guilib/GUIWindow.cpp
- index 7b37a6d..cf23daf 100644
- --- a/xbmc/guilib/GUIWindow.cpp
- +++ b/xbmc/guilib/GUIWindow.cpp
- @@ -24,7 +24,6 @@
- #include "GUIWindowManager.h"
- #include "Key.h"
- #include "LocalizeStrings.h"
- -#include "settings/Settings.h"
- #include "GUIControlFactory.h"
- #include "GUIControlGroup.h"
- #include "GUIControlProfiler.h"
- @@ -53,7 +52,6 @@ CGUIWindow::CGUIWindow(int id, const CStdString &xmlFile)
- m_idRange = 1;
- m_lastControlID = 0;
- m_overlayState = OVERLAY_STATE_PARENT_WINDOW; // Use parent or previous window's state
- - m_coordsRes = g_guiSettings.m_LookAndFeelResolution;
- m_isDialog = false;
- m_needsScaling = true;
- m_windowLoaded = false;
- @@ -83,7 +81,6 @@ bool CGUIWindow::Load(const CStdString& strFileName, bool bContainsPath)
- int64_t start;
- start = CurrentHostCounter();
- #endif
- - RESOLUTION resToUse = RES_INVALID;
- CLog::Log(LOGINFO, "Loading skin file: %s", strFileName.c_str());
- // Find appropriate skin folder + resolution to load from
- @@ -94,13 +91,10 @@ bool CGUIWindow::Load(const CStdString& strFileName, bool bContainsPath)
- else
- {
- // FIXME: strLowerPath needs to eventually go since resToUse can get incorrectly overridden
- - strLowerPath = g_SkinInfo->GetSkinPath(CStdString(strFileName).ToLower(), &resToUse);
- - strPath = g_SkinInfo->GetSkinPath(strFileName, &resToUse);
- + strLowerPath = g_SkinInfo->GetSkinPath(CStdString(strFileName).ToLower(), &m_coordsRes);
- + strPath = g_SkinInfo->GetSkinPath(strFileName, &m_coordsRes);
- }
- - if (!bContainsPath)
- - m_coordsRes = resToUse;
- -
- bool ret = LoadXML(strPath.c_str(), strLowerPath.c_str());
- #ifdef _DEBUG
- @@ -176,7 +170,7 @@ bool CGUIWindow::Load(TiXmlDocument &xmlDoc)
- }
- else if (strValue == "animation" && pChild->FirstChild())
- {
- - CRect rect(0, 0, (float)g_settings.m_ResInfo[m_coordsRes].iWidth, (float)g_settings.m_ResInfo[m_coordsRes].iHeight);
- + CRect rect(0, 0, (float)m_coordsRes.iWidth, (float)m_coordsRes.iHeight);
- CAnimation anim;
- anim.Create(pChild, rect);
- m_animations.push_back(anim);
- @@ -241,7 +235,7 @@ void CGUIWindow::LoadControl(TiXmlElement* pControl, CGUIControlGroup *pGroup)
- // get control type
- CGUIControlFactory factory;
- - CRect rect(0, 0, (float)g_settings.m_ResInfo[m_coordsRes].iWidth, (float)g_settings.m_ResInfo[m_coordsRes].iHeight);
- + CRect rect(0, 0, (float)m_coordsRes.iWidth, (float)m_coordsRes.iHeight);
- if (pGroup)
- {
- rect.x1 = pGroup->GetXPosition();
- @@ -288,8 +282,8 @@ void CGUIWindow::OnWindowLoaded()
- void CGUIWindow::CenterWindow()
- {
- - m_posX = (g_settings.m_ResInfo[m_coordsRes].iWidth - GetWidth()) / 2;
- - m_posY = (g_settings.m_ResInfo[m_coordsRes].iHeight - GetHeight()) / 2;
- + m_posX = (m_coordsRes.iWidth - GetWidth()) / 2;
- + m_posY = (m_coordsRes.iHeight - GetHeight()) / 2;
- }
- void CGUIWindow::Render()
- @@ -787,7 +781,7 @@ void CGUIWindow::SetDefaults()
- m_hasCamera = false;
- m_animationsEnabled = true;
- m_clearBackground = 0xff000000; // opaque black -> clear
- - m_hitRect.SetRect(0, 0, (float)g_settings.m_ResInfo[m_coordsRes].iWidth, (float)g_settings.m_ResInfo[m_coordsRes].iHeight);
- + m_hitRect.SetRect(0, 0, (float)m_coordsRes.iWidth, (float)m_coordsRes.iHeight);
- }
- CRect CGUIWindow::GetScaledBounds() const
- diff --git a/xbmc/guilib/GUIWindow.h b/xbmc/guilib/GUIWindow.h
- index 5f3f3a6..1e77392 100644
- --- a/xbmc/guilib/GUIWindow.h
- +++ b/xbmc/guilib/GUIWindow.h
- @@ -135,8 +135,8 @@ public:
- virtual CFileItemPtr GetCurrentListItem(int offset = 0) { return CFileItemPtr(); };
- virtual int GetViewContainerID() const { return 0; };
- virtual bool IsActive() const;
- - void SetCoordsRes(RESOLUTION res) { m_coordsRes = res; };
- - RESOLUTION GetCoordsRes() const { return m_coordsRes; };
- + void SetCoordsRes(const RESOLUTION_INFO &res) { m_coordsRes = res; };
- + const RESOLUTION_INFO &GetCoordsRes() const { return m_coordsRes; };
- void LoadOnDemand(bool loadOnDemand) { m_loadOnDemand = loadOnDemand; };
- bool GetLoadOnDemand() { return m_loadOnDemand; }
- int GetRenderOrder() { return m_renderOrder; };
- @@ -249,7 +249,7 @@ protected:
- int m_idRange;
- OVERLAY_STATE m_overlayState;
- - RESOLUTION m_coordsRes; // resolution that the window coordinates are in.
- + RESOLUTION_INFO m_coordsRes; // resolution that the window coordinates are in.
- bool m_needsScaling;
- bool m_windowLoaded; // true if the window's xml file has been loaded
- bool m_loadOnDemand; // true if the window should be loaded only as needed
- diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp
- index f16ee27..0cab11d 100644
- --- a/xbmc/guilib/GraphicContext.cpp
- +++ b/xbmc/guilib/GraphicContext.cpp
- @@ -51,7 +51,7 @@ CGraphicContext::CGraphicContext(void) :
- m_bFullScreenVideo(false),
- m_bCalibrating(false),
- m_Resolution(RES_INVALID),
- - m_windowResolution(RES_INVALID),
- + /*m_windowResolution,*/
- m_guiScaleX(1.0f),
- m_guiScaleY(1.0f)
- /*,m_cameras, */
- @@ -543,7 +543,12 @@ void CGraphicContext::ApplyStateBlock()
- g_Windowing.ApplyStateBlock();
- }
- -void CGraphicContext::SetScalingResolution(RESOLUTION res, bool needsScaling)
- +const RESOLUTION_INFO &CGraphicContext::GetResInfo() const
- +{
- + return g_settings.m_ResInfo[m_Resolution];
- +}
- +
- +void CGraphicContext::SetScalingResolution(const RESOLUTION_INFO &res, bool needsScaling)
- {
- Lock();
- m_windowResolution = res;
- @@ -558,8 +563,8 @@ void CGraphicContext::SetScalingResolution(RESOLUTION res, bool needsScaling)
- float fToHeight;
- {
- - fFromWidth = (float)g_settings.m_ResInfo[res].iWidth;
- - fFromHeight = (float)g_settings.m_ResInfo[res].iHeight;
- + fFromWidth = (float)res.iWidth;
- + fFromHeight = (float)res.iHeight;
- fToPosX = (float)g_settings.m_ResInfo[m_Resolution].Overscan.left;
- fToPosY = (float)g_settings.m_ResInfo[m_Resolution].Overscan.top;
- fToWidth = (float)g_settings.m_ResInfo[m_Resolution].Overscan.right - fToPosX;
- @@ -608,7 +613,7 @@ void CGraphicContext::SetScalingResolution(RESOLUTION res, bool needsScaling)
- Unlock();
- }
- -void CGraphicContext::SetRenderingResolution(RESOLUTION res, bool needsScaling)
- +void CGraphicContext::SetRenderingResolution(const RESOLUTION_INFO &res, bool needsScaling)
- {
- Lock();
- SetScalingResolution(res, needsScaling);
- @@ -631,16 +636,10 @@ void CGraphicContext::InvertFinalCoords(float &x, float &y) const
- float CGraphicContext::GetScalingPixelRatio() const
- {
- - if (m_Resolution == m_windowResolution)
- - return GetPixelRatio(m_windowResolution);
- -
- - RESOLUTION checkRes = m_windowResolution;
- - if (checkRes == RES_INVALID)
- - checkRes = m_Resolution;
- - // resolutions are different - we want to return the aspect ratio of the video resolution
- + // assume the resolutions are different - we want to return the aspect ratio of the video resolution
- // but only once it's been corrected for the skin -> screen coordinates scaling
- - float winWidth = (float)g_settings.m_ResInfo[checkRes].iWidth;
- - float winHeight = (float)g_settings.m_ResInfo[checkRes].iHeight;
- + float winWidth = (float)m_windowResolution.iWidth;
- + float winHeight = (float)m_windowResolution.iHeight;
- float outWidth = (float)g_settings.m_ResInfo[m_Resolution].iWidth;
- float outHeight = (float)g_settings.m_ResInfo[m_Resolution].iHeight;
- float outPR = GetPixelRatio(m_Resolution);
- @@ -656,9 +655,8 @@ void CGraphicContext::SetCameraPosition(const CPoint &camera)
- if (m_origins.size())
- cam += m_origins.top();
- - RESOLUTION windowRes = (m_windowResolution == RES_INVALID) ? m_Resolution : m_windowResolution;
- - cam.x *= (float)m_iScreenWidth / g_settings.m_ResInfo[windowRes].iWidth;
- - cam.y *= (float)m_iScreenHeight / g_settings.m_ResInfo[windowRes].iHeight;
- + cam.x *= (float)m_iScreenWidth / m_windowResolution.iWidth;
- + cam.y *= (float)m_iScreenHeight / m_windowResolution.iHeight;
- m_cameras.push(cam);
- UpdateCameraPosition(m_cameras.top());
- diff --git a/xbmc/guilib/GraphicContext.h b/xbmc/guilib/GraphicContext.h
- index 1936a36..6fd1462 100644
- --- a/xbmc/guilib/GraphicContext.h
- +++ b/xbmc/guilib/GraphicContext.h
- @@ -102,8 +102,9 @@ public:
- void GetAllowedResolutions(std::vector<RESOLUTION> &res);
- // output scaling
- - void SetRenderingResolution(RESOLUTION res, bool needsScaling); ///< Sets scaling up for rendering
- - void SetScalingResolution(RESOLUTION res, bool needsScaling); ///< Sets scaling up for skin loading etc.
- + const RESOLUTION_INFO &GetResInfo() const;
- + void SetRenderingResolution(const RESOLUTION_INFO &res, bool needsScaling); ///< Sets scaling up for rendering
- + void SetScalingResolution(const RESOLUTION_INFO &res, bool needsScaling); ///< Sets scaling up for skin loading etc.
- float GetScalingPixelRatio() const;
- void Flip();
- void InvertFinalCoords(float &x, float &y) const;
- @@ -203,7 +204,7 @@ protected:
- private:
- void UpdateCameraPosition(const CPoint &camera);
- void UpdateFinalTransform(const TransformMatrix &matrix);
- - RESOLUTION m_windowResolution;
- + RESOLUTION_INFO m_windowResolution;
- float m_guiScaleX;
- float m_guiScaleY;
- std::stack<CPoint> m_cameras;
- diff --git a/xbmc/guilib/Resolution.h b/xbmc/guilib/Resolution.h
- index 6e902f3..dc8fbc4 100644
- --- a/xbmc/guilib/Resolution.h
- +++ b/xbmc/guilib/Resolution.h
- @@ -92,12 +92,20 @@ struct RESOLUTION_INFO
- CStdString strMode;
- CStdString strOutput;
- CStdString strId;
- - public:
- - RESOLUTION_INFO()
- +public:
- + RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const CStdString &mode = "")
- + {
- + iWidth = width;
- + iHeight = height;
- + fPixelRatio = aspect ? ((float)width)/height / aspect : 1.0f;
- + strMode = mode;
- + bFullScreen = true;
- + fRefreshRate = 0;
- + dwFlags = iSubtitles = iScreen = 0;
- + }
- + float DisplayRatio() const
- {
- - bFullScreen = false;
- - iScreen = iWidth = iHeight = iSubtitles = dwFlags = 0;
- - fPixelRatio = fRefreshRate = 0.f;
- + return iWidth * fPixelRatio / iHeight;
- }
- RESOLUTION_INFO(const RESOLUTION_INFO& res)
- {
- diff --git a/xbmc/interfaces/python/xbmcmodule/GUIPythonWindowXML.cpp b/xbmc/interfaces/python/xbmcmodule/GUIPythonWindowXML.cpp
- index f932810..33ee405 100644
- --- a/xbmc/interfaces/python/xbmcmodule/GUIPythonWindowXML.cpp
- +++ b/xbmc/interfaces/python/xbmcmodule/GUIPythonWindowXML.cpp
- @@ -51,7 +51,6 @@ CGUIPythonWindowXML::CGUIPythonWindowXML(int id, CStdString strXML, CStdString s
- m_threadState = NULL;
- m_actionEvent = CreateEvent(NULL, true, false, NULL);
- m_loadOnDemand = false;
- - m_coordsRes = RES_PAL_4x3;
- m_scriptPath = strFallBackPath;
- }
- diff --git a/xbmc/interfaces/python/xbmcmodule/window.cpp b/xbmc/interfaces/python/xbmcmodule/window.cpp
- index 12e35e6..b7cd80c 100644
- --- a/xbmc/interfaces/python/xbmcmodule/window.cpp
- +++ b/xbmc/interfaces/python/xbmcmodule/window.cpp
- @@ -30,6 +30,7 @@
- #include "guilib/GUICheckMarkControl.h"
- #include "guilib/GUIRadioButtonControl.h"
- #include "guilib/GUIWindowManager.h"
- +#include "settings/Settings.h"
- #include "Application.h"
- #include "threads/SingleLock.h"
- @@ -853,7 +854,7 @@ namespace PYXBMC
- }
- CSingleLock lock(g_graphicsContext);
- - self->pWindow->SetCoordsRes((RESOLUTION)res);
- + self->pWindow->SetCoordsRes(g_settings.m_ResInfo[res]);
- Py_INCREF(Py_None);
- return Py_None;
- diff --git a/xbmc/interfaces/python/xbmcmodule/winxml.cpp b/xbmc/interfaces/python/xbmcmodule/winxml.cpp
- index 34c0f56..c64ab94 100644
- --- a/xbmc/interfaces/python/xbmcmodule/winxml.cpp
- +++ b/xbmc/interfaces/python/xbmcmodule/winxml.cpp
- @@ -75,7 +75,7 @@ namespace PYXBMC
- if (pyRes) PyXBMCGetUnicodeString(resolution, pyRes);
- // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
- - RESOLUTION res = RES_INVALID;
- + RESOLUTION_INFO res;
- CStdString strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
- if (!XFILE::CFile::Exists(strSkinPath))
- @@ -90,7 +90,8 @@ namespace PYXBMC
- // Finally fallback to the DefaultSkin as it didn't exist in either the XBMC Skin folder or the fallback skin folder
- CStdString str("none");
- AddonProps props(str, ADDON_SKIN, "", "");
- - CSkinInfo skinInfo(props, CSkinInfo::TranslateResolution(resolution, RES_HDTV_720p));
- + CSkinInfo::TranslateResolution(resolution, res);
- + CSkinInfo skinInfo(props, res);
- basePath = URIUtils::AddFileToFolder(fallbackPath, strDefault);
- skinInfo.Start(basePath);
- diff --git a/xbmc/interfaces/python/xbmcmodule/winxmldialog.cpp b/xbmc/interfaces/python/xbmcmodule/winxmldialog.cpp
- index 79fb3d3..4c13a85 100644
- --- a/xbmc/interfaces/python/xbmcmodule/winxmldialog.cpp
- +++ b/xbmc/interfaces/python/xbmcmodule/winxmldialog.cpp
- @@ -76,7 +76,7 @@ namespace PYXBMC
- if (pyRes) PyXBMCGetUnicodeString(resolution, pyRes);
- // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
- - RESOLUTION res = RES_INVALID;
- + RESOLUTION_INFO res;
- CStdString strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
- if (!XFILE::CFile::Exists(strSkinPath))
- @@ -91,7 +91,8 @@ namespace PYXBMC
- // Finally fallback to the DefaultSkin as it didn't exist in either the XBMC Skin folder or the fallback skin folder
- CStdString str("none");
- AddonProps props(str, ADDON_SKIN, "", "");
- - CSkinInfo skinInfo(props, CSkinInfo::TranslateResolution(resolution, RES_HDTV_720p));
- + CSkinInfo::TranslateResolution(resolution, res);
- + CSkinInfo skinInfo(props, res);
- CStdString basePath = URIUtils::AddFileToFolder(fallbackPath, strDefault);
- skinInfo.Start(basePath);
- diff --git a/xbmc/music/karaoke/karaokelyricstext.cpp b/xbmc/music/karaoke/karaokelyricstext.cpp
- index bd1b419..bd07f2c 100644
- --- a/xbmc/music/karaoke/karaokelyricstext.cpp
- +++ b/xbmc/music/karaoke/karaokelyricstext.cpp
- @@ -315,7 +315,7 @@ void CKaraokeLyricsText::Render()
- // Calculate drawing parameters
- RESOLUTION resolution = g_graphicsContext.GetVideoResolution();
- - g_graphicsContext.SetRenderingResolution(resolution, false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- float maxWidth = (float) g_settings.m_ResInfo[resolution].Overscan.right - g_settings.m_ResInfo[resolution].Overscan.left;
- // We must only fall through for STATE_DRAW_SYLLABLE or STATE_PREAMBLE
- diff --git a/xbmc/utils/Splash.cpp b/xbmc/utils/Splash.cpp
- index 274dac9..572c5af 100644
- --- a/xbmc/utils/Splash.cpp
- +++ b/xbmc/utils/Splash.cpp
- @@ -52,7 +52,8 @@ void CSplash::Show()
- g_graphicsContext.Lock();
- g_graphicsContext.Clear();
- - g_graphicsContext.SetRenderingResolution(RES_HDTV_720p, true);
- + RESOLUTION_INFO res(1280,720,0);
- + g_graphicsContext.SetRenderingResolution(res, true);
- CGUIImage* image = new CGUIImage(0, 0, 0, 0, 1280, 720, m_ImageName);
- image->SetAspectRatio(CAspectRatio::AR_CENTER);
- image->AllocResources();
- diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
- index f143641..ddcd229 100644
- --- a/xbmc/video/windows/GUIWindowFullScreen.cpp
- +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
- @@ -586,8 +586,9 @@ bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
- fontPath += g_guiSettings.GetString("subtitles.font");
- // We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
- - CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, RES_PAL_4x3, true);
- - CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, RES_PAL_4x3, true);
- + RESOLUTION_INFO pal(720, 576, 0);
- + CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true);
- + CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true);
- if (!subFont || !borderFont)
- CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font");
- else
- @@ -880,7 +881,7 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
- subtitleText.Replace("</u", "");
- RESOLUTION res = g_graphicsContext.GetVideoResolution();
- - g_graphicsContext.SetRenderingResolution(res, false);
- + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
- float maxWidth = (float) g_settings.m_ResInfo[res].Overscan.right - g_settings.m_ResInfo[res].Overscan.left;
- m_subsLayout->Update(subtitleText, maxWidth * 0.9f, false, true); // true to force LTR reading order (most Hebrew subs are this format)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement