Cogl.Onscreen.swap_buffers_with_damage
Description: Reference for Cogl.Onscreen.swap_buffers_with_damage

### Virtual Method

# Cogl Onscreenswap_buffers_with_damage

#### Declaration [src]

    void
    swap_buffers_with_damage (
      CoglOnscreen* onscreen,
      const MtkRegion* region,
      CoglFrameInfo* info,
      gpointer user_data
    )

#### Description [src]

Swaps the current back buffer being rendered too, to the front for display and provides information to any system compositor about what regions of the buffer have changed (damage) with respect to the last swapped buffer.

This function has the same semantics as `cogl_framebuffer_swap_buffers()` except that it additionally allows applications to pass a damage region which may be used to minimize how much of the screen is redrawn.

For example if your application is only animating a small object in the corner of the screen and everything else is remaining static then it can help the compositor to know that only the bottom right corner of your newly swapped buffer has really changed with respect to your previously swapped front buffer.

If `region` is NULL then the whole buffer will implicitly be reported as damaged as if `cogl_onscreen_swap_buffers()` had been called.

This function also implicitly discards the contents of the color, depth and stencil buffers as if `cogl_framebuffer_discard_buffers()` were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame. If you want to perform incremental updates to older back buffers then please refer to the `cogl_onscreen_get_buffer_age()` api.

Whenever possible it is recommended that applications use this function instead of `cogl_onscreen_swap_buffers()` to improve performance when running under a compositor.

It is highly recommended to use this API in conjunction with the `cogl_onscreen_get_buffer_age()` api so that your application can perform incremental rendering based on old back buffers.

#### Parameters

`region`

  Type: `MtkRegion`

  A region representing damage.

  The data is owned by the caller of the method.

`info`

  Type: `CoglFrameInfo`

  No description available.

  The data is owned by the caller of the method.

`user_data`

  Type: `gpointer`

  No description available.

  The argument can be `NULL`.
  The data is owned by the caller of the method.