Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 IDirectDrawSurfaceinterface 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_ODDflag.

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_WASSTILLDRAWINGfor each surface involved in the flip until the specified number of vertical retraces has occurred.

If DDFLIP_INTERVAL2is set, DirectDraw will flip on every second vertical sync. If DDFLIP_INTERVAL4is set, DirectDraw will flip on every fourth sync.

These flags are effective only if DDCAPS2_FLIPINTERVALis set in the DDCAPSstructure 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_EVENflag.

DDFLIP_WAITNOTBUSY

Waits for a previously initiated drawing operation to complete instead of returning immediately with the DDERR_WASSTILLDRAWINGreturn 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_FLIPand DDSCAPS_FRONTBUFFERcapabilities. The display memory previously associated with the front buffer is associated with the back buffer.

The lpDDSurfaceTargetOverrideparameter 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::Flipwill not be synchronized with the vertical blank by default. Use DDFLIP_WAITVSYNCto 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