[cogl/wip/pbo-read-pixels: 16/18] cogl-bitmap: Add a public accessor for the underlying pixel buffer
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/pbo-read-pixels: 16/18] cogl-bitmap: Add a public accessor for the underlying pixel buffer
- Date: Fri, 2 Mar 2012 18:12:21 +0000 (UTC)
commit c099a0f3e407695c66a349caf244ab0076aece85
Author: Neil Roberts <neil linux intel com>
Date: Sat Feb 25 20:28:50 2012 +0000
cogl-bitmap: Add a public accessor for the underlying pixel buffer
This adds a small cogl_bitmap_get_buffer public function. Note that
this can return NULL if the bitmap was not created with a pixel
buffer. It might be nice to change this eventually so that all bitmaps
have a pixel buffer.
cogl/cogl-bitmap.c | 9 +++++++++
cogl/cogl-bitmap.h | 15 +++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index 86e19e5..6e59a57 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -330,6 +330,15 @@ cogl_bitmap_get_rowstride (CoglBitmap *bitmap)
return bitmap->rowstride;
}
+CoglPixelBuffer *
+cogl_bitmap_get_buffer (CoglBitmap *bitmap)
+{
+ while (bitmap->shared_bmp)
+ bitmap = bitmap->shared_bmp;
+
+ return COGL_PIXEL_BUFFER (bitmap->buffer);
+}
+
GQuark
cogl_bitmap_error_quark (void)
{
diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h
index b507295..dd77834 100644
--- a/cogl/cogl-bitmap.h
+++ b/cogl/cogl-bitmap.h
@@ -31,6 +31,7 @@
#include <cogl/cogl-types.h>
#include <cogl/cogl-buffer.h>
#include <cogl/cogl-context.h>
+#include <cogl/cogl-pixel-buffer.h>
G_BEGIN_DECLS
@@ -170,6 +171,20 @@ cogl_bitmap_get_height (CoglBitmap *bitmap);
int
cogl_bitmap_get_rowstride (CoglBitmap *bitmap);
+/**
+ * cogl_bitmap_get_buffer:
+ * @bitmap: A #CoglBitmap
+ *
+ * Return value: the #CoglPixelBuffer that this buffer uses for
+ * storage. Note that if the bitmap was created with
+ * cogl_bitmap_new_from_file then it will not actually be using a
+ * pixel buffer and this function will return NULL.
+ * Stability: unstable
+ * Since: 1.10
+ */
+CoglPixelBuffer *
+cogl_bitmap_get_buffer (CoglBitmap *bitmap);
+
#endif /* COGL_ENABLE_EXPERIMENTAL_API */
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]