2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIWindowScreensaverDim.h"
22 #include "guilib/GraphicContext.h"
23 #include "guilib/GUITexture.h"
24 #include "Application.h"
27 CGUIWindowScreensaverDim::CGUIWindowScreensaverDim(void)
28 : CGUIDialog(WINDOW_SCREENSAVER_DIM, "")
30 m_needsScaling = false;
32 m_animations.push_back(CAnimation::CreateFader(0, 100, 0, 1000, ANIM_TYPE_WINDOW_OPEN));
33 m_animations.push_back(CAnimation::CreateFader(100, 0, 0, 1000, ANIM_TYPE_WINDOW_CLOSE));
34 m_renderOrder = INT_MAX;
37 CGUIWindowScreensaverDim::~CGUIWindowScreensaverDim(void)
41 void CGUIWindowScreensaverDim::UpdateVisibility()
43 float level = g_application.GetDimScreenSaverLevel();
53 void CGUIWindowScreensaverDim::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
55 CGUIDialog::Process(currentTime, dirtyregions);
56 m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
59 void CGUIWindowScreensaverDim::Render()
61 // draw a translucent black quad - fading is handled by the window animation
62 color_t color = ((color_t)(m_dimLevel * 2.55f) & 0xff) << 24;
63 color = g_graphicsContext.MergeAlpha(color);
64 CRect rect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
65 CGUITexture::DrawQuad(rect, color);