当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTDRAWSURFACE4::BltFast方法代码示例

本文整理汇总了C++中LPDIRECTDRAWSURFACE4::BltFast方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE4::BltFast方法的具体用法?C++ LPDIRECTDRAWSURFACE4::BltFast怎么用?C++ LPDIRECTDRAWSURFACE4::BltFast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTDRAWSURFACE4的用法示例。


在下文中一共展示了LPDIRECTDRAWSURFACE4::BltFast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetupTexture

//=====================================================================================
//	SetupTexture
//=====================================================================================
geBoolean SetupTexture(int32 Stage, geRDriver_THandle *THandle, int32 MipLevel)
{
#ifdef D3D_MANAGE_TEXTURES
	D3DSetTexture(Stage, THandle->MipData[MipLevel].Texture);
	return GE_TRUE;
#else
	THandle_MipData		*MipData;

	MipData = &THandle->MipData[MipLevel];
	
	if (!SetupMipData(MipData))
	{
		MipData->Flags |= THANDLE_UPDATE;		// Force an upload
		CacheInfo.TexMisses++;
	}

	if (MipData->Flags & THANDLE_UPDATE)
	{
		HRESULT					Error;
		LPDIRECTDRAWSURFACE4	Surface;

		Surface = D3DCache_SlotGetSurface(MipData->Slot);

		Error = Surface->BltFast(0, 0, MipData->Surface, NULL, DDBLTFAST_WAIT);

		if (Error != DD_OK)
		{
			if(Error==DDERR_SURFACELOST)
			{
				if (!D3DMain_RestoreAllSurfaces())
					return FALSE;
			}
			else
			{
				D3DMain_Log("SetupTexture: System to Video cache Blt failed.\n %s", D3DErrorToString(Error));
				return GE_FALSE;
			}
		}
	}

	MipData->Flags &= ~THANDLE_UPDATE;

	D3DCache_SlotSetLRU(MipData->Slot, CurrentLRU);
	D3DSetTexture(Stage, D3DCache_SlotGetTexture(MipData->Slot));

	return GE_TRUE;
#endif
}
开发者ID:RealityFactory,项目名称:Genesis3D,代码行数:51,代码来源:Pcache.cpp

示例2: Blit

/***************************************************************************\
  Blits one surface to another.
\**************************************************************************/
int IMR_DirectXInterface::Blit(LPDIRECTDRAWSURFACE4 Source, LPDIRECTDRAWSURFACE4 Target)
{
RECT Dest;
HRESULT ddrval;
DDSURFACEDESC2 SourceDesc, TargetDesc;
int BltX, BltY;

// Make sure DirectDraw is active:
if (!Flags.DirectDrawActive)
    {
    IMR_SetErrorText("IMR_DirectXInterface::Blit(): Interface not initialized!");
    return IMRERR_NOTREADY;
     }

// Make sure we have surfaces:
if (!Source || !Target)
    {
    IMR_SetErrorText("IMR_DirectXInterface::Blit(): NULL surface(s) specified!");
    return IMRERR_NODATA;
     }

// Get a surface descriptor for the surfaces:
TargetDesc.dwSize = sizeof(TargetDesc);
Target->GetSurfaceDesc(&TargetDesc);
SourceDesc.dwSize = sizeof(SourceDesc);
Source->GetSurfaceDesc(&SourceDesc);

// Now find the blit coords:
BltX = (TargetDesc.dwWidth / 2) - (SourceDesc.dwWidth / 2);
BltY = (TargetDesc.dwHeight / 2) - (SourceDesc.dwHeight / 2);

// Blit the surface:
ddrval = Target->BltFast(BltX, BltY, Source, NULL, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT);

// If we lost the surface, return failure:
if (ddrval == DDERR_SURFACELOST)
    {
    Restore(Source);
    Restore(Target);
    IMR_SetErrorText("IMR_DirectXInterface::Blit(): Lost surface!");
    return IMRERR_DIRECTX;
     }

// Return ok:
return IMR_OK;
 }
开发者ID:dhawt,项目名称:Immerse,代码行数:49,代码来源:imr_directx.cpp

示例3: SetupLMap

//=====================================================================================
//	SetupLMap
//=====================================================================================
geBoolean SetupLMap(int32 Stage, DRV_LInfo *LInfo, int32 LNum, geBoolean Dynamic)
{
#ifdef D3D_MANAGE_TEXTURES
	#ifdef USE_TPAGES
	{
		geRDriver_THandle		*THandle;

		THandle = LInfo->THandle;

		if (Dynamic)
			THandle->Flags |= THANDLE_UPDATE;

		if (!THandle->Block)
		{
			THandle->Block = TPage_MgrFindOptimalBlock(TPageMgr, CurrentLRU);
			THandle->Flags |= THANDLE_UPDATE;
			TPage_BlockSetUserData(THandle->Block, THandle);
			assert(THandle->Block);
		}
		else if (TPage_BlockGetUserData(THandle->Block) != THandle)
		{
			// Find another block
			THandle->Block = TPage_MgrFindOptimalBlock(TPageMgr, CurrentLRU);
			assert(THandle->Block);

			THandle->Flags |= THANDLE_UPDATE;
			TPage_BlockSetUserData(THandle->Block, THandle);
		}

		if (THandle->Flags & THANDLE_UPDATE)
			FillLMapSurface2(LInfo, LNum);

		TPage_BlockSetLRU(THandle->Block, CurrentLRU);
		D3DSetTexture(Stage, TPage_BlockGetTexture(THandle->Block));
	
		if (Dynamic)
			THandle->Flags |= THANDLE_UPDATE;
		else
			THandle->Flags &= ~THANDLE_UPDATE;

		return GE_TRUE;
	}
	#else
	{
		geRDriver_THandle		*THandle;

		THandle = LInfo->THandle;

		if (Dynamic)
			THandle->MipData[0].Flags |= THANDLE_UPDATE;

		if (THandle->MipData[0].Flags & THANDLE_UPDATE)
			FillLMapSurface(LInfo, LNum);

		D3DSetTexture(Stage, THandle->MipData[0].Texture);
	
		if (Dynamic)
			THandle->MipData[0].Flags |= THANDLE_UPDATE;
		else
			THandle->MipData[0].Flags &= ~THANDLE_UPDATE;

		return GE_TRUE;
	}
	#endif

#else
	geRDriver_THandle	*THandle;
	THandle_MipData		*MipData;

	THandle = LInfo->THandle;
	MipData = &THandle->MipData[0];

	if (Dynamic)
		MipData->Flags |= THANDLE_UPDATE;

	if (!SetupMipData(MipData))
	{
		MipData->Flags |= THANDLE_UPDATE;		// Force an upload
		CacheInfo.LMapMisses++;
	}

	if (MipData->Flags & THANDLE_UPDATE)
	{
		HRESULT					Error;
		LPDIRECTDRAWSURFACE4	Surface;

		assert(MipData->Slot);
		
		Surface = D3DCache_SlotGetSurface(MipData->Slot);

		assert(Surface);
		assert(THandle->Log < MAX_LMAP_LOG_SIZE);
		assert(SystemToVideo[THandle->Log].Surface);

		LoadLMapFromSystem(LInfo, THandle->Log, LNum);

		Error = Surface->BltFast(0, 0, SystemToVideo[THandle->Log].Surface, NULL, DDBLTFAST_WAIT);
//.........这里部分代码省略.........
开发者ID:RealityFactory,项目名称:Genesis3D,代码行数:101,代码来源:Pcache.cpp


注:本文中的LPDIRECTDRAWSURFACE4::BltFast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。