本文整理汇总了C++中LPDIRECTDRAWSURFACE::BltFast方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE::BltFast方法的具体用法?C++ LPDIRECTDRAWSURFACE::BltFast怎么用?C++ LPDIRECTDRAWSURFACE::BltFast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE::BltFast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flip_fullscreen
void dd_Window::flip_fullscreen()
{
int i=0;
HRESULT hr;
//hack for 320x200 letterboxing
if(xres == 320 && yres == 200)
{
hr = dx_bs->BltFast(0,20,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
DDBLTFX ddbltfx;
memset(&ddbltfx, 0, sizeof(DDBLTFX));
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwFillColor = 0;
RECT rBlit;
rBlit.left = 0; rBlit.top = 0; rBlit.right = 320; rBlit.bottom = 20;
dx_bs->Blt(&rBlit, 0, 0, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
rBlit.left = 0; rBlit.top = 220; rBlit.right = 320; rBlit.bottom = 240;
dx_bs->Blt(&rBlit, 0, 0, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
}
//regular case
else
hr = dx_bs->BltFast(0,0,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
if(hr==DDERR_SURFACELOST)
{
dx_bs->Restore();
dx_os->Restore();
dx_bs->BltFast(0,0,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
}
hr=dx_ps->Flip(0,DDFLIP_WAIT | DDFLIP_NOVSYNC);
//dx_ps->Flip(0,0);
if(hr==DDERR_SURFACELOST)
{
dx_ps->Restore();
hr=dx_ps->Flip(0,DDFLIP_WAIT | DDFLIP_NOVSYNC);
}
hr=dx_os->Lock(0,&dx_osd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY | DDLOCK_WAIT,0);
if(hr==DDERR_SURFACELOST)
{
dx_os->Restore();
hr=dx_os->Lock(0,&dx_osd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY | DDLOCK_WAIT,0);
}
dx_os->Unlock(0);
img->data=(quad*)dx_osd.lpSurface;
img->pitch=dx_osd.lPitch/vid_bytesperpixel;
}
示例2: flip
bool flip(long bltWidth,long bltHeight){
if (m_ddsback==0) return true;
if (m_IS_USER_BACK_BUFFER){
if ((bltWidth>0)&&(bltHeight>0)){
RECT rt; rt.left=0; rt.top=0;
rt.right=bltWidth; rt.bottom=bltHeight;
#ifdef WINCE
HRESULT ddrval=m_ddsprimary->Blt(&rt,m_ddsback, &rt,DDBLT_WAITNOTBUSY, NULL);
#else
HRESULT ddrval=m_ddsprimary->BltFast(0,0, m_ddsback, &rt, NULL);
#endif
return (ddrval == DD_OK);
}else
return true;
}else{ //flip
while( true ) {
HRESULT ddrval= m_ddsprimary->Flip( NULL, DDFLIP_WAIT );// 交换表面
if( ddrval == DD_OK )
return true;
if( ddrval == DDERR_SURFACELOST ) {
ddrval = m_ddsprimary->Restore();
if( ddrval!= DD_OK )
return false;
}
if( ddrval != DDERR_WASSTILLDRAWING ){
return false;
}
::Sleep(0);
}
}
}
示例3: BltObject
//-----------------------------------------------------------------------------
// Name: BltObject()
// Desc:
//-----------------------------------------------------------------------------
HRESULT BltObject( int x, int y, LPDIRECTDRAWSURFACE pdds, RECT* prc,
DWORD flags )
{
if( NULL == pdds )
return E_FAIL;
while( 1 )
{
HRESULT hr = g_pddsBackBuffer->BltFast( x, y, pdds, prc, flags );
if( FAILED(hr) )
{
if( hr == DDERR_WASSTILLDRAWING )
continue;
if( hr == DDERR_SURFACELOST )
if( SUCCEEDED( RestoreSurfaces() ) )
continue;
return E_FAIL;
}
return S_OK;
}
}