diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c index f297d93de..4d263055c 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 934715ce8..3787d921b 100644 --- a/cogl/cogl-bitmap.h +++ b/cogl/cogl-bitmap.h @@ -31,6 +31,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -174,6 +175,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 */ /**