/* * 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 "WinSystem.h" #include "GraphicContext.h" #include "Settings.h" CWinSystemBase::CWinSystemBase() { m_nWidth = 0; m_nHeight = 0; m_nTop = 0; m_nLeft = 0; m_bWindowCreated = false; m_bFullScreen = false; m_nScreen = 0; m_bBlankOtherDisplay = false; } CWinSystemBase::~CWinSystemBase() { } bool CWinSystemBase::InitWindowSystem() { UpdateResolutions(); return true; } void CWinSystemBase::UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen, int width, int height, float refreshRate) { newRes.Overscan.left = 0; newRes.Overscan.top = 0; newRes.Overscan.right = width; newRes.Overscan.bottom = height; newRes.iScreen = screen; newRes.bFullScreen = true; newRes.iSubtitles = (int)(0.965 * height); newRes.fRefreshRate = refreshRate; newRes.fPixelRatio = 1.0f; newRes.iWidth = width; newRes.iHeight = height; newRes.strMode.Format("%dx%d", width, height); if (refreshRate > 1) newRes.strMode.Format("%s @ %.2f - Full Screen", newRes.strMode, refreshRate); if (screen > 0) newRes.strMode.Format("%s #%d", newRes.strMode, screen + 1); } void CWinSystemBase::UpdateResolutions() { // add the window res - defaults are fine. RESOLUTION_INFO& window = g_settings.m_ResInfo[RES_WINDOW]; if (window.iWidth == 0) window.iWidth = 720; if (window.iHeight == 0) window.iHeight = 480; if (window.iSubtitles == 0) window.iSubtitles = (int)(0.965 * window.iHeight); window.fPixelRatio = 1.0f; window.strMode = "Windowed"; } void CWinSystemBase::SetWindowResolution(int width, int height) { RESOLUTION_INFO& window = g_settings.m_ResInfo[RES_WINDOW]; window.iWidth = width; window.iHeight = height; window.iSubtitles = (int)(0.965 * window.iHeight); g_graphicsContext.ResetOverscan(window); }