今天写DirectDraw代码遇到一个怪问题,会的来看看
[code=C/C++][/code]bool Surface::Blt(const Surface &sourceBitmap, RECT destRect, RECT sourceRect, BltPatten *bp)
{
DDBLTFX ddbltfx;
LPDDBLTFX pddbltfx =0;
int flag = 0;
if (bp)
{
ZeroMemory(&ddbltfx, sizeof(ddbltfx));
ddbltfx.dwSize = sizeof(ddbltfx);
switch(bp->oper)
{
case OPER_MIRROR:
{
if (bp->param == MIRROR_X)
{
ddbltfx.dwDDFX = DDBLTFX_MIRRORUPDOWN;
}
if (bp->param == MIRROR_Y)
{
ddbltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;
}
flag = DDBLT_DDFX;
break;
}
}
pddbltfx = &ddbltfx;
}
if (FAILED(m_lpddsBitmap->Blt(&destRect, sourceBitmap.m_lpddsBitmap, &sourceRect, DDBLT_WAIT | flag, pddbltfx)))//此处有问题
{
return false;
}
return true;
}
以上代码运行后图像不翻转,但是如果把注释处的pddbltfx改为&ddbltfx就会翻转了。。这是为什么啊?
[解决办法]
pddbltfx = &ddbltfx;
这句没有被执行?