Skip to content
Browse files

move dim/black screensaver to the windowmanager

  • Loading branch information...
1 parent 37d7849 commit d77b13a86d1fed9e9993c23af3f9ad2274c9f96f Jonathan Marshall committed
View
6 XBMC-ATV2.xcodeproj/project.pbxproj
@@ -19,6 +19,7 @@
7C0A7FC813A9E75400AFC2BD /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FC413A9E75400AFC2BD /* DirtyRegionSolvers.cpp */; };
7C0A7FC913A9E75400AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FC613A9E75400AFC2BD /* DirtyRegionTracker.cpp */; };
7C0A7FCC13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FCA13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp */; };
+ 7C89627013B702F3003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */; };
7C99B73F133D372300FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B73D133D372300FC2B16 /* CacheCircular.cpp */; };
7C99B7AA134072CD00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */; };
C807119F135DB842002F601B /* InputOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C807119D135DB842002F601B /* InputOperations.cpp */; };
@@ -942,6 +943,8 @@
7C0A7FC713A9E75400AFC2BD /* DirtyRegionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegionTracker.h; sourceTree = "<group>"; };
7C0A7FCA13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowDebugInfo.cpp; sourceTree = "<group>"; };
7C0A7FCB13A9E76E00AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; };
+ 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
+ 7C89626F13B702F3003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.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>"; };
@@ -5219,6 +5222,8 @@
F56C77C2131EC154000AD0F6 /* GUIWindowPointer.h */,
F56C77C3131EC154000AD0F6 /* GUIWindowScreensaver.cpp */,
F56C77C4131EC154000AD0F6 /* GUIWindowScreensaver.h */,
+ 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */,
+ 7C89626F13B702F3003631FE /* GUIWindowScreensaverDim.h */,
F56C77C5131EC154000AD0F6 /* GUIWindowStartup.cpp */,
F56C77C6131EC154000AD0F6 /* GUIWindowStartup.h */,
F56C77C7131EC154000AD0F6 /* GUIWindowSystemInfo.cpp */,
@@ -6688,6 +6693,7 @@
DF0DF16C13A3AF82008ED511 /* FileNFS.cpp in Sources */,
DF0DF16D13A3AF82008ED511 /* NFSDirectory.cpp in Sources */,
F558F66F13AFE81500631E12 /* ThreadLocal.cpp in Sources */,
+ 7C89627013B702F3003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
6 XBMC-IOS.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
7C0A7F9D13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7F9B13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp */; };
7C0A7FB213A9E72E00AFC2BD /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FAE13A9E72E00AFC2BD /* DirtyRegionSolvers.cpp */; };
7C0A7FB313A9E72E00AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FB013A9E72E00AFC2BD /* DirtyRegionTracker.cpp */; };
+ 7C89628013B7031E003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */; };
7C99B6E9133D36E200FC2B16 /* CacheCircular.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B6E7133D36E200FC2B16 /* CacheCircular.cpp */; };
7C99B7BE1340730000FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */; };
C80711AD135DB85F002F601B /* InputOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C80711AB135DB85F002F601B /* InputOperations.cpp */; };
@@ -943,6 +944,8 @@
7C0A7FAF13A9E72E00AFC2BD /* DirtyRegionSolvers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegionSolvers.h; sourceTree = "<group>"; };
7C0A7FB013A9E72E00AFC2BD /* DirtyRegionTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirtyRegionTracker.cpp; sourceTree = "<group>"; };
7C0A7FB113A9E72E00AFC2BD /* DirtyRegionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegionTracker.h; sourceTree = "<group>"; };
+ 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
+ 7C89627F13B7031E003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.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>"; };
@@ -5587,6 +5590,8 @@
F56C87AF131F42EC000AD0F6 /* GUIWindowPointer.h */,
F56C87B0131F42EC000AD0F6 /* GUIWindowScreensaver.cpp */,
F56C87B1131F42EC000AD0F6 /* GUIWindowScreensaver.h */,
+ 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */,
+ 7C89627F13B7031E003631FE /* GUIWindowScreensaverDim.h */,
F56C87B2131F42EC000AD0F6 /* GUIWindowStartup.cpp */,
F56C87B3131F42EC000AD0F6 /* GUIWindowStartup.h */,
F56C87B4131F42EC000AD0F6 /* GUIWindowSystemInfo.cpp */,
@@ -6703,6 +6708,7 @@
DF0DF17F13A3AF9F008ED511 /* FileNFS.cpp in Sources */,
DF0DF18013A3AF9F008ED511 /* NFSDirectory.cpp in Sources */,
F558F61113AFDC3000631E12 /* ThreadLocal.cpp in Sources */,
+ 7C89628013B7031E003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
8 XBMC.xcodeproj/project.pbxproj
@@ -534,6 +534,8 @@
7C7B2B311134F36400713D6D /* mysqldataset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7B2B2E1134F36400713D6D /* mysqldataset.cpp */; };
7C84A59E12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */; };
7C84A59F12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */; };
+ 7C89619213B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */; };
+ 7C89619313B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */; };
7C8A14561154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; };
7C8A14571154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; };
7C8A187C115B2A8200E5FCFA /* TextureDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */; };
@@ -2413,6 +2415,8 @@
7C7B2B2F1134F36400713D6D /* mysqldataset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysqldataset.h; sourceTree = "<group>"; };
7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourcesDirectory.cpp; path = xbmc/filesystem/SourcesDirectory.cpp; sourceTree = SOURCE_ROOT; };
7C84A59D12FA3C1600CD1714 /* SourcesDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourcesDirectory.h; path = xbmc/filesystem/SourcesDirectory.h; sourceTree = SOURCE_ROOT; };
+ 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
+ 7C89619113B6A16F003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; };
7C8A14541154CB2600E5FCFA /* TextureCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureCache.cpp; sourceTree = "<group>"; };
7C8A14551154CB2600E5FCFA /* TextureCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureCache.h; sourceTree = "<group>"; };
7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureDatabase.cpp; sourceTree = "<group>"; };
@@ -4675,6 +4679,8 @@
E38E18220D25F9FA00618676 /* GUIWindowPointer.h */,
E38E18250D25F9FA00618676 /* GUIWindowScreensaver.cpp */,
E38E18260D25F9FA00618676 /* GUIWindowScreensaver.h */,
+ 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */,
+ 7C89619113B6A16F003631FE /* GUIWindowScreensaverDim.h */,
E38E18370D25F9FA00618676 /* GUIWindowStartup.cpp */,
E38E18380D25F9FA00618676 /* GUIWindowStartup.h */,
E38E18390D25F9FA00618676 /* GUIWindowSystemInfo.cpp */,
@@ -8033,6 +8039,7 @@
DF0DF15B13A3ADA7008ED511 /* FileNFS.cpp in Sources */,
DF0DF15C13A3ADA7008ED511 /* NFSDirectory.cpp in Sources */,
F558F51E13AF03AD00631E12 /* ThreadLocal.cpp in Sources */,
+ 7C89619213B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8923,6 +8930,7 @@
F558F3D013AE663300631E12 /* FileNFS.cpp in Sources */,
F558F3D113AE663A00631E12 /* NFSDirectory.cpp in Sources */,
F558F51F13AF03AD00631E12 /* ThreadLocal.cpp in Sources */,
+ 7C89619313B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
4 project/VS2010Express/XBMC.vcxproj
@@ -1151,6 +1151,7 @@
<ClCompile Include="..\..\xbmc\windows\GUIWindowLoginScreen.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowPointer.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowScreensaver.cpp" />
+ <ClCompile Include="..\..\xbmc\windows\GUIWindowScreensaverDim.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowStartup.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowSystemInfo.cpp" />
<ClCompile Include="..\..\xbmc\windows\GUIWindowWeather.cpp" />
@@ -1991,6 +1992,7 @@
<ClInclude Include="..\..\xbmc\windows\GUIWindowLoginScreen.h" />
<ClInclude Include="..\..\xbmc\windows\GUIWindowPointer.h" />
<ClInclude Include="..\..\xbmc\windows\GUIWindowScreensaver.h" />
+ <ClInclude Include="..\..\xbmc\windows\GUIWindowScreensaverDim.h" />
<ClInclude Include="..\..\xbmc\windows\GUIWindowStartup.h" />
<ClInclude Include="..\..\xbmc\windows\GUIWindowSystemInfo.h" />
<ClInclude Include="..\..\xbmc\windows\GUIWindowWeather.h" />
@@ -2053,4 +2055,4 @@
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\$(ProjectFileName).targets.user" Condition="Exists('$(SolutionDir)\$(ProjectFileName).targets.user')" />
-</Project>
+</Project>
View
8 project/VS2010Express/XBMC.vcxproj.filters
@@ -2222,6 +2222,9 @@
<ClCompile Include="..\..\xbmc\windows\GUIWindowScreensaver.cpp">
<Filter>windows</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\windows\GUIWindowScreensaverDim.cpp">
+ <Filter>windows</Filter>
+ </ClCompile>
<ClCompile Include="..\..\xbmc\windows\GUIWindowStartup.cpp">
<Filter>windows</Filter>
</ClCompile>
@@ -4684,6 +4687,9 @@
<ClInclude Include="..\..\xbmc\windows\GUIWindowScreensaver.h">
<Filter>windows</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\windows\GUIWindowScreensaverDim.h">
+ <Filter>windows</Filter>
+ </ClInclude>
<ClInclude Include="..\..\xbmc\windows\GUIWindowStartup.h">
<Filter>windows</Filter>
</ClInclude>
@@ -4956,4 +4962,4 @@
<Filter>win32</Filter>
</CustomBuild>
</ItemGroup>
-</Project>
+</Project>
View
61 xbmc/Application.cpp
@@ -174,6 +174,7 @@
#include "windows/GUIWindowPointer.h"
#include "windows/GUIWindowSystemInfo.h"
#include "windows/GUIWindowScreensaver.h"
+#include "windows/GUIWindowScreensaverDim.h"
#include "pictures/GUIWindowSlideShow.h"
#include "windows/GUIWindowStartup.h"
#include "video/windows/GUIWindowFullScreen.h"
@@ -1054,6 +1055,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 CGUIWindowScreensaverDim); // window id = 97
g_windowManager.Add(new CGUIWindowDebugInfo); // window id = 98
g_windowManager.Add(new CGUIWindowPointer); // window id = 99
g_windowManager.Add(new CGUIDialogYesNo); // window id = 100
@@ -1855,60 +1857,21 @@ bool CApplication::RenderNoPresent()
}
}
- // reset image scaling and effect states
- g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
-
- RenderScreenSaver();
-
g_graphicsContext.Unlock();
return hasRendered;
}
-static int screenSaverFadeAmount = 0;
-
-void CApplication::RenderScreenSaver()
+float CApplication::GetDimScreenSaverLevel() const
{
- if (!m_screenSaver)
- return;
-
- if (m_screenSaver->ID() != "screensaver.xbmc.builtin.dim" &&
- m_screenSaver->ID() != "screensaver.xbmc.builtin.black" &&
- m_screenSaver->ID() != "screensaver.xbmc.builtin.slideshow")
- return; // nothing to do
+ if (!m_bScreenSave || !m_screenSaver ||
+ (m_screenSaver->ID() != "screensaver.xbmc.builtin.dim" &&
+ m_screenSaver->ID() != "screensaver.xbmc.builtin.black"))
+ return 0;
- float amount = 1.0f;
if (!m_screenSaver->GetSetting("level").IsEmpty())
- amount = 1.0f - 0.01f * (float)atof(m_screenSaver->GetSetting("level"));
-
- // special case for dim screensaver
- bool draw = false;
- if (amount > 0.f)
- {
- if (m_bScreenSave)
- {
- draw = true;
- if (screenSaverFadeAmount < 100)
- {
- screenSaverFadeAmount = std::min(100, screenSaverFadeAmount + 2); // around a second to fade
- }
- }
- else
- {
- if (screenSaverFadeAmount > 0)
- {
- draw = true;
- screenSaverFadeAmount = std::max(0, screenSaverFadeAmount - 4); // around a half second to unfade
- }
- }
- }
- if (draw)
- {
- color_t color = ((color_t)(screenSaverFadeAmount * amount * 2.55f) & 0xff) << 24;
- CRect rect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
- g_windowManager.MarkDirty();
- CGUITexture::DrawQuad(rect, color);
- }
+ return 100.0f - (float)atof(m_screenSaver->GetSetting("level"));
+ return 100.0f;
}
bool CApplication::WaitFrame(unsigned int timeout)
@@ -1983,10 +1946,8 @@ void CApplication::Render()
unsigned int singleFrameTime = 10; // default limit 100 fps
{
- // Less fps in DPMS or Black screensaver
- bool lowfps = (m_dpmsIsActive
- || (m_bScreenSave && m_screenSaver && (m_screenSaver->ID() == "screensaver.xbmc.builtin.black")
- && (screenSaverFadeAmount >= 100)));
+ // Less fps in DPMS
+ bool lowfps = m_dpmsIsActive;
// Whether externalplayer is playing and we're unfocused
bool extPlayerActive = m_eCurrentPlayer >= EPC_EXTPLAYER && IsPlaying() && !m_AppFocused;
View
3 xbmc/Application.h
@@ -288,8 +288,9 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
void Minimize();
bool ToggleDPMS(bool manual);
+
+ float GetDimScreenSaverLevel() const;
protected:
- void RenderScreenSaver();
bool LoadSkin(const CStdString& skinID);
void LoadSkin(const boost::shared_ptr<ADDON::CSkinInfo>& skin);
View
2 xbmc/windows/GUIWindowDebugInfo.cpp
@@ -40,7 +40,7 @@ CGUIWindowDebugInfo::CGUIWindowDebugInfo(void)
m_loadOnDemand = false;
m_needsScaling = false;
m_layout = NULL;
- m_renderOrder = INT_MAX - 1;
+ m_renderOrder = INT_MAX - 2;
}
CGUIWindowDebugInfo::~CGUIWindowDebugInfo(void)
View
4 xbmc/windows/GUIWindowPointer.cpp
@@ -31,7 +31,7 @@ CGUIWindowPointer::CGUIWindowPointer(void)
m_loadOnDemand = false;
m_needsScaling = false;
m_active = false;
- m_renderOrder = INT_MAX;
+ m_renderOrder = INT_MAX - 1;
}
CGUIWindowPointer::~CGUIWindowPointer(void)
@@ -72,7 +72,7 @@ void CGUIWindowPointer::OnWindowLoaded()
CGUIWindow::OnWindowLoaded();
DynamicResourceAlloc(false);
m_pointer = 0;
- m_renderOrder = INT_MAX;
+ m_renderOrder = INT_MAX - 1;
}
void CGUIWindowPointer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
View
72 xbmc/windows/GUIWindowScreensaverDim.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2005-2011 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 "GUIWindowScreensaverDim.h"
+#include "guilib/GraphicContext.h"
+#include "guilib/GUITexture.h"
+#include "Application.h"
+#include <climits>
+
+CGUIWindowScreensaverDim::CGUIWindowScreensaverDim(void)
+ : CGUIDialog(97, "")
+{
+ m_loadOnDemand = false;
+ m_needsScaling = false;
+ m_dimLevel = 100.0f;
+ m_animations.push_back(CAnimation::CreateFader(0, 100, 0, 1000, ANIM_TYPE_WINDOW_OPEN));
+ m_animations.push_back(CAnimation::CreateFader(100, 0, 0, 1000, ANIM_TYPE_WINDOW_CLOSE));
+ m_renderOrder = INT_MAX;
+}
+
+CGUIWindowScreensaverDim::~CGUIWindowScreensaverDim(void)
+{
+}
+
+void CGUIWindowScreensaverDim::UpdateVisibility()
+{
+ float level = g_application.GetDimScreenSaverLevel();
+ if (level)
+ {
+ m_dimLevel = level;
+ Show();
+ }
+ else
+ Close();
+}
+
+void CGUIWindowScreensaverDim::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
+{
+ CGUIDialog::Process(currentTime, dirtyregions);
+ m_renderRegion.SetRect(0, 0, g_graphicsContext.GetWidth(), g_graphicsContext.GetHeight());
+}
+
+void CGUIWindowScreensaverDim::Render()
+{
+ g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
+ g_graphicsContext.SetTransform(m_cachedTransform);
+ // draw a translucent black quad - fading is handled by the window animation
+ color_t color = ((color_t)(m_dimLevel * 2.55f) & 0xff) << 24;
+ color = g_graphicsContext.MergeAlpha(color);
+ CRect rect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
+ CGUITexture::DrawQuad(rect, color);
+ g_graphicsContext.RemoveTransform();
+ CGUIDialog::Render();
+}
View
38 xbmc/windows/GUIWindowScreensaverDim.h
@@ -0,0 +1,38 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2011 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"
+
+class CGUIWindowScreensaverDim :
+ public CGUIDialog
+{
+public:
+ CGUIWindowScreensaverDim();
+ virtual ~CGUIWindowScreensaverDim();
+ virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
+ virtual void Render();
+protected:
+ virtual void UpdateVisibility();
+private:
+ float m_dimLevel;
+};
View
1 xbmc/windows/Makefile
@@ -5,6 +5,7 @@ SRCS=GUIMediaWindow.cpp \
GUIWindowLoginScreen.cpp \
GUIWindowPointer.cpp \
GUIWindowScreensaver.cpp \
+ GUIWindowScreensaverDim.cpp \
GUIWindowStartup.cpp \
GUIWindowSystemInfo.cpp \
GUIWindowWeather.cpp \

0 comments on commit d77b13a

Please sign in to comment.
Something went wrong with that request. Please try again.