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 "GUIWindowTestPattern.h"
22 #include "settings/DisplaySettings.h"
23 #include "guilib/GUIWindowManager.h"
24 #include "guilib/Key.h"
25 #include "guilib/WindowIDs.h"
26 #include "windowing/WindowingFactory.h"
29 CGUIWindowTestPattern::CGUIWindowTestPattern(void)
30 : CGUIWindow(WINDOW_TEST_PATTERN, "")
37 m_bounceDirectionX = 0;
38 m_bounceDirectionY = 0;
40 m_needsScaling = false;
43 CGUIWindowTestPattern::~CGUIWindowTestPattern(void)
47 bool CGUIWindowTestPattern::OnAction(const CAction &action)
49 switch (action.GetID())
52 case ACTION_MOVE_LEFT:
53 m_pattern = m_pattern > 0 ? m_pattern - 1 : TEST_PATTERNS_COUNT - 1;
57 case ACTION_MOVE_DOWN:
58 case ACTION_MOVE_RIGHT:
59 m_pattern = (m_pattern + 1) % TEST_PATTERNS_COUNT;
63 return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
66 bool CGUIWindowTestPattern::OnMessage(CGUIMessage& message)
68 switch (message.GetMessage())
70 case GUI_MSG_WINDOW_INIT:
72 m_bounceDirectionX = 1;
73 m_bounceDirectionY = 1;
80 return CGUIWindow::OnMessage(message);
83 void CGUIWindowTestPattern::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
85 if (m_pattern == 0 || m_pattern == 4)
87 CGUIWindow::Process(currentTime, dirtyregions);
88 m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
91 if(g_Windowing.UseLimitedColor())
93 m_white = 235.0f / 255;
94 m_black = 16.0f / 255;
103 void CGUIWindowTestPattern::Render()
106 const RESOLUTION_INFO info = g_graphicsContext.GetResInfo();
108 int top = info.Overscan.top;
109 int bottom = info.Overscan.bottom;
110 int left = info.Overscan.left;
111 int right = info.Overscan.right;
116 DrawContrastBrightnessPattern(top, left, bottom, right);
120 DrawVerticalLines(top, left, bottom, right);
124 DrawHorizontalLines(top, left, bottom, right);
128 DrawCheckers(top, left, bottom, right);
132 DrawBouncingRectangle(top, left, bottom, right);
138 CGUIWindow::Render();