swap_buffers_with_damage


Description:

public void swap_buffers_with_damage (int rectangles, int n_rectangles)

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 list of damaged rectangles which may be passed on to a compositor so that it can minimize how much of the screen is redrawn in response to this applications newly swapped front buffer.

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 n_rectangles is 0 then the whole buffer will implicitly be reported as damaged as if swap_buffers had been called.

This function also implicitly discards the contents of the color, depth and stencil buffers as if 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 get_buffer_age api.

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

<note>It is highly recommended to use this API in conjunction with the get_buffer_age api so that your application can perform incremental rendering based on old back buffers.</note>

Parameters:

this

A Onscreen framebuffer

rectangles

An array of integer 4-tuples representing damaged rectangles as (x, y, width, height) tuples.

n_rectangles

The number of 4-tuples to be read from rectangles