IDirect3DDevice9的StretchRect与IDirect3DSurface9问题

cutxyz 2011-12-20 12:42:39
Uint CDX9Graphic::DrawString(const STRING* pStrText,Float fx,Float fy,Float fWidth,Float fHight)
{
Uint nResult = 0;

if(pStrText)
{
IDirect3DSurface9* pTopLevelSurface;
nResult = m_pD3DDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&pTopLevelSurface);
RECT rt;
::GetClientRect(m_hWnd,(RECT*)&rt);
IDirect3DSurface9* ptempTarget = pTopLevelSurface;
//nResult = m_pD3DDevice->CreateRenderTarget(rt.right-rt.left,
//rt.bottom - rt.top, m_D3DPresent.BackBufferFormat,m_D3DPresent.MultiSampleType,
// m_D3DPresent.MultiSampleQuality,TRUE,&ptempTarget,null);
HDC hdc;
nResult = ptempTarget->GetDC(&hdc);
RECT Rt(fx,fy,fx+fWidth,fy+fHight);
::DrawText(hdc,pStrText->GetStr(),pStrText->GetStrLength(),(RECT*)&Rt,DT_LEFT);
nResult = ptempTarget->ReleaseDC(hdc);
//m_pD3DDevice->StretchRect(ptempTarget,(RECT*)&rt,pTopLevelSurface,(RECT*)&rt,D3DTEXF_NONE); ptempTarget->Release();
//pTopLevelSurface->Release(); }
return nResult;
}


不使用注释部分代码,显示正常,调用函数输出一个字符串,但如果将注释的代码加上去,却显示两个字符串,为什么,StretchRect究竟实际上是做了什么动作,怎么跟MSDN上面写的不太一样
...全文
405 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jawalance 2011-12-21
  • 打赏
  • 举报
回复
想当初我PS2的忍shinobi全S

8,305

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧