diff options
author | Robert Bragg <robert@linux.intel.com> | 2011-08-24 01:37:06 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2011-09-05 19:02:05 +0100 |
commit | 191d915671aff653b909805ac7369510851ebd05 (patch) | |
tree | 2eae447986c9db6b101f992f5343ab4de32f3b39 | |
parent | 476ff37fa682d127228ad90c11aaa614744acab8 (diff) | |
download | cogl-191d915671aff653b909805ac7369510851ebd05.tar.gz |
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>
-rw-r--r-- | cogl/cogl-framebuffer.c | 6 | ||||
-rw-r--r-- | 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 4a45e756..351ed19c 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 fb69da4e..1935acf6 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 |