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. |
Any surface in DirectDraw can be constructed as a flipping surface. A flipping surface is any piece of memory that can be swapped between a front buffer and a back buffer. (This construct is commonly referred to as a flipping chain). Often, the front buffer is the primary surface, but it does not have to be.
Typically, when you use the IDirectDrawSurface::Flipmethod to request a surface flip operation, the pointers to surface memory for the primary surface and back buffers are swapped. Flipping is performed by switching pointers that the display device uses for referencing memory, not by copying surface memory.
When a flipping chain contains a primary surface and more than one back buffer, the pointers are switched in a circular pattern, as shown in the following illustration.
Other surfaces that are attached to a DirectDraw object, but not part of the flipping chain, are unaffected when the Flipmethod is called.
Remember, DirectDraw flips surfaces by swapping surface memory pointers within DirectDrawSurface objects, not by swapping the objects themselves.
This means that, to blit to the back buffer in any type of flipping scheme, you always use the same DirectDrawSurface object the one that was the back buffer when you created the flipping chain.
Conversely, you always perform a flip operation by calling the front surface's Flipmethod.
When working with visible surfaces, such as a primary surface flipping chain or a visible overlay surface flipping chain, the Flipmethod is asynchronous unless you include the DDFLIP_WAITNOTBUSY flag.
On these visible surfaces, the Flipmethod can return before the actual flip operation occurs in the hardware (because the hardware does not flip until the next vertical refresh occurs).
While the actual flip operation is pending, the back buffer behind the currently visible surface cannot be locked or blitted by calling the IDirectDrawSurface::Lock, IDirectDrawSurface::Blt, or IDirectDrawSurface::GetDCmethods.
If you attempt to call these methods while a flip operation is pending, they will fail and return DirectDraw Return Values. However, if you are using a triple buffered scheme, the rearmost buffer is still available.
In order to rotate the screen while using primary surface page flipping, your application must call FlipToGDISurfaceprior to calling ChangeDisplaySettingsExto rotate the screen. Otherwise, the flipping order may be changed by the call to Restore on the primary surface flipping chain, after that screen has been rotated.