GPESurf Class

The GPESurf class represents a surface which may have been allocated by GDI or by the driver. It may also retain its pixels in system or video memory (if there is such a distinction on your device). Generally GPESurfs are created for all surfaces either when the driver allocates the memory (for example in response to DrvCreateDeviceBitmap) or when the driver encounters them (for example the source bitmap in a Blt operation where GDI allocated the surface).

If GDI allocated the surface, the Drv function will create a temporary surface (TmpGPESurf class) which is a derivative of the GPESurf class. This is just a wrapper around the SURFOBJ which GPE created. The TmpGPESurf object only persists for the duration of the Drv call.

The GPESurf class provides a number of methods for the driver to retrieve a pointer to the pixel data, the pixel format, stride, height, and width. GPESurf also retains a flag to indicate whether the data is stored in video memory (verified by a call to GPESurf::InVideoMemory() ), and a local flag which determines whether the memory should be de-allocated when the GPESurf is deleted.

The driver writer will typically want to create a new surface class based on the GPESurf class for video memory allocations. Refer to Surface Allocation for details of the GPE::AllocateSurface method.