Skip to content

Commit

Permalink
added configurable display limit clamping settings through advancedse…
Browse files Browse the repository at this point in the history
…ttings.xml
  • Loading branch information
warhog committed Nov 25, 2012
1 parent ae04d99 commit 08c9c67
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
28 changes: 28 additions & 0 deletions xbmc/settings/AdvancedSettings.cpp
Expand Up @@ -287,6 +287,12 @@ void CAdvancedSettings::Initialize()
#endif

m_bgInfoLoaderMaxThreads = 5;

#if defined(TARGET_RASPBERRY_PI)
m_clampGUILimitWidth = 1280;
m_clampGUILimitHeight = 720;
#endif


m_iPVRTimeCorrection = 0;
m_iPVRInfoToggleInterval = 3000;
Expand Down Expand Up @@ -970,6 +976,28 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)

XMLUtils::GetInt(pRootElement, "bginfoloadermaxthreads", m_bgInfoLoaderMaxThreads);
m_bgInfoLoaderMaxThreads = std::max(1, m_bgInfoLoaderMaxThreads);

#if defined(TARGET_RASPBERRY_PI)
if (!XMLUtils::GetInt(pRootElement, "clampguilimitwidth", m_clampGUILimitWidth))
m_clampGUILimitWidth = 1280;

if (m_clampGUILimitWidth < 320)
// clamp to vhs resolution
m_clampGUILimitWidth = 320;
else if (m_clampGUILimitWidth > 3840)
// clamp to 4k (uhd) resolution
m_clampGUILimitWidth = 3840;

if (!XMLUtils::GetInt(pRootElement, "clampguilimitheight", m_clampGUILimitHeight))
m_clampGUILimitHeight = 720;

if (m_clampGUILimitHeight < 240)
// clamp to vhs resolution
m_clampGUILimitHeight = 240;
else if (m_clampGUILimitHeight > 2160)
// clamp to 4k (uhd) resolution
m_clampGUILimitHeight = 2160;
#endif

TiXmlElement *pPVR = pRootElement->FirstChildElement("pvr");
if (pPVR)
Expand Down
6 changes: 6 additions & 0 deletions xbmc/settings/AdvancedSettings.h
Expand Up @@ -326,6 +326,12 @@ class CAdvancedSettings
CStdString m_cpuTempCmd;
CStdString m_gpuTempCmd;
int m_bgInfoLoaderMaxThreads;

#if defined(TARGET_RASPBERRY_PI)
/* display resolution clamping for windowing */
int m_clampGUILimitWidth;
int m_clampGUILimitHeight;
#endif

/* PVR/TV related advanced settings */
int m_iPVRTimeCorrection; /*!< @brief correct all times (epg tags, timer tags, recording tags) by this amount of minutes. defaults to 0. */
Expand Down
4 changes: 3 additions & 1 deletion xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
Expand Up @@ -24,6 +24,7 @@
#include "utils/log.h"
#include "guilib/gui3d.h"
#include "linux/DllBCM.h"
#include "settings/AdvancedSettings.h"

#ifndef __VIDEOCORE4__
#define __VIDEOCORE4__
Expand Down Expand Up @@ -554,7 +555,8 @@ void CEGLNativeTypeRaspberryPI::CallbackTvServiceCallback(void *userdata, uint32

bool CEGLNativeTypeRaspberryPI::ClampToGUIDisplayLimits(int &width, int &height)
{
const int max_width = 1280, max_height = 720;
int max_width = g_advancedSettings.m_clampGUILimitWidth;
int max_height = g_advancedSettings.m_clampGUILimitHeight;
float ar = (float)width/(float)height;
// bigger than maximum, so need to clamp
if (width > max_width || height > max_height) {
Expand Down

0 comments on commit 08c9c67

Please sign in to comment.