Share via


IDirectDrawSurface::Flip

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method makes the surface memory associated with the DDSCAPS_BACKBUFFER surface become associated with the front-buffer surface.

Syntax

HRESULT Flip(
  LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, 
  DWORD dwFlags
);

Parameters

  • lpDDSurfaceTargetOverride
    Address of the IDirectDrawSurface interface for an arbitrary surface in the flipping chain.

    The default for this parameter is NULL, in which case DirectDraw cycles through the buffers in the order they are attached to each other.

    If this parameter is not NULL, DirectDraw flips to the specified surface instead of the next surface in the flipping chain. The method fails if the specified surface is not a member of the flipping chain.

  • dwFlags
    Flags specifying flip options. The following table shows the possible flags.

    Flag Description

    DDFLIP_EVEN

    For use only when displaying video in an overlay surface. The new surface contains data from the even field of a video signal. This flag cannot be used with the DDFLIP_ODD flag.

    DDFLIP_INTERVAL1 DDFLIP_INTERVAL2 DDFLIP_INTERVAL4

    These flags indicate how many vertical retraces to wait between each flip.

    The default is 1.

    DirectDraw returns DERR_WASSTILLDRAWING for each surface involved in the flip until the specified number of vertical retraces has occurred.

    If DDFLIP_INTERVAL2 is set, DirectDraw will flip on every second vertical sync. If DDFLIP_INTERVAL4 is set, DirectDraw will flip on every fourth sync.

    These flags are effective only if DDCAPS2_FLIPINTERVAL is set in the DDCAPS structure returned for the device.

    DDFLIP_ODD

    For use only when displaying video in an overlay surface. The new surface contains data from the odd field of a video signal. This flag cannot be used with the DDFLIP_EVEN flag.

    DDFLIP_WAITNOTBUSY

    Waits for a previously initiated drawing operation to complete instead of returning immediately with the DDERR_WASSTILLDRAWING return value.

    If a previous drawing operation is in progress at the time of the call, this flag defers returning from the call until the new flip operation begins or an error occurs.

    DDFLIP_WAITVSYNC

    Waits for a V-Sync before performing the flip operation.

Return Value

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_GENERIC

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_NOFLIPHW

DDERR_NOTFLIPPABLE

DDERR_SURFACEBUSY

DDERR_SURFACELOST

DDERR_UNSUPPORTED

DDERR_WASSTILLDRAWING

For more information on these error codes see DirectDraw Return Values.

Remarks

This method can be called only for a surface that has the DDSCAPS_FLIP and DDSCAPS_FRONTBUFFER capabilities. The display memory previously associated with the front buffer is associated with the back buffer.

The lpDDSurfaceTargetOverride parameter is used in rare cases when the back buffer is not the buffer that should become the front buffer. Typically this parameter is NULL.

IDirectDrawSurface::Flip will not be synchronized with the vertical blank by default. Use DDFLIP_WAITVSYNC to override this behavior.

Requirements

Header ddraw.h
Library ddraw.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Reference

IDirectDrawSurface::GetFlipStatus