PEXDBSwapBuffer - Swap a Window with its Back Buffer


Synopsis

 
   void PEXDBSwapBuffer (
        Display *display,
        PEXRenderer renderer,
        int swap_action,
        unsigned long clear_mask
   )
 

Arguments

display
A pointer to a display structure returned by a successful XOpenDisplay call.

renderer
The ID of a renderer bound to the window to swap.

swap_action
One of PEXDBSwapUndefined, PEXDBSwapBackground, PEXDBSwapUntouched, PEXDBSwapCopied.

clear_mask
A single word bitmask containing zero or the logical OR of any of the following: PEXClearRendererImage, PEXClearRendererZ, PEXClearRendererAlpha.

Returns

None.

Description

Invoke PEXDBSwapBuffer to swap the back and front buffers for the window associated with the specified renderer. The swapping action does not modify the ID's associated with the window and the back buffer, so the application may continue to reference the "front buffer" and the "back buffer" with the same ID's it used to refer to the window and back buffer before the swap request.

After the swap, the implementation first performs the specified swap_action on the back buffer as follows:

PEXDBSwapUndefined -
the implementation leaves the contents of the back buffer in the state most convenient for the particular implementation. The client cannot count on any particular operation on the back buffer for this action.

PEXDBSwapBackground -
the implementation tiles the unobscured regions of the back buffer with the window's background, using the window's attributes as specified by the X protocol.

PEXDBSwapUntouched -
the implementation leaves the unobscured regions of the back buffer unmodified.

PEXDBSwapCopied -
the implementation makes the contents of the back buffer the same as the contents of the window.

The implementation then performs clear functions using the PEX renderer and PEX renderer attributes after the swap_action is complete, according to the settings of the flag in clear_mask. The implementation may use the renderer's background color, background color's alpha (1.0 if not present), Z clear value, or clip list attributes during the clear action, again depending on the clear_mask.

Note that the implementation processes the swap_action first, followed by the clear action specified by clear_mask. When the renderer's clip list is empty, a renderer clear action will "wipe-out" the result of the swap_action. In this case, the implementation may optimize the swap, swap_action, and clear action into a single swap and clear, using the renderer's background color.

As another example, if the renderer has a non-empty clip list and a clear image is called for by the client, then the implementation cannot optimize away the swap_action because the results of the swap_action are visible outside of the renderer's clip list. If the swap_action is PEXDBSwapBackground, then the X window's background tiling will be visible outside the ranges defined by the clip list. The implementation fills the regions within the clip list with the renderer's background color.

Errors

BadAlloc
The implementation failed to allocate memory to satisfy request.

BadMatch
The specified renderer's window is not double buffered.

BadPEXRendererState
The renderer's state is idle.

BadValue
The specified swap_action is invalid.

See Also

For an overview, see PEXlib Access and Information Functions.