diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2011-06-11 19:26:03 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@never.you.mind> | 2011-06-16 16:08:27 +1200 |
commit | 42109b546d91827aa879f253f37cf0ba954d41f8 (patch) | |
tree | f79d2ad1262aff065d6bc48cbe52ee6b22a80614 | |
parent | d277c52e6b9d44ccc6169d92df28cd6080074d2c (diff) |
move debug info rendering to the windowmanager
-rw-r--r-- | XBMC-ATV2.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | XBMC-IOS.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 2 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 8 | ||||
-rw-r--r-- | xbmc/Application.cpp | 99 | ||||
-rw-r--r-- | xbmc/Application.h | 10 | ||||
-rw-r--r-- | xbmc/windows/GUIWindowDebugInfo.cpp | 162 | ||||
-rw-r--r-- | xbmc/windows/GUIWindowDebugInfo.h | 47 | ||||
-rw-r--r-- | xbmc/windows/Makefile | 1 |
10 files changed, 241 insertions, 108 deletions
diff --git a/XBMC-ATV2.xcodeproj/project.pbxproj b/XBMC-ATV2.xcodeproj/project.pbxproj index ac1c9c4cba..ce31e8e252 100644 --- a/XBMC-ATV2.xcodeproj/project.pbxproj +++ b/XBMC-ATV2.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 1840B797139968DB007C848B /* JSONVariantWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1840B794139968DB007C848B /* JSONVariantWriter.cpp */; }; 18ACF8E313597B0000B67371 /* RecentlyAddedJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18ACF8E113597B0000B67371 /* RecentlyAddedJob.cpp */; }; 4D5D2E131301753F006ABC13 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D5D2E121301753F006ABC13 /* CFNetwork.framework */; }; + 7C0A7D4013A3539700AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7D3E13A3539700AFC2BD /* GUIWindowDebugInfo.cpp */; }; 7C99B73F133D372300FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B73D133D372300FC2B16 /* CacheCircular.cpp */; }; 7C99B7AA134072CD00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */; }; 7CBC8954139385470046CB82 /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBC8950139385470046CB82 /* DirtyRegionSolvers.cpp */; }; @@ -930,6 +931,8 @@ 18ACF8E113597B0000B67371 /* RecentlyAddedJob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecentlyAddedJob.cpp; sourceTree = "<group>"; }; 18ACF8E213597B0000B67371 /* RecentlyAddedJob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentlyAddedJob.h; sourceTree = "<group>"; }; 4D5D2E121301753F006ABC13 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + 7C0A7D3E13A3539700AFC2BD /* GUIWindowDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowDebugInfo.cpp; sourceTree = "<group>"; }; + 7C0A7D3F13A3539700AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; }; 7C99B73D133D372300FC2B16 /* CacheCircular.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheCircular.cpp; sourceTree = "<group>"; }; 7C99B73E133D372300FC2B16 /* CacheCircular.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheCircular.h; sourceTree = "<group>"; }; 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; }; @@ -5216,6 +5219,8 @@ children = ( F56C77B9131EC154000AD0F6 /* GUIMediaWindow.cpp */, F56C77BA131EC154000AD0F6 /* GUIMediaWindow.h */, + 7C0A7D3E13A3539700AFC2BD /* GUIWindowDebugInfo.cpp */, + 7C0A7D3F13A3539700AFC2BD /* GUIWindowDebugInfo.h */, F56C77BB131EC154000AD0F6 /* GUIWindowFileManager.cpp */, F56C77BC131EC154000AD0F6 /* GUIWindowFileManager.h */, F56C77BD131EC154000AD0F6 /* GUIWindowHome.cpp */, @@ -6696,6 +6701,7 @@ 1840B797139968DB007C848B /* JSONVariantWriter.cpp in Sources */, 7CBC8954139385470046CB82 /* DirtyRegionSolvers.cpp in Sources */, 7CBC8955139385470046CB82 /* DirtyRegionTracker.cpp in Sources */, + 7C0A7D4013A3539700AFC2BD /* GUIWindowDebugInfo.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/XBMC-IOS.xcodeproj/project.pbxproj b/XBMC-IOS.xcodeproj/project.pbxproj index 5f78af5d7d..5b1dfd50a9 100644 --- a/XBMC-IOS.xcodeproj/project.pbxproj +++ b/XBMC-IOS.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 18ACF8FD13597B5700B67371 /* RecentlyAddedJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18ACF8FB13597B5700B67371 /* RecentlyAddedJob.cpp */; }; 3255316612B2D02400837CD2 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3255316512B2D02400837CD2 /* CoreAudio.framework */; }; 4D5D2E1E1301758F006ABC13 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D5D2E1D1301758F006ABC13 /* CFNetwork.framework */; }; + 7C0A7D2E13A3537800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7D2C13A3537800AFC2BD /* GUIWindowDebugInfo.cpp */; }; 7C99B6E9133D36E200FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */; }; 7C99B7BE1340730000FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */; }; 7CBC896A139385740046CB82 /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBC8966139385740046CB82 /* DirtyRegionSolvers.cpp */; }; @@ -931,6 +932,8 @@ 18ACF8FC13597B5700B67371 /* RecentlyAddedJob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentlyAddedJob.h; sourceTree = "<group>"; }; 3255316512B2D02400837CD2 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 4D5D2E1D1301758F006ABC13 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + 7C0A7D2C13A3537800AFC2BD /* GUIWindowDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowDebugInfo.cpp; sourceTree = "<group>"; }; + 7C0A7D2D13A3537800AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; }; 7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheCircular.cpp; sourceTree = "<group>"; }; 7C99B6E8133D36E200FC2B16 /* CacheCircular.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheCircular.h; sourceTree = "<group>"; }; 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; }; @@ -5586,6 +5589,8 @@ children = ( F56C87A6131F42EC000AD0F6 /* GUIMediaWindow.cpp */, F56C87A7131F42EC000AD0F6 /* GUIMediaWindow.h */, + 7C0A7D2C13A3537800AFC2BD /* GUIWindowDebugInfo.cpp */, + 7C0A7D2D13A3537800AFC2BD /* GUIWindowDebugInfo.h */, F56C87A8131F42EC000AD0F6 /* GUIWindowFileManager.cpp */, F56C87A9131F42EC000AD0F6 /* GUIWindowFileManager.h */, F56C87AA131F42EC000AD0F6 /* GUIWindowHome.cpp */, @@ -6713,6 +6718,7 @@ 1840B77B1399616D007C848B /* JSONVariantWriter.cpp in Sources */, 7CBC896A139385740046CB82 /* DirtyRegionSolvers.cpp in Sources */, 7CBC896B139385740046CB82 /* DirtyRegionTracker.cpp in Sources */, + 7C0A7D2E13A3537800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index f727cc47bf..8dd915e005 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -500,6 +500,8 @@ 43EA4297136C1D9E002C82A5 /* RenderCapture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56579AD13060D1E0085ED7F /* RenderCapture.cpp */; }; 43EA429B136C1E2F002C82A5 /* xbmcvfsmodule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 189047D11301DEAB00C11012 /* xbmcvfsmodule.cpp */; }; 43EA42B0136C2274002C82A5 /* InputOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C807114B135DB5CC002F601B /* InputOperations.cpp */; }; + 7C0A7CB613A3365E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7CB413A3365E00AFC2BD /* GUIWindowDebugInfo.cpp */; }; + 7C0A7CB713A3365E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7CB413A3365E00AFC2BD /* GUIWindowDebugInfo.cpp */; }; 7C2D6AE40F35453E00DD2E85 /* SpecialProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2D6AE20F35453E00DD2E85 /* SpecialProtocol.cpp */; }; 7C45DBE910F325C400D4BBF3 /* DAVDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C45DBE710F325C400D4BBF3 /* DAVDirectory.cpp */; }; 7C45DBEA10F325C400D4BBF3 /* DAVDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C45DBE710F325C400D4BBF3 /* DAVDirectory.cpp */; }; @@ -2370,6 +2372,8 @@ 6E97BDC10DA2B620003A2A89 /* EventServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventServer.h; sourceTree = "<group>"; }; 6E97BDC30DA2B620003A2A89 /* Fanart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fanart.h; sourceTree = "<group>"; }; 6E97BDC40DA2B620003A2A89 /* Socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Socket.h; sourceTree = "<group>"; }; + 7C0A7CB413A3365E00AFC2BD /* GUIWindowDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowDebugInfo.cpp; sourceTree = "<group>"; }; + 7C0A7CB513A3365E00AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; }; 7C2D6AE20F35453E00DD2E85 /* SpecialProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocol.cpp; sourceTree = "<group>"; }; 7C2D6AE30F35453E00DD2E85 /* SpecialProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocol.h; sourceTree = "<group>"; }; 7C45DBE710F325C400D4BBF3 /* DAVDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DAVDirectory.cpp; sourceTree = "<group>"; }; @@ -4661,6 +4665,8 @@ children = ( E38E17F00D25F9FA00618676 /* GUIMediaWindow.cpp */, E38E17F10D25F9FA00618676 /* GUIMediaWindow.h */, + 7C0A7CB413A3365E00AFC2BD /* GUIWindowDebugInfo.cpp */, + 7C0A7CB513A3365E00AFC2BD /* GUIWindowDebugInfo.h */, E38E18030D25F9FA00618676 /* GUIWindowFileManager.cpp */, E38E18040D25F9FA00618676 /* GUIWindowFileManager.h */, E38E18090D25F9FA00618676 /* GUIWindowHome.cpp */, @@ -8028,6 +8034,7 @@ 1840B75313993DA0007C848B /* JSONVariantWriter.cpp in Sources */, 7CBC891A139382050046CB82 /* DirtyRegionSolvers.cpp in Sources */, 7CBC891B139382050046CB82 /* DirtyRegionTracker.cpp in Sources */, + 7C0A7CB613A3365E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8917,6 +8924,7 @@ 1840B75413993DA0007C848B /* JSONVariantWriter.cpp in Sources */, 7CBC891C139382050046CB82 /* DirtyRegionSolvers.cpp in Sources */, 7CBC891D139382050046CB82 /* DirtyRegionTracker.cpp in Sources */, + 7C0A7CB713A3365E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 91c61c8854..b6aed2656d 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -1145,6 +1145,7 @@ <ClCompile Include="..\..\xbmc\windowing\WinEventsSDL.cpp" /> <ClCompile Include="..\..\xbmc\windowing\WinSystem.cpp" /> <ClCompile Include="..\..\xbmc\windows\GUIMediaWindow.cpp" /> + <ClCompile Include="..\..\xbmc\windows\GUIWindowDebugInfo.cpp" /> <ClCompile Include="..\..\xbmc\windows\GUIWindowFileManager.cpp" /> <ClCompile Include="..\..\xbmc\windows\GUIWindowHome.cpp" /> <ClCompile Include="..\..\xbmc\windows\GUIWindowLoginScreen.cpp" /> @@ -1980,6 +1981,7 @@ <ClInclude Include="..\..\xbmc\windowing\WinSystem.h" /> <ClInclude Include="..\..\xbmc\windowing\XBMC_events.h" /> <ClInclude Include="..\..\xbmc\windows\GUIMediaWindow.h" /> + <ClInclude Include="..\..\xbmc\windows\GUIWindowDebugInfo.h" /> <ClInclude Include="..\..\xbmc\windows\GUIWindowFileManager.h" /> <ClInclude Include="..\..\xbmc\windows\GUIWindowHome.h" /> <ClInclude Include="..\..\xbmc\windows\GUIWindowLoginScreen.h" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 54a7285658..25a749e9f8 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -2216,6 +2216,9 @@ <ClCompile Include="..\..\xbmc\windows\GUIMediaWindow.cpp"> <Filter>windows</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\windows\GUIWindowDebugInfo.cpp"> + <Filter>windows</Filter> + </ClCompile> <ClCompile Include="..\..\xbmc\windows\GUIWindowFileManager.cpp"> <Filter>windows</Filter> </ClCompile> @@ -4673,6 +4676,9 @@ <ClInclude Include="..\..\xbmc\windows\GUIMediaWindow.h"> <Filter>windows</Filter> </ClInclude> + <ClInclude Include="..\..\xbmc\windows\GUIWindowDebugInfo.h"> + <Filter>windows</Filter> + </ClInclude> <ClInclude Include="..\..\xbmc\windows\GUIWindowFileManager.h"> <Filter>windows</Filter> </ClInclude> @@ -4945,4 +4951,4 @@ <Filter>win32</Filter> </CustomBuild> </ItemGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 2607a55cc2..d96ea6a0f8 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -167,6 +167,7 @@ #include "windows/GUIWindowLoginScreen.h" #include "addons/GUIWindowAddonBrowser.h" #include "music/windows/GUIWindowVisualisation.h" +#include "windows/GUIWindowDebugInfo.h" #include "windows/GUIWindowPointer.h" #include "windows/GUIWindowSystemInfo.h" #include "windows/GUIWindowScreensaver.h" @@ -338,7 +339,6 @@ CApplication::CApplication(void) : m_itemCurrentFile(new CFileItem), m_progressT m_bStandalone = false; m_bEnableLegacyRes = false; m_bSystemScreenSaverEnable = false; - m_debugLayout = NULL; } CApplication::~CApplication(void) @@ -1051,6 +1051,7 @@ bool CApplication::Initialize() g_windowManager.Add(new CGUIWindowLoginScreen); // window id = 29 g_windowManager.Add(new CGUIWindowSettingsProfile); // window id = 34 g_windowManager.Add(new CGUIWindowAddonBrowser); // window id = 40 + g_windowManager.Add(new CGUIWindowDebugInfo); // window id = 98 g_windowManager.Add(new CGUIWindowPointer); // window id = 99 g_windowManager.Add(new CGUIDialogYesNo); // window id = 100 g_windowManager.Add(new CGUIDialogProgress); // window id = 101 @@ -1703,9 +1704,6 @@ void CApplication::UnloadSkin(bool forReload /* = false */) m_guiDialogMuteBug.ResetControlStates(); m_guiDialogMuteBug.FreeResources(true); - delete m_debugLayout; - m_debugLayout = NULL; - // remove the skin-dependent window g_windowManager.Delete(WINDOW_DIALOG_FULLSCREEN_INFO); @@ -1857,7 +1855,6 @@ void CApplication::RenderNoPresent() // reset image scaling and effect states g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); - RenderMemoryStatus(); RenderScreenSaver(); g_graphicsContext.Unlock(); @@ -2109,98 +2106,6 @@ void CApplication::SetStandAlone(bool value) g_advancedSettings.m_handleMounting = m_bStandalone = value; } -void CApplication::RenderMemoryStatus() -{ - MEASURE_FUNCTION; - - g_cpuInfo.getUsedPercentage(); // must call it to recalculate pct values - - // reset the window scaling and fade status - RESOLUTION res = g_graphicsContext.GetVideoResolution(); - g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); - - static int yShift = 20; - static int xShift = 40; - static unsigned int lastShift = time(NULL); - time_t now = time(NULL); - if (now - lastShift > 10) - { - yShift *= -1; - if (now % 5 == 0) - xShift *= -1; - lastShift = now; - } - - if (!m_debugLayout) - { - CGUIFont *font13 = g_fontManager.GetDefaultFont(); - CGUIFont *font13border = g_fontManager.GetDefaultFont(true); - if (font13) - m_debugLayout = new CGUITextLayout(font13, true, 0, font13border); - } - if (!m_debugLayout) - return; - - if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel) - { - CStdString info; - MEMORYSTATUS stat; - GlobalMemoryStatus(&stat); - CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : ""; - CStdString strCores = g_cpuInfo.GetCoresUsageString(); -#if !defined(_LINUX) - info.Format("LOG: %sxbmc.log\nMEM: %d/%d KB - FPS: %2.1f fps\nCPU: %s%s", g_settings.m_logFolder.c_str(), - stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str()); -#else - double dCPU = m_resourceCounter.GetCPUUsage(); - info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_settings.m_logFolder.c_str(), - stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str()); -#endif - - - float x = xShift + 0.04f * g_graphicsContext.GetWidth() + g_settings.m_ResInfo[res].Overscan.left; - float y = yShift + 0.04f * g_graphicsContext.GetHeight() + g_settings.m_ResInfo[res].Overscan.top; - - m_debugLayout->Update(info); - m_debugLayout->RenderOutline(x, y, 0xffffffff, 0xff000000, 0, 0); - } - - // render the skin debug info - if (g_SkinInfo->IsDebugging()) - { - CStdString info; - CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow()); - CPoint point(m_guiPointer.GetXPosition(), m_guiPointer.GetYPosition()); - if (window) - { - CStdString windowName = CButtonTranslator::TranslateWindow(window->GetID()); - if (!windowName.IsEmpty()) - windowName += " (" + window->GetProperty("xmlfile") + ")"; - else - windowName = window->GetProperty("xmlfile"); - info = "Window: " + windowName + " "; - // transform the mouse coordinates to this window's coordinates - g_graphicsContext.SetScalingResolution(window->GetCoordsRes(), true); - point.x *= g_graphicsContext.GetGUIScaleX(); - point.y *= g_graphicsContext.GetGUIScaleY(); - g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); - } - info.AppendFormat("Mouse: (%d,%d) ", (int)point.x, (int)point.y); - if (window) - { - CGUIControl *control = window->GetFocusedControl(); - if (control) - info.AppendFormat("Focused: %i (%s)", control->GetID(), CGUIControlFactory::TranslateControlType(control->GetControlType()).c_str()); - } - - float x = xShift + 0.04f * g_graphicsContext.GetWidth() + g_settings.m_ResInfo[res].Overscan.left; - float y = yShift + 0.08f * g_graphicsContext.GetHeight() + g_settings.m_ResInfo[res].Overscan.top; - - m_debugLayout->Update(info); - m_debugLayout->RenderOutline(x, y, 0xffffffff, 0xff000000, 0, 0); - } -} - // OnKey() translates the key into a CAction which is sent on to our Window Manager. // The window manager will return true if the event is processed, false otherwise. // If not already processed, this routine handles global keypresses. It returns diff --git a/xbmc/Application.h b/xbmc/Application.h index 65db7b45b8..785d744c97 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -58,9 +58,6 @@ namespace ADDON #ifdef HAS_PERFORMANCE_SAMPLE #include "utils/PerformanceStats.h" #endif -#ifdef _LINUX -#include "linux/LinuxResourceCounter.h" -#endif #include "windowing/XBMC_events.h" #include "threads/Thread.h" @@ -74,7 +71,6 @@ class CKaraokeLyricsManager; class CApplicationMessenger; class DPMSSupport; class CSplash; -class CGUITextLayout; class CBackgroundPlayer : public CThread { @@ -158,7 +154,6 @@ public: bool OnKey(const CKey& key); bool OnAppCommand(const CAction &action); bool OnAction(const CAction &action); - void RenderMemoryStatus(); void CheckShutdown(); // Checks whether the screensaver and / or DPMS should become active. void CheckScreenSaverAndDPMS(); @@ -351,8 +346,6 @@ protected: bool m_bTestMode; bool m_bSystemScreenSaverEnable; - CGUITextLayout *m_debugLayout; - #if defined(HAS_SDL) || defined(HAS_XBMC_MUTEX) int m_frameCount; SDL_mutex* m_frameMutex; @@ -393,9 +386,6 @@ protected: #ifdef HAS_PERFORMANCE_SAMPLE CPerformanceStats m_perfStats; #endif -#ifdef _LINUX - CLinuxResourceCounter m_resourceCounter; -#endif #ifdef HAS_EVENT_SERVER std::map<std::string, std::map<int, float> > m_lastAxisMap; diff --git a/xbmc/windows/GUIWindowDebugInfo.cpp b/xbmc/windows/GUIWindowDebugInfo.cpp new file mode 100644 index 0000000000..ecdee49ea9 --- /dev/null +++ b/xbmc/windows/GUIWindowDebugInfo.cpp @@ -0,0 +1,162 @@ +/* + * 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 "GUIWindowDebugInfo.h" +#include "input/MouseStat.h" +#include "settings/AdvancedSettings.h" +#include "settings/Settings.h" +#include "addons/Skin.h" +#include "utils/CPUInfo.h" +#include "utils/log.h" +#include "input/ButtonTranslator.h" +#include "guilib/GUIControlFactory.h" +#include "guilib/GUIFontManager.h" +#include "guilib/GUITextLayout.h" +#include "guilib/GUIWindowManager.h" +#include "guilib/GUIControlProfiler.h" +#include "GUIInfoManager.h" + +CGUIWindowDebugInfo::CGUIWindowDebugInfo(void) + : CGUIDialog(98, "") +{ + m_loadOnDemand = false; + m_needsScaling = false; + m_layout = NULL; + m_renderOrder = INT_MAX - 1; +} + +CGUIWindowDebugInfo::~CGUIWindowDebugInfo(void) +{ +} + +void CGUIWindowDebugInfo::UpdateVisibility() +{ + if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel || g_SkinInfo->IsDebugging()) + Show(); + else + Close(); +} + +bool CGUIWindowDebugInfo::OnMessage(CGUIMessage &message) +{ + if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT) + { + delete m_layout; + m_layout = NULL; + } + return CGUIDialog::OnMessage(message); +} + +void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) +{ + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); + + g_cpuInfo.getUsedPercentage(); // must call it to recalculate pct values + + static int yShift = 20; + static int xShift = 40; + static unsigned int lastShift = time(NULL); + time_t now = time(NULL); + if (now - lastShift > 10) + { + yShift *= -1; + if (now % 5 == 0) + xShift *= -1; + lastShift = now; + MarkDirtyRegion(); + } + + if (!m_layout) + { + CGUIFont *font13 = g_fontManager.GetDefaultFont(); + CGUIFont *font13border = g_fontManager.GetDefaultFont(true); + if (font13) + m_layout = new CGUITextLayout(font13, true, 0, font13border); + } + if (!m_layout) + return; + + CStdString info; + if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel) + { + MEMORYSTATUS stat; + GlobalMemoryStatus(&stat); + CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : ""; + CStdString strCores = g_cpuInfo.GetCoresUsageString(); +#if !defined(_LINUX) + info.Format("LOG: %sxbmc.log\nMEM: %d/%d KB - FPS: %2.1f fps\nCPU: %s%s", g_settings.m_logFolder.c_str(), + stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str()); +#else + double dCPU = m_resourceCounter.GetCPUUsage(); + info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_settings.m_logFolder.c_str(), + stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str()); +#endif + } + + // render the skin debug info + if (g_SkinInfo->IsDebugging()) + { + if (!info.IsEmpty()) + info += "\n"; + CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow()); + CGUIWindow *pointer = g_windowManager.GetWindow(WINDOW_DIALOG_POINTER); + CPoint point; + if (pointer) + point = CPoint(pointer->GetXPosition(), pointer->GetYPosition()); + if (window) + { + CStdString windowName = CButtonTranslator::TranslateWindow(window->GetID()); + if (!windowName.IsEmpty()) + windowName += " (" + window->GetProperty("xmlfile") + ")"; + else + windowName = window->GetProperty("xmlfile"); + info += "Window: " + windowName + " "; + // transform the mouse coordinates to this window's coordinates + g_graphicsContext.SetScalingResolution(window->GetCoordsRes(), true); + point.x *= g_graphicsContext.GetGUIScaleX(); + point.y *= g_graphicsContext.GetGUIScaleY(); + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); + } + info.AppendFormat("Mouse: (%d,%d) ", (int)point.x, (int)point.y); + if (window) + { + CGUIControl *control = window->GetFocusedControl(); + if (control) + info.AppendFormat("Focused: %i (%s)", control->GetID(), CGUIControlFactory::TranslateControlType(control->GetControlType()).c_str()); + } + } + + float w, h; + if (m_layout->Update(info)) + MarkDirtyRegion(); + m_layout->GetTextExtent(w, h); + + float x = xShift + 0.04f * g_graphicsContext.GetWidth(); + float y = yShift + 0.04f * g_graphicsContext.GetHeight(); + m_renderRegion.SetRect(x, y, x+w, y+h); +} + +void CGUIWindowDebugInfo::Render() +{ + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false); + if (m_layout) + m_layout->RenderOutline(m_renderRegion.x1, m_renderRegion.y1, 0xffffffff, 0xff000000, 0, 0); +} diff --git a/xbmc/windows/GUIWindowDebugInfo.h b/xbmc/windows/GUIWindowDebugInfo.h new file mode 100644 index 0000000000..bbcbd91252 --- /dev/null +++ b/xbmc/windows/GUIWindowDebugInfo.h @@ -0,0 +1,47 @@ +#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 "guilib/GUIDialog.h" +#ifdef _LINUX +#include "linux/LinuxResourceCounter.h" +#endif + +class CGUITextLayout; + +class CGUIWindowDebugInfo : + public CGUIDialog +{ +public: + CGUIWindowDebugInfo(); + virtual ~CGUIWindowDebugInfo(); + virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions); + virtual void Render(); + virtual bool OnMessage(CGUIMessage &message); +protected: + virtual void UpdateVisibility(); +private: + CGUITextLayout *m_layout; +#ifdef _LINUX + CLinuxResourceCounter m_resourceCounter; +#endif +}; diff --git a/xbmc/windows/Makefile b/xbmc/windows/Makefile index bc529c0e85..6d750c3771 100644 --- a/xbmc/windows/Makefile +++ b/xbmc/windows/Makefile @@ -1,4 +1,5 @@ SRCS=GUIMediaWindow.cpp \ + GUIWindowDebugInfo.cpp \ GUIWindowFileManager.cpp \ GUIWindowHome.cpp \ GUIWindowLoginScreen.cpp \ |