MCPcopy Create free account
hub / github.com/bwapi/bwapi / InitializeWModeBitmap

Function InitializeWModeBitmap

bwapi/BWAPI/Source/WMode.cpp:38–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36BITMAPINFO256 wmodebmp;
37HBITMAP hwmodeBmp;
38void InitializeWModeBitmap(int width, int height)
39{
40 if ( hdcMem )
41 DeleteDC(hdcMem);
42 hdcMem = NULL;
43
44 // Create Bitmap HDC
45 MemZero(wmodebmp);
46 wmodebmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
47 wmodebmp.bmiHeader.biWidth = width;
48 wmodebmp.bmiHeader.biHeight = -(height);
49 wmodebmp.bmiHeader.biPlanes = 1;
50 wmodebmp.bmiHeader.biBitCount = 8;
51 wmodebmp.bmiHeader.biCompression = BI_RGB;
52 wmodebmp.bmiHeader.biSizeImage = width * height;
53#ifndef SHADOW_BROODWAR
54 if ( isCorrectVersion )
55 {
56 for ( int i = 0; i < 256; ++i )
57 {
58 wmodebmp.bmiColors[i].rgbRed = BW::BWDATA::GamePalette[i].peRed;
59 wmodebmp.bmiColors[i].rgbGreen = BW::BWDATA::GamePalette[i].peGreen;
60 wmodebmp.bmiColors[i].rgbBlue = BW::BWDATA::GamePalette[i].peBlue;
61 }
62 }
63#endif
64 HDC hdc = GetDC(ghMainWnd);
65 hwmodeBmp = CreateDIBSection(hdc, (BITMAPINFO*)&wmodebmp, DIB_RGB_COLORS, &pBits, NULL, 0);
66 hdcMem = CreateCompatibleDC(hdc);
67 ReleaseDC(ghMainWnd, hdc);
68 SelectObject(hdcMem, hwmodeBmp);
69}
70
71void GetBorderRect(HWND hWnd, LPRECT lpRect)
72{

Callers 1

SetWModeFunction · 0.85

Calls 1

MemZeroFunction · 0.50

Tested by

no test coverage detected