Previous Next

DdDestroySurface

The DdDestroySurface callback function destroys a DirectDraw surface.

DWORD
  (APIENTRY *PDD_SURFCB_DESTROYSURFACE)(
    PDD_DESTROYSURFACEDATA  lpDestroySurface
    );

Parameters

lpDestroySurface
Points to a DD_DESTROYSURFACEDATA structure that contains the information needed to destroy a surface.

Return Value

DdDestroySurface returns one of the following callback codes:

DDHAL_DRIVER_HANDLED

DDHAL_DRIVER_NOTHANDLED

Headers

Declared in ddrawint.h. Include winddi.h.

Comments

If DirectDraw did the memory allocation at surface creation time and the driver was not involved in the allocation, DirectDraw does not call the driver's DdDestroySurface function to destroy the surface.

If the driver is performing the surface memory management itself, DdDestroySurface should free the surface memory and perform any other cleanup, such as freeing private data stored in the dwReserved1 members of the DD_SURFACE_GLOBAL and DD_SURFACE_LOCAL structures.

For a driver-managed surface, if the surface is persistent (that is, the DDSCAPS2_DONOTPERSIST flag in the dwCaps2 member of the DDSCAPS2 structure for the surface is not set), DdDestroySurface can be called with the purpose of envicting the surface from video memory. In this case, the display driver can continue to keep any private data in the dwReserved1 members until DdDestroySurface is called to actually destroy the surface.

DdDestroySurface can be called with a disabled PDEV. A PDEV is disabled or enabled by calling the display driver's DrvAssertMode function. See Managing PDEVs for more information.

See Also

DdCreateSurface, DD_DESTROYSURFACEDATA, DDSCAPS2