1 // SwiftShader Software Renderer
\r
3 // Copyright(c) 2005-2012 TransGaming Inc.
\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,
\r
6 // transcribed, stored in a retrieval system, translated into any human or computer
\r
7 // language by any means, or disclosed to third parties without the explicit written
\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
\r
9 // or implied, including but not limited to any patent rights, are granted to you.
\r
12 #include "FrameBufferWin.hpp"
\r
16 FrameBufferWin::FrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin) : FrameBuffer(width, height, fullscreen, topLeftOrigin), windowHandle(windowHandle)
\r
20 // Force fullscreen window style (no borders)
\r
21 originalWindowStyle = GetWindowLong(windowHandle, GWL_STYLE);
\r
22 SetWindowLong(windowHandle, GWL_STYLE, WS_POPUP);
\r
26 FrameBufferWin::~FrameBufferWin()
\r
28 if(!windowed && GetWindowLong(windowHandle, GWL_STYLE) == WS_POPUP)
\r
30 SetWindowLong(windowHandle, GWL_STYLE, originalWindowStyle);
\r
34 void FrameBufferWin::updateBounds(HWND windowOverride)
\r
36 HWND window = windowOverride ? windowOverride : windowHandle;
\r
40 GetClientRect(window, &bounds);
\r
41 ClientToScreen(window, (POINT*)&bounds);
\r
42 ClientToScreen(window, (POINT*)&bounds + 1);
\r
46 SetRect(&bounds, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
\r
51 #include "FrameBufferDD.hpp"
\r
52 #include "FrameBufferGDI.hpp"
\r
53 #include "Common/Configurator.hpp"
\r
57 sw::FrameBufferWin *createFrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin)
\r
59 sw::Configurator ini("SwiftShader.ini");
\r
60 int api = ini.getInteger("Testing", "FrameBufferAPI", 0);
\r
62 if(api == 0 && topLeftOrigin)
\r
64 return new sw::FrameBufferDD(windowHandle, width, height, fullscreen, topLeftOrigin);
\r
68 return new sw::FrameBufferGDI(windowHandle, width, height, fullscreen, topLeftOrigin);
\r
74 sw::FrameBuffer *createFrameBuffer(HDC display, HWND window, int width, int height)
\r
76 return createFrameBufferWin(window, width, height, false, false);
\r