diff options
author | elupus <elupus@svn> | 2010-02-05 20:38:33 +0000 |
---|---|---|
committer | elupus <elupus@svn> | 2010-02-05 20:38:33 +0000 |
commit | 1bf54d4e57fcc0ebf2146e4ea16e2987eb44f1fb (patch) | |
tree | ea1edba3fdc1f42578ab89c19dbe1e1423e0e095 | |
parent | 7d84fc594a56c08559be424a90288bbe7dadf0c2 (diff) |
changed: remove code rotting application renderer
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@27488 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | project/VS2008Express/XBMC.vcproj | 24 | ||||
-rw-r--r-- | xbmc/Application.cpp | 18 | ||||
-rw-r--r-- | xbmc/Application.h | 2 | ||||
-rw-r--r-- | xbmc/ApplicationRenderer.cpp | 364 | ||||
-rw-r--r-- | xbmc/ApplicationRenderer.h | 66 | ||||
-rw-r--r-- | xbmc/BusyIndicator.h | 32 | ||||
-rw-r--r-- | xbmc/GUIDialogBusy.cpp | 1 | ||||
-rw-r--r-- | xbmc/LastFmManager.cpp | 9 | ||||
-rw-r--r-- | xbmc/Makefile.in | 1 |
9 files changed, 8 insertions, 509 deletions
diff --git a/project/VS2008Express/XBMC.vcproj b/project/VS2008Express/XBMC.vcproj index 46f8bfd658..9e12a97ac4 100644 --- a/project/VS2008Express/XBMC.vcproj +++ b/project/VS2008Express/XBMC.vcproj @@ -915,6 +915,14 @@ RelativePath="..\..\xbmc\cores\dvdplayer\DVDCodecs\Video\DVDVideoPPFFmpeg.h" > </File> + <File + RelativePath="..\..\xbmc\cores\dvdplayer\DVDCodecs\Video\DXVA.cpp" + > + </File> + <File + RelativePath="..\..\xbmc\cores\dvdplayer\DVDCodecs\Video\DXVA.h" + > + </File> <Filter Name="CrystlHD" > @@ -1051,14 +1059,6 @@ > </File> </Filter> - <File - RelativePath="..\..\xbmc\cores\dvdplayer\DVDCodecs\Video\DXVA.cpp" - > - </File> - <File - RelativePath="..\..\xbmc\cores\dvdplayer\DVDCodecs\Video\DXVA.h" - > - </File> </Filter> <Filter Name="Overlay" @@ -2323,14 +2323,6 @@ > </File> <File - RelativePath="..\..\xbmc\ApplicationRenderer.cpp" - > - </File> - <File - RelativePath="..\..\xbmc\ApplicationRenderer.h" - > - </File> - <File RelativePath="..\..\xbmc\CueDocument.cpp" > </File> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 52f6ab2349..e4ed11302b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -71,7 +71,6 @@ #include "utils/TuxBoxUtil.h" #include "utils/SystemInfo.h" #include "utils/TimeUtils.h" -#include "ApplicationRenderer.h" #include "GUILargeTextureManager.h" #include "LastFmManager.h" #include "SmartPlaylist.h" @@ -1628,8 +1627,6 @@ void CApplication::LoadSkin(const CStdString& strSkin) } #endif } - //stop the busy renderer if it's running before we lock the graphiccontext or we could deadlock. - g_ApplicationRenderer.Stop(); // close the music and video overlays (they're re-opened automatically later) CSingleLock lock(g_graphicsContext); @@ -1735,7 +1732,6 @@ void CApplication::LoadSkin(const CStdString& strSkin) // leave the graphics lock lock.Leave(); - g_ApplicationRenderer.Start(); // restore windows if (currentWindow != WINDOW_INVALID) @@ -1759,7 +1755,6 @@ void CApplication::LoadSkin(const CStdString& strSkin) void CApplication::UnloadSkin() { - g_ApplicationRenderer.Stop(); g_audioManager.Enable(false); g_windowManager.DeInitialize(); @@ -1932,12 +1927,6 @@ void CApplication::RenderNoPresent() // DXMERGE: This may have been important? // g_graphicsContext.AcquireCurrentContext(); - g_ApplicationRenderer.Render(); - -} - -void CApplication::DoRender() -{ g_graphicsContext.Lock(); //g_Windowing.BeginRender(); @@ -4256,13 +4245,6 @@ void CApplication::RenderFullScreen() { MEASURE_FUNCTION; - g_ApplicationRenderer.Render(true); -} - -void CApplication::DoRenderFullScreen() -{ - MEASURE_FUNCTION; - if (g_graphicsContext.IsFullScreenVideo()) { // make sure our overlays are closed diff --git a/xbmc/Application.h b/xbmc/Application.h index d676ea78e4..024b0f6971 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -86,7 +86,6 @@ public: virtual bool Initialize(); virtual void FrameMove(); virtual void Render(); - virtual void DoRender(); virtual void RenderNoPresent(); virtual void Preflight(); virtual bool Create(); @@ -145,7 +144,6 @@ public: void DelayedPlayerRestart(); void CheckDelayedPlayerRestart(); void RenderFullScreen(); - void DoRenderFullScreen(); bool NeedRenderFullScreen(); bool IsPlaying() const; bool IsPaused() const; diff --git a/xbmc/ApplicationRenderer.cpp b/xbmc/ApplicationRenderer.cpp deleted file mode 100644 index 84c202b537..0000000000 --- a/xbmc/ApplicationRenderer.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "system.h" -#include "Application.h" -#include "ApplicationRenderer.h" -#include "AdvancedSettings.h" -#include "GUIWindowManager.h" -#include "WindowingFactory.h" -#include "utils/SingleLock.h" -#include "utils/log.h" -#include "utils/TimeUtils.h" - -CApplicationRenderer g_ApplicationRenderer; - -CApplicationRenderer::CApplicationRenderer(void) -{ -} - -CApplicationRenderer::~CApplicationRenderer() -{ - Stop(); -} - -void CApplicationRenderer::OnStartup() -{ - m_time = CTimeUtils::GetTimeMS(); - m_enabled = true; - m_busyShown = false; - m_explicitbusy = 0; - m_busycount = 0; - m_prevbusycount = 0; -#ifdef HAS_DX - m_lpSurface = NULL; -#endif - m_pWindow = NULL; - m_Resolution = g_graphicsContext.GetVideoResolution(); -} - -void CApplicationRenderer::OnExit() -{ - m_busycount = m_prevbusycount = m_explicitbusy = 0; - m_busyShown = false; - if (m_pWindow) m_pWindow->Close(true); - m_pWindow = NULL; -#ifdef HAS_DX - SAFE_RELEASE(m_lpSurface); -#endif -} - -void CApplicationRenderer::Process() -{ -#ifdef HAS_DX - int iWidth = 0; - int iHeight = 0; - int iLeft = 0; - int iTop = 0; - LPDIRECT3DSURFACE9 lpSurfaceBack = NULL; - LPDIRECT3DSURFACE9 lpSurfaceFront = NULL; - while (!m_bStop) - { - if (!m_enabled || g_graphicsContext.IsFullScreenVideo()) - { - Sleep(50); - continue; - } - - if (!m_pWindow || iWidth == 0 || iHeight == 0 || m_Resolution != g_graphicsContext.GetVideoResolution()) - { - m_pWindow = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); - if (m_pWindow) - { - m_pWindow->Initialize();//need to load the window to determine size. - if (m_pWindow->GetID() == WINDOW_INVALID) - { - //busywindow couldn't be loaded so stop this thread. - m_pWindow = NULL; - m_bStop = true; - break; - } - - SAFE_RELEASE(m_lpSurface); - CRect rect = m_pWindow->GetScaledBounds(); - m_pWindow->ClearAll(); //unload - - iLeft = (int)floor(rect.x1); - iTop = (int)floor(rect.y1); - iWidth = (int)ceil(rect.Width()); - iHeight = (int)ceil(rect.Height()); - m_Resolution = g_graphicsContext.GetVideoResolution(); - } - } - - float t0 = (1000.0f/g_graphicsContext.GetFPS()); - float t1 = m_time + t0; //time when we expect a new render - float t2 = (float)CTimeUtils::GetTimeMS(); - if (t1 < t2) //we're late rendering - { - try - { - if (CTimeUtils::GetTimeMS() >= (m_time + g_advancedSettings.m_busyDialogDelay)) - { - CSingleLock lockg (g_graphicsContext); - if (m_prevbusycount != m_busycount) - { - Sleep(1); - continue; - } - if (!m_pWindow || iWidth == 0 || iHeight == 0) - { - Sleep(1000); - continue; - } - if (m_Resolution != g_graphicsContext.GetVideoResolution()) - { - continue; - } - if (m_busycount > 0) m_busycount--; - //no busy indicator if a progress dialog is showing - if ((g_windowManager.HasModalDialog() && (g_windowManager.GetTopMostModalDialogID() != WINDOW_VIDEO_INFO) && (g_windowManager.GetTopMostModalDialogID() != WINDOW_MUSIC_INFO)) || (g_windowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_PROGRESS)) - { - //TODO: render progress dialog here instead of in dialog::Progress - m_time = CTimeUtils::GetTimeMS(); - lockg.Leave(); - Sleep(1); - continue; - } - if (m_lpSurface == NULL) - { - D3DSURFACE_DESC desc; - g_application.RenderNoPresent(); - HRESULT result = g_Windowing.Get3DDevice()->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &lpSurfaceFront); - if (SUCCEEDED(result)) - { - lpSurfaceFront->GetDesc( &desc ); - iLeft = 0; - iTop = 0; - iWidth = desc.Width; - iHeight = desc.Height; - } - else - { - lockg.Leave(); - Sleep(1000); - continue; - } - if (!SUCCEEDED(g_Windowing.Get3DDevice()->CreateOffscreenPlainSurface(iWidth, iHeight, desc.Format, D3DPOOL_DEFAULT, &m_lpSurface, NULL))) - { - SAFE_RELEASE(lpSurfaceFront); - lockg.Leave(); - Sleep(1000); - continue; - } - //copy part underneeth busy dialog - const RECT rc = { iLeft, iTop, iLeft + iWidth, iTop + iHeight }; - const RECT rcDest = { 0, 0, iWidth, iHeight }; - if (!CopySurface(lpSurfaceFront, &rc, m_lpSurface, &rcDest)) - { - SAFE_RELEASE(lpSurfaceFront); - SAFE_RELEASE(m_lpSurface); - lockg.Leave(); - Sleep(1000); - continue; - } - - //copy front buffer to backbuffer(s) to avoid jumping - bool bBufferCopied = true; - for (int i = 0; i < g_Windowing.GetBackbufferCount(); i++) - { - if (!SUCCEEDED(g_Windowing.Get3DDevice()->GetBackBuffer( 0, i, D3DBACKBUFFER_TYPE_MONO, &lpSurfaceBack))) - { - bBufferCopied = false; - break; - } - if (!CopySurface(lpSurfaceFront, NULL, lpSurfaceBack, NULL)) - { - bBufferCopied = false; - break; - } - SAFE_RELEASE(lpSurfaceBack); - } - if (!bBufferCopied) - { - SAFE_RELEASE(lpSurfaceFront); - SAFE_RELEASE(lpSurfaceBack); - SAFE_RELEASE(m_lpSurface); - lockg.Leave(); - Sleep(1000); - continue; - } - SAFE_RELEASE(lpSurfaceFront); - } - if (!SUCCEEDED(g_Windowing.Get3DDevice()->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &lpSurfaceBack))) - { - lockg.Leave(); - Sleep(1000); - continue; - } - g_Windowing.BeginRender(); - //copy dialog background to backbuffer - const RECT rc = { 0, 0, iWidth, iHeight }; - const RECT rcDest = { iLeft, iTop, iLeft + iWidth, iTop + iHeight }; - const D3DRECT rc2 = { iLeft, iTop, iLeft + iWidth, iTop + iHeight }; - g_Windowing.Get3DDevice()->Clear(1, &rc2, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00010001, 1.0f, 0L); - if (!CopySurface(m_lpSurface, &rc, lpSurfaceBack, &rcDest)) - { - SAFE_RELEASE(lpSurfaceBack); - g_Windowing.Get3DDevice()->EndScene(); - lockg.Leave(); - Sleep(1000); - continue; - } - SAFE_RELEASE(lpSurfaceBack); - if (!m_busyShown) - { - m_pWindow->Show(); - m_busyShown = true; - } - m_pWindow->Render(); - - g_Windowing.EndRender(); - //D3DSWAPEFFECT_DISCARD is used so we can't just present the busy rect but can only present the entire screen. - g_Windowing.Get3DDevice()->Present( NULL, NULL, NULL, NULL ); - } - m_busycount++; - m_prevbusycount = m_busycount; - } - catch (...) - { - CLog::Log(LOGERROR, __FUNCTION__" - Exception caught when busy rendering"); - SAFE_RELEASE(lpSurfaceFront); - SAFE_RELEASE(lpSurfaceBack); - SAFE_RELEASE(m_lpSurface); - } - } - Sleep(1); - } -#endif -} - -#ifdef HAS_DX -bool CApplicationRenderer::CopySurface(LPDIRECT3DSURFACE9 pSurfaceSource, const RECT* rcSource, LPDIRECT3DSURFACE9 pSurfaceDest, const RECT* rcDest) -{ - if (m_Resolution == RES_HDTV_1080i) - { - //CopRects doesn't work at all in 1080i, D3DXLoadSurfaceFromSurface does but is ridiculously slow... - return SUCCEEDED(D3DXLoadSurfaceFromSurface(pSurfaceDest, NULL, rcDest, pSurfaceSource, NULL, rcSource, D3DX_FILTER_NONE, 0)); - } - else - { - if (rcDest) - { - const POINT ptDest = { rcDest->left, rcDest->top }; - return SUCCEEDED(g_Windowing.Get3DDevice()->UpdateSurface(pSurfaceSource, rcSource, pSurfaceDest, &ptDest)); - } - else - { - const POINT ptDest = { 0, 0 }; - return SUCCEEDED(g_Windowing.Get3DDevice()->UpdateSurface(pSurfaceSource, rcSource, pSurfaceDest, &ptDest)); - } - } -} -#endif - -void CApplicationRenderer::UpdateBusyCount() -{ - if (m_busycount == 0) - { - m_prevbusycount = 0; - } - else - { - m_busycount--; - m_prevbusycount = m_busycount; - if (m_pWindow && m_busyShown) - { - m_busyShown = false; - m_pWindow->Close(); - } - } -} - -void CApplicationRenderer::Render(bool bFullscreen) -{ - CSingleLock lockg (g_graphicsContext); - Disable(); - UpdateBusyCount(); -#ifdef HAS_DX - SAFE_RELEASE(m_lpSurface); -#endif - if (bFullscreen) - { - g_application.DoRenderFullScreen(); - } - else - { - g_application.DoRender(); - } - m_time = CTimeUtils::GetTimeMS(); - Enable(); -} - -void CApplicationRenderer::Enable() -{ - m_enabled = true; -} - -void CApplicationRenderer::Disable() -{ - m_enabled = false; -} - -bool CApplicationRenderer::Start() -{ -#ifdef HAS_SDL - return false; -#else - if (g_advancedSettings.m_busyDialogDelay <= 0) return false; //delay of 0 is considered disabled. - Create(); - return true; -#endif -} - -void CApplicationRenderer::Stop() -{ - StopThread(); -} - -bool CApplicationRenderer::IsBusy() const -{ - return ((m_explicitbusy > 0) || m_busyShown); -} - -void CApplicationRenderer::SetBusy(bool bBusy) -{ - if (g_advancedSettings.m_busyDialogDelay <= 0) return; //never show it if disabled. - bBusy?m_explicitbusy++:m_explicitbusy--; - if (m_explicitbusy < 0) m_explicitbusy = 0; - if (m_pWindow) - { - if (m_explicitbusy > 0) - m_pWindow->Show(); - else - m_pWindow->Close(); - } -} diff --git a/xbmc/ApplicationRenderer.h b/xbmc/ApplicationRenderer.h deleted file mode 100644 index 625910c798..0000000000 --- a/xbmc/ApplicationRenderer.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "utils/Thread.h" -#include "utils/CriticalSection.h" -#include "GUIDialogBusy.h" - -class CApplicationRenderer : public CThread -{ -public: - CApplicationRenderer(void); - ~CApplicationRenderer(void); - - bool Start(); - void Stop(); - void Render(bool bFullscreen = false); - void Disable(); - void Enable(); - bool IsBusy() const; - void SetBusy(bool bBusy); -private: - virtual void OnStartup(); - virtual void OnExit(); - virtual void Process(); - void UpdateBusyCount(); -#ifdef HAS_DX - bool CopySurface(LPDIRECT3DSURFACE9 pSurfaceSource, const RECT* rcSource, LPDIRECT3DSURFACE9 pSurfaceDest, const RECT* rcDest); -#endif - - unsigned int m_time; - bool m_enabled; - int m_explicitbusy; - int m_busycount; - int m_prevbusycount; - bool m_busyShown; - CCriticalSection m_criticalSection; -#ifdef HAS_DX - LPDIRECT3DSURFACE9 m_lpSurface; -#endif - CGUIDialogBusy* m_pWindow; - RESOLUTION m_Resolution; -}; -extern CApplicationRenderer g_ApplicationRenderer; - - - diff --git a/xbmc/BusyIndicator.h b/xbmc/BusyIndicator.h deleted file mode 100644 index a58b69cbb2..0000000000 --- a/xbmc/BusyIndicator.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "ApplicationRenderer.h" - -class CBusyIndicator -{ -public: - CBusyIndicator(){g_ApplicationRenderer.SetBusy(true);}; - virtual ~CBusyIndicator(){g_ApplicationRenderer.SetBusy(false);}; -}; - diff --git a/xbmc/GUIDialogBusy.cpp b/xbmc/GUIDialogBusy.cpp index 58d1a19097..7a68cd846f 100644 --- a/xbmc/GUIDialogBusy.cpp +++ b/xbmc/GUIDialogBusy.cpp @@ -20,7 +20,6 @@ */ #include "GUIDialogBusy.h" -#include "ApplicationRenderer.h" CGUIDialogBusy::CGUIDialogBusy(void) : CGUIDialog(WINDOW_DIALOG_BUSY, "DialogBusy.xml") diff --git a/xbmc/LastFmManager.cpp b/xbmc/LastFmManager.cpp index ec8548dd68..88e4b50db4 100644 --- a/xbmc/LastFmManager.cpp +++ b/xbmc/LastFmManager.cpp @@ -23,7 +23,6 @@ #include "Album.h" #include "Artist.h" #include "Application.h" -#include "ApplicationRenderer.h" #include "PlayListPlayer.h" #include "Util.h" #include "PlayListFactory.h" @@ -186,10 +185,6 @@ void CLastFmManager::InitProgressDialog(const CStdString& strUrl) dlgProgress->StartModal(); } } - else - { - g_ApplicationRenderer.SetBusy(true); - } } void CLastFmManager::UpdateProgressDialog(const int iStringID) @@ -208,10 +203,6 @@ void CLastFmManager::CloseProgressDialog() dlgProgress->Close(); dlgProgress = NULL; } - else - { - g_ApplicationRenderer.SetBusy(false); - } } bool CLastFmManager::ChangeStation(const CURL& stationUrl) diff --git a/xbmc/Makefile.in b/xbmc/Makefile.in index 8de79b2a87..84e6b5c065 100644 --- a/xbmc/Makefile.in +++ b/xbmc/Makefile.in @@ -176,7 +176,6 @@ SRCS=Application.cpp \ GUIDialogSmartPlaylistEditor.cpp \ GUIDialogSmartPlaylistRule.cpp \ SlideShowPicture.cpp \ - ApplicationRenderer.cpp \ GUIDialogBusy.cpp \ GUIWindowStartup.cpp \ UPnP.cpp \ |