[cogl/wip/rib/master-next: 6/12] framebuffer: Adds a context getter for CoglFramebuffer



commit f5b6809c1cefded2679655e54d9a3e6b56693548
Author: Robert Bragg <robert linux intel com>
Date:   Tue Aug 2 15:24:02 2011 +0100

    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.

 cogl/cogl-framebuffer.c                            |    8 ++++++++
 cogl/cogl-framebuffer.h                            |   14 ++++++++++++++
 .../cogl-2.0-experimental-sections.txt             |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index a86e4a6..55ae809 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -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,
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index c8c7a35..f37250b 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -261,6 +261,20 @@ 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.
+ */
+CoglContext *
+cogl_framebuffer_get_context (CoglFramebuffer *framebuffer);
+
 #define cogl_framebuffer_swap_buffers cogl_framebuffer_swap_buffers_EXP
 void
 cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer);
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
index 476bc9e..382dcd4 100644
--- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
+++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]