这是我的功能:
void CreateRenderTarget(HWND, ID2D1HwndRenderTarget*);
它是如何工作的:
void D2DRes::CreateRenderTarget(HWND hwnd, ID2D1HwndRenderTarget* pRT)
{
RECT rc;
GetClientRect(hwnd,&rc);
pFactory->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(),
D2D1::HwndRenderTargetProperties(
hwnd,
D2D1::SizeU(
rc.right - rc.left,
rc.bottom - rc.top)),
&pRT);
}
它是这样调用的:
pD2DRes->CreateRenderTarget(map.GetHWnd(),map.GetpRT());
从 CreateRenderTarget() 返回后,map.pRT 为 NULL。怎么会?
编辑:有我的 GetpRT() 函数:
ID2D1HwndRenderTarget* MapEditor::GetpRT()
{
return pRT;
}