File diff r18159:2c94e9268b2c → r18160:133e96e28508
src/video/win32_v.cpp
Show inline comments
 
@@ -146,13 +146,13 @@ static uint MapWindowsKey(uint sym)
 
	if (GetAsyncKeyState(VK_SHIFT)   < 0) key |= WKC_SHIFT;
 
	if (GetAsyncKeyState(VK_CONTROL) < 0) key |= WKC_CTRL;
 
	if (GetAsyncKeyState(VK_MENU)    < 0) key |= WKC_ALT;
 
	return key;
 
}
 

	
 
static bool AllocateDibSection(int w, int h);
 
static bool AllocateDibSection(int w, int h, bool force = false);
 

	
 
static void ClientSizeChanged(int w, int h)
 
{
 
	/* allocate new dib section of the new size */
 
	if (AllocateDibSection(w, h)) {
 
		/* mark all palette colors dirty */
 
@@ -687,24 +687,24 @@ static void RegisterWndClass()
 

	
 
		registered = true;
 
		if (!RegisterClass(&wnd)) usererror("RegisterClass failed");
 
	}
 
}
 

	
 
static bool AllocateDibSection(int w, int h)
 
static bool AllocateDibSection(int w, int h, bool force)
 
{
 
	BITMAPINFO *bi;
 
	HDC dc;
 
	int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
 

	
 
	w = max(w, 64);
 
	h = max(h, 64);
 

	
 
	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 

	
 
	if (w == _screen.width && h == _screen.height) return false;
 
	if (!force && w == _screen.width && h == _screen.height) return false;
 

	
 
	_screen.width = w;
 
	_screen.pitch = (bpp == 8) ? Align(w, 4) : w;
 
	_screen.height = h;
 
	bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
 
	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
 
@@ -924,6 +924,11 @@ bool VideoDriver_Win32::ChangeResolution
 
}
 

	
 
bool VideoDriver_Win32::ToggleFullscreen(bool full_screen)
 
{
 
	return this->MakeWindow(full_screen);
 
}
 

	
 
bool VideoDriver_Win32::AfterBlitterChange()
 
{
 
	return AllocateDibSection(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen);
 
}