[cogl] framebuffer: Add a getter for the framebuffer format



commit 191d915671aff653b909805ac7369510851ebd05
Author: Robert Bragg <robert linux intel com>
Date:   Wed Aug 24 01:37:06 2011 +0100

    framebuffer: Add a getter for the framebuffer format
    
    This adds a new function, cogl_framebuffer_get_color_format() to be able
    to query the common pixel format for any color buffers attached to a
    given CoglFramebuffer. For example an offscreen framebuffer created
    using cogl_offscreen_new_to_texture() would have a format matching the
    texture.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl/cogl-framebuffer.c |    6 ++++++
 cogl/cogl-framebuffer.h |   16 ++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 4a45e75..351ed19 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -1533,6 +1533,12 @@ cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
   framebuffer->dither_enabled = dither_enabled;
 }
 
+CoglPixelFormat
+cogl_framebuffer_get_color_format (CoglFramebuffer *framebuffer)
+{
+  return framebuffer->format;
+}
+
 CoglContext *
 cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
 {
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index fb69da4..1935acf 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -261,6 +261,22 @@ void
 cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer,
                                  CoglColorMask color_mask);
 
+#define cogl_framebuffer_get_color_format cogl_framebuffer_get_color_format_EXP
+/**
+ * cogl_framebuffer_get_color_format:
+ * @framebuffer: A #CoglFramebuffer framebuffer
+ *
+ * Queries the common #CoglPixelFormat of all color buffers attached
+ * to this framebuffer. For an offscreen framebuffer created with
+ * cogl_offscreen_new_to_texture() this will correspond to the format
+ * of the texture.
+ *
+ * Since: 1.8
+ * Stability: unstable
+ */
+CoglPixelFormat
+cogl_framebuffer_get_color_format (CoglFramebuffer *framebuffer);
+
 #define cogl_framebuffer_get_context cogl_framebuffer_get_context_EXP
 /**
  * @framebuffer: A #CoglFramebuffer



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