⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddhutil.cpp

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 CPP
字号:
#include "precomp.h"



BOOL DDGPEGDIHasSplitFromDDraw(void)
{
	BOOL	bDifferentPrimaries = FALSE;

	DEBUGENTER(DDGPEGDIHasSplitFromDDraw);
	
	bDifferentPrimaries = g_pGPE->PrimarySurface() != g_pDDrawPrimarySurface;

	DEBUGLEAVE(DDGPEGDIHasSplitFromDDraw);

	return bDifferentPrimaries;
}


SCODE DDGPEGetPixelFormatFromSurfaceDesc(
					LPDDSURFACEDESC			lpDDSurfaceDesc,
					EDDGPEPixelFormat*		pPixelFormat,
					EGPEFormat*				pFormat
					)
{
	SCODE ddRVal = S_OK;

	DEBUGENTER(DDGPEGetPixelFormatFromSurfaceDesc);

	if ((lpDDSurfaceDesc == NULL) || (pPixelFormat == NULL) || (pFormat == NULL))
	{
		DEBUGMSG(HAL_ZONE_ERROR, (TEXT("DDGPEGetPixelFormatFromSurfaceDesc ERROR - Invalid Parameters\r\n") ));
		return DDERR_INVALIDPARAMS;
	}

	if ( (lpDDSurfaceDesc->dwFlags & DDSD_PIXELFORMAT) )
	{
		ddRVal = g_pGPE->DetectPixelFormat(
						lpDDSurfaceDesc->ddsCaps.dwCaps,
						&lpDDSurfaceDesc->ddpfPixelFormat,
						pFormat,
						pPixelFormat
						);

		DEBUGMSG(HAL_ZONE_INFO, (TEXT("got pixelFormat %d\r\n"), *pPixelFormat));

		if( FAILED(ddRVal) )
		{
			DEBUGMSG(HAL_ZONE_WARNING,(TEXT("DDGPEGetPixelFormatFromSurfaceDesc returned DDERR_UNSUPPORTEDFORMAT\r\n")));
			ddRVal = DDERR_UNSUPPORTEDFORMAT;
		}
	}
	else
	{
		// just use primary surface info
		
		if (g_pDDrawPrimarySurface != NULL)
		{
			*pPixelFormat	= g_pDDrawPrimarySurface->PixelFormat();
			*pFormat		= g_pDDrawPrimarySurface->Format();
		}
		else
		{
			// it should never come in here, but this code works...

			SCODE		sc;
			GPEMode		modeInfo;
			DDGPESurf*	pDDGPESurf = NULL;

			sc = g_pGPE->GetModeInfo(&modeInfo, g_pGPE->GetPhysicalModeId());
			if (FAILED(sc))
			{
				ddRVal = DDERR_UNSUPPORTEDFORMAT;
			}
			else
			{
				*pFormat = modeInfo.format;

				GPEModeEx	modeInfoEx; // restrict the scope of this, since we can't rely on it being valid for all drivers
				sc = g_pGPE->GetModeInfoEx(&modeInfoEx, g_pGPE->GetPhysicalModeId());
				if (FAILED(sc))
				{
					// function probably wasn't supported by the driver
					*pPixelFormat = EGPEFormatToEDDGPEPixelFormat[modeInfo.format];
					ddRVal = S_OK;
				}
				else
				{
					*pPixelFormat = modeInfoEx.ePixelFormat;
				}
			}
		}

	}

	DEBUGLEAVE(DDGPEGetPixelFormatFromSurfaceDesc);
	return ddRVal;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -