diff options
-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 | ||||
-rw-r--r-- | xbmc/GUIWindowFullScreen.cpp | 2 | ||||
-rw-r--r-- | xbmc/GUIWindowFullScreen.h | 1 |
7 files changed, 20 insertions, 12 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 diff --git a/xbmc/GUIWindowFullScreen.cpp b/xbmc/GUIWindowFullScreen.cpp index 2c17ee7210..cfd4833796 100644 --- a/xbmc/GUIWindowFullScreen.cpp +++ b/xbmc/GUIWindowFullScreen.cpp @@ -469,6 +469,8 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) void CGUIWindowFullScreen::OnWindowLoaded() { CGUIWindow::OnWindowLoaded(); + // override the clear colour - we must never clear fullscreen + m_clearBackground = 0; CGUIProgressControl* pProgress = (CGUIProgressControl*)GetControl(CONTROL_PROGRESS); if(pProgress) diff --git a/xbmc/GUIWindowFullScreen.h b/xbmc/GUIWindowFullScreen.h index ff1c3f60ea..3fd87098c2 100644 --- a/xbmc/GUIWindowFullScreen.h +++ b/xbmc/GUIWindowFullScreen.h @@ -40,7 +40,6 @@ public: virtual void FrameMove(); virtual void Render(); virtual void OnWindowLoaded(); - virtual bool NeedsClearBackground() const { return false; }; // never clear the background in fullscreen void ChangetheTimeCode(int remote); virtual void OnSliderChange(void *data, CGUISliderControl *slider); |