所以我在模拟器上工作,并且一直试图绘制一个GDI窗口。基本上我有这个代码:
switch(uMsg)
{
case WM_SIZE:
break;
case WM_PAINT:
{
PAINTSTRUCT Ps;
HDC const PaintDC = BeginPaint(hwnd, &Ps);
RECT ClientRect;
GetClientRect(hwnd, &ClientRect);
int const WindowWidth = ClientRect.right - ClientRect.left;
int const WindowHeight = ClientRect.bottom - ClientRect.top;
StretchDIBits(PaintDC,
0, 0,
WindowWidth,
WindowHeight,
0, 0,
DecodedScreenMemory.Info.bmiHeader.biWidth,
DecodedScreenMemory.Info.bmiHeader.biHeight,
DecodedScreenMemory.Memory,
&DecodedScreenMemory.Info,
DIB_RGB_COLORS,
SRCCOPY);
EndPaint(hwnd, &Ps);
break;
}
case WM_CLOSE:
{
Running = false;
Result = 0;
break;
}
default:
{
Result = DefWindowProc(hwnd,
uMsg,
wParam,
lParam);
}
}
在程序的另一个地方,我有一段代码,目前,用白色填充8像素宽的边框,其余部分为黑色。所以,根据我的理解,我有窗口缓冲区,然后我用适当的参数调用StretchDIBits,然后在每个帧我调用UpdateWindow它应该在屏幕上渲染缓冲区。为什么它会变成黑色?