diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-06-09 23:16:06 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-06-09 23:16:06 +0000 |
commit | e2908c943e1df64ac1e87a39cda3c601923b30dd (patch) | |
tree | 37d55ff4db1d9a129c9df7d305c3c4c6bd5ed662 /guilib | |
parent | 906f6fec0746ac46d7888764896a03411c520b3f (diff) |
added: <backgroundcolor> tag to windows, allowing skinners to specify whether the window needs clearing prior to rendering, and if so which colour to use. Defaults to clearing to black. Set to 0 (or 0x00000000) to have no clearing at all (more efficient on slower GPUs such as tegra2) if you don't need it, or any other (info)color you wish.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31008 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r-- | guilib/GUIWindow.cpp | 13 | ||||
-rw-r--r-- | guilib/GUIWindow.h | 7 | ||||
-rw-r--r-- | guilib/GUIWindowManager.cpp | 3 | ||||
-rw-r--r-- | guilib/GraphicContext.cpp | 4 | ||||
-rw-r--r-- | guilib/GraphicContext.h | 2 |
5 files changed, 18 insertions, 11 deletions
diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp index 99c4ade243..f22312bedb 100644 --- a/guilib/GUIWindow.cpp +++ b/guilib/GUIWindow.cpp @@ -65,7 +65,7 @@ CGUIWindow::CGUIWindow(int id, const CStdString &xmlFile) m_animationsEnabled = true; m_manualRunActions = false; m_exclusiveMouseControl = 0; - m_clearBackground = true; + m_clearBackground = 0xff000000; // opaque black -> always clear } CGUIWindow::~CGUIWindow(void) @@ -142,7 +142,7 @@ bool CGUIWindow::Load(TiXmlDocument &xmlDoc) // now load in the skin file SetDefaults(); - + CGUIControlFactory::GetInfoColor(pRootElement, "backgroundcolor", m_clearBackground); CGUIControlFactory::GetMultipleString(pRootElement, "onload", m_loadActions); CGUIControlFactory::GetMultipleString(pRootElement, "onunload", m_unloadActions); CGUIControlFactory::GetHitRect(pRootElement, m_hitRect); @@ -797,6 +797,7 @@ void CGUIWindow::SetDefaults() m_origins.clear(); 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); } @@ -938,3 +939,11 @@ void CGUIWindow::RunUnloadActions() { RunActions(m_unloadActions); } + +void CGUIWindow::ClearBackground() +{ + m_clearBackground.Update(); + color_t color = m_clearBackground; + if (color) + g_graphicsContext.Clear(color); +} diff --git a/guilib/GUIWindow.h b/guilib/GUIWindow.h index ca1b28ac35..27a4541c35 100644 --- a/guilib/GUIWindow.h +++ b/guilib/GUIWindow.h @@ -110,10 +110,9 @@ public: // and does not need to be passed further down the line (to our global action handlers) virtual bool OnAction(const CAction &action); - /*! \brief Whether the background needs clearing prior to rendering the window - \return true if the background needs clearing, false otherwise. + /*! \brief Clear the background (if necessary) prior to rendering the window */ - virtual bool NeedsClearBackground() const { return m_clearBackground; }; + virtual void ClearBackground(); bool OnMove(int fromControl, int moveAction); virtual bool OnMessage(CGUIMessage& message); @@ -257,7 +256,7 @@ protected: bool m_loadOnDemand; // true if the window should be loaded only as needed bool m_isDialog; // true if we have a dialog, false otherwise. bool m_dynamicResourceAlloc; - bool m_clearBackground; // set to false if background does not need to be cleared + CGUIInfoColor m_clearBackground; // colour to clear the window int m_renderOrder; // for render order of dialogs diff --git a/guilib/GUIWindowManager.cpp b/guilib/GUIWindowManager.cpp index 7e82479d1d..ffc7a00786 100644 --- a/guilib/GUIWindowManager.cpp +++ b/guilib/GUIWindowManager.cpp @@ -490,8 +490,7 @@ void CGUIWindowManager::Render() CGUIWindow* pWindow = GetWindow(GetActiveWindow()); if (pWindow) { - if (pWindow->NeedsClearBackground()) - g_graphicsContext.Clear(); + pWindow->ClearBackground(); pWindow->Render(); } diff --git a/guilib/GraphicContext.cpp b/guilib/GraphicContext.cpp index 34badf66b5..241335e69c 100644 --- a/guilib/GraphicContext.cpp +++ b/guilib/GraphicContext.cpp @@ -510,9 +510,9 @@ float CGraphicContext::GetPixelRatio(RESOLUTION iRes) const return 0.0f; } -void CGraphicContext::Clear() +void CGraphicContext::Clear(color_t color) { - g_Windowing.ClearBuffers(0); + g_Windowing.ClearBuffers(color); } void CGraphicContext::CaptureStateBlock() diff --git a/guilib/GraphicContext.h b/guilib/GraphicContext.h index 0fc3faaf41..6b95db2129 100644 --- a/guilib/GraphicContext.h +++ b/guilib/GraphicContext.h @@ -98,7 +98,7 @@ public: float GetPixelRatio(RESOLUTION iRes) const; void CaptureStateBlock(); void ApplyStateBlock(); - void Clear(); + void Clear(color_t color = 0); void GetAllowedResolutions(std::vector<RESOLUTION> &res); // output scaling |