OverlayManager - /* C Copyright (c) 2007 Muhammad Haggag...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Copyright (c) 2007 Muhammad Haggag C This software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages arising from the use of this software. s Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: t 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. t 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. a 3. This notice may not be removed or altered from any source distribution. */ #include "stdafx.h" #include "OverlayManager.h" #include "Exception.h" #include <boost/format.hpp> # #ifdef DEBUG #define DEBUG_MESSAGE(x) OutputDebugString(x) #else #define DEBUG_MESSAGE(x) #endif # namespace Overlay { Rectangle DefaultRectangle(0, 0, 0, 0); R std::string PixelFormatToString(PixelFormat f) { switch(f) { case PIXEL_FORMAT_32BPP: return "RGB 32bpp"; r case PIXEL_FORMAT_16BPP_R5G6B5: return "RGB 16bpp R5G6B5"; r case PIXEL_FORMAT_16BPP_R5G5B5: return "RGB 16bpp R5G5B5"; r case PIXEL_FORMAT_UYVY: return "UYVY"; r case PIXEL_FORMAT_YUY2: return "YUY2"; r default:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
throw std::out_of_range(__FUNCTION__ ": PixelFormat out of range"); } } OverlayManager::OverlayManager() : width_(0), height_(0), surfacesLost_(false) { /* This is necessary for Vista. DWM expects applications to draw on a surface, not directly to the screen. We have to disable it. */ DisableDesktopWindowManager(); D HRE(DirectDrawCreateEx(0, (void**)&directDraw_, IID_IDirectDraw7, 0)); H ZeroMemory(&caps_, sizeof(caps_)); caps_.dwSize = sizeof(caps_); HRE(directDraw_->GetCaps(&caps_, 0)); } bool OverlayManager::SupportAvailable() const { /* If we've created and shown an overlay surface, don't take it into consideration when checking the number of visible overlays. */ int numVisibleOverlays = overlaySurface_? caps_.dwCurrVisibleOverlays -
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/31/2011 for the course CS 302 taught by Professor J.parker during the Spring '08 term at University of Texas at Austin.

Page1 / 8

OverlayManager - /* C Copyright (c) 2007 Muhammad Haggag...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online