GPE::BltPrepare (Windows Embedded CE 6.0)
1/6/2010
This method identifies the appropriate functions needed to perform individual blits. This function executes before a sequence of clipped blit operations.
Syntax
SCODE GPE::BltPrepare(
GPEBltParms* pBltParms
);
Parameters
- pBltParms
[in] Pointer to a GPEBltParms structure containing parameters for the blit operation.
Return Value
S_OK indicates success.
Remarks
Two blit-related pure virtual GPE functions must be implemented for concrete classes derived from GPE: GPE::BltPrepare and GPE::BltComplete.
The following code example shows the simplest acceptable implementation for GPE::BltPrepare.
pBltParms->pBlt = EmulatedBlt;
return S_OK;
This action causes the emulated blit function provided with GPE to be used for blit operations.
For improved performance, the BltPrepare method can examine the characteristics of the blit and the associated surfaces defined in GPEBltParms to determine whether an accelerated form of the blit is used. The following code example shows how to determine the operations that are likely to be implemented in hardware.
if( pBltParms->pDst->InVideoMemory() && pBltParms->rop4 == 0x0000 )
// This is a fill of BLACKNESS in video memory.
if( pBltParms->pDst->InVideoMemory() && pBltParms->rop4 == 0xFFFF )
// This is a fill of WHITENESS in video memory.
if( pBltParms->pDst->InVideoMemory()
&& pBltParms->rop4 == 0xF0F0
&& pBltParms->solidColor != 0xFFFFFFFF )
// This is a fill of a solid color in video memory.
if( pBltParms->pDst->InVideoMemory()
&& pBltParms->pSrc->InVideoMemory()
&& pBltParms->rop4 == 0xCCCC
&& !pBltParms->pLookup
&& !pBltParms->pConvert )
// This is a source copy (SRCCOPY) between two surfaces, both in
// video memory, with no color translation.
To accelerate these types of blit, BltPrepare places the address of the accelerated function in the pBlt member of the GPEBltParms structure, instead of the pointer to the EmulatedBlt function. For operations such as solid color fills, the driver can prepare the hardware. For example, the driver can place a solid color into the appropriate register of the hardware. This eliminates the need to repeat the same action in every call to the accelerated blit handler.
Testing Flags for Memory Surfaces
To determine whether the surface is in video memory versus system memory, test the m_flnVideoMemory and m_flnUserMemory flags. The surface is in system memory whenever '0'==m_flnVideoMemory.
- Video Memory Surfaces are always allocated by the display driver.
'1'==m_flnVideoMemory && '0'==m_flnUserMemory
- System Memory Surfaces allocated by the display driver.
'0'==m_flnVideoMemory && '0'==m_flnUserMemory
- System Memory Surfaces allocated by GWES/GDI.
'0'==m_flnVideoMemory && '0'==m_flnUserMemory
- System Memory Surfaces allocated by the client.
'0'==m_flnVideoMemory && '1'==m_flnUserMemory
Requirements
Header | gpe.h |
Library | Gpe_lib.lib |
Windows Embedded CE | Windows CE 1.0 and later |
See Also
Reference
Display Driver Methods
GPE::BltComplete
GPEBltParms