framebuffer: Adds a context getter for CoglFramebuffer

This adds a function to query what CoglContext a given framebuffer
belongs too. This can be useful if you pass framebuffer pointers around
and at some point you want to create another framebuffer as part of the
same context as a given framebuffer without assuming there is a single
default context.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-08-02 15:24:02 +01:00
parent f3a4d21187
commit 64b2bbab84
3 changed files with 25 additions and 0 deletions

View File

@ -1549,6 +1549,14 @@ cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
framebuffer->dither_enabled = dither_enabled;
}
CoglContext *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
{
g_return_val_if_fail (framebuffer != NULL, NULL);
return framebuffer->context;
}
gboolean
_cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
int x,

View File

@ -261,6 +261,22 @@ void
cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer,
CoglColorMask color_mask);
#define cogl_framebuffer_get_context cogl_framebuffer_get_context_EXP
/**
* @framebuffer: A #CoglFramebuffer
*
* Can be used to query the #CoglContext a given @framebuffer was
* instantiated within. This is the #CoglContext that was passed to
* cogl_onscreen_new() for example.
*
* Return value: The #CoglContext that the given @framebuffer was
* instantiated within.
* Since: 1.8
* Stability: unstable
*/
CoglContext *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer);
#define cogl_framebuffer_swap_buffers cogl_framebuffer_swap_buffers_EXP
void
cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer);

View File

@ -322,6 +322,7 @@ cogl_framebuffer_get_blue_bits
cogl_framebuffer_get_blue_bits
cogl_framebuffer_get_color_mask
cogl_framebuffer_set_color_mask
cogl_framebuffer_get_context
cogl_framebuffer_swap_buffers
cogl_framebuffer_swap_region
cogl_framebuffer_add_swap_buffers_callback