| 381 | } |
| 382 | |
| 383 | void Win32Window::PresentBitmap(int width, int height, const uint32_t* pixels) |
| 384 | { |
| 385 | BITMAPV5HEADER header = {}; |
| 386 | header.bV5Size = sizeof(BITMAPV5HEADER); |
| 387 | header.bV5Width = width; |
| 388 | header.bV5Height = -height; |
| 389 | header.bV5Planes = 1; |
| 390 | header.bV5BitCount = 32; |
| 391 | header.bV5Compression = BI_BITFIELDS; |
| 392 | header.bV5AlphaMask = 0xff000000; |
| 393 | header.bV5RedMask = 0x00ff0000; |
| 394 | header.bV5GreenMask = 0x0000ff00; |
| 395 | header.bV5BlueMask = 0x000000ff; |
| 396 | header.bV5SizeImage = width * height * sizeof(uint32_t); |
| 397 | header.bV5CSType = LCS_sRGB; |
| 398 | |
| 399 | HDC dc = PaintDC; |
| 400 | if (dc != 0) |
| 401 | { |
| 402 | int result = SetDIBitsToDevice(dc, 0, 0, width, height, 0, 0, 0, height, pixels, (const BITMAPINFO*)&header, BI_RGB); |
| 403 | ReleaseDC(WindowHandle, dc); |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam) |
| 408 | { |