| 394 | } |
| 395 | |
| 396 | void SplashScreen::SetLayeredWindowBitmap(HWND hwnd, const uint8_t* bgraPremul, UINT w, UINT h) |
| 397 | { |
| 398 | HDC screenDC = GetDC(nullptr); |
| 399 | HDC memDC = CreateCompatibleDC(screenDC); |
| 400 | |
| 401 | BITMAPINFO bmi = {}; |
| 402 | bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
| 403 | bmi.bmiHeader.biWidth = (LONG)w; |
| 404 | bmi.bmiHeader.biHeight = -(LONG)h; // top-down |
| 405 | bmi.bmiHeader.biPlanes = 1; |
| 406 | bmi.bmiHeader.biBitCount = 32; |
| 407 | bmi.bmiHeader.biCompression = BI_RGB; |
| 408 | |
| 409 | void* dibBits = nullptr; |
| 410 | HBITMAP dib = CreateDIBSection(screenDC, &bmi, DIB_RGB_COLORS, &dibBits, nullptr, 0); |
| 411 | memcpy(dibBits, bgraPremul, (size_t)w * (size_t)h * 4); |
| 412 | |
| 413 | HGDIOBJ oldObj = SelectObject(memDC, dib); |
| 414 | |
| 415 | int x = 0; |
| 416 | int y = 0; |
| 417 | CenterOnPrimaryMonitorPx(w, h, x, y); |
| 418 | |
| 419 | POINT ptDst = { x, y }; |
| 420 | SIZE szDst = { (LONG)w, (LONG)h }; |
| 421 | POINT ptSrc = { 0, 0 }; |
| 422 | |
| 423 | BLENDFUNCTION bf = {}; |
| 424 | bf.BlendOp = AC_SRC_OVER; |
| 425 | bf.SourceConstantAlpha = 255; |
| 426 | bf.AlphaFormat = AC_SRC_ALPHA; |
| 427 | |
| 428 | UpdateLayeredWindow(hwnd, screenDC, &ptDst, &szDst, memDC, &ptSrc, 0, &bf, ULW_ALPHA); |
| 429 | |
| 430 | SelectObject(memDC, oldObj); |
| 431 | DeleteObject(dib); |
| 432 | DeleteDC(memDC); |
| 433 | ReleaseDC(nullptr, screenDC); |
| 434 | } |
nothing calls this directly
no outgoing calls
no test coverage detected