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"
27 CGUIWindowTestPattern::CGUIWindowTestPattern(void)
28 : CGUIWindow(WINDOW_TEST_PATTERN, "")
33 m_bounceDirectionX = 0;
34 m_bounceDirectionY = 0;
36 m_needsScaling = false;
39 CGUIWindowTestPattern::~CGUIWindowTestPattern(void)
43 bool CGUIWindowTestPattern::OnAction(const CAction &action)
45 switch (action.GetID())
48 case ACTION_MOVE_LEFT:
49 m_pattern = m_pattern > 0 ? m_pattern - 1 : TEST_PATTERNS_COUNT - 1;
53 case ACTION_MOVE_DOWN:
54 case ACTION_MOVE_RIGHT:
55 m_pattern = (m_pattern + 1) % TEST_PATTERNS_COUNT;
59 return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
62 bool CGUIWindowTestPattern::OnMessage(CGUIMessage& message)
64 switch (message.GetMessage())
66 case GUI_MSG_WINDOW_INIT:
68 m_bounceDirectionX = 1;
69 m_bounceDirectionY = 1;
76 return CGUIWindow::OnMessage(message);
79 void CGUIWindowTestPattern::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
81 if (m_pattern == 0 || m_pattern == 4)
83 CGUIWindow::Process(currentTime, dirtyregions);
84 m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
87 void CGUIWindowTestPattern::Render()
90 const RESOLUTION_INFO info = g_graphicsContext.GetResInfo();
92 int top = info.Overscan.top;
93 int bottom = info.Overscan.bottom;
94 int left = info.Overscan.left;
95 int right = info.Overscan.right;
100 DrawContrastBrightnessPattern(top, left, bottom, right);
104 DrawVerticalLines(top, left, bottom, right);
108 DrawHorizontalLines(top, left, bottom, right);
112 DrawCheckers(top, left, bottom, right);
116 DrawBouncingRectangle(top, left, bottom, right);
122 CGUIWindow::Render();