summaryrefslogtreecommitdiff
path: root/cogl/cogl-texture.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-11-08 22:14:18 +0000
committerRobert Bragg <robert@linux.intel.com>2013-01-22 17:48:08 +0000
commitda9f5e61799fad575ecca2ca55fe3f1fcd30620a (patch)
treef63bc9b06c1075c9a7311f09c78bfddffa604790 /cogl/cogl-texture.c
parent07d47eadd370520594e449adeb2295d0f03cac58 (diff)
downloadcogl-da9f5e61799fad575ecca2ca55fe3f1fcd30620a.tar.gz
bitmap: ret CoglError from _new_with_malloc_buffer
_cogl_bitmap_new_with_malloc_buffer() now takes a CoglError for throwing exceptional errors and all callers have been updated to pass through any application error pointer as appropriate. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 67cad9c0eb5e2650b75aff16abde49f23aabd0cc)
Diffstat (limited to 'cogl/cogl-texture.c')
-rw-r--r--cogl/cogl-texture.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 25426c34..385f7c22 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -659,7 +659,10 @@ do_texture_draw_and_read (CoglFramebuffer *fb,
rect_bmp = _cogl_bitmap_new_with_malloc_buffer
(ctx,
width, height,
- COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+ COGL_PIXEL_FORMAT_RGBA_8888_PRE,
+ error);
+ if (!rect_bmp)
+ return FALSE;
if (!_cogl_framebuffer_read_pixels_into_bitmap
(fb,
@@ -787,7 +790,14 @@ _cogl_texture_draw_and_read (CoglTexture *texture,
_cogl_bitmap_new_with_malloc_buffer (ctx,
target_width,
target_height,
- COGL_PIXEL_FORMAT_RGBA_8888);
+ COGL_PIXEL_FORMAT_RGBA_8888,
+ error);
+ if (!alpha_bmp)
+ {
+ _cogl_bitmap_unmap (target_bmp);
+ goto EXIT;
+ }
+
/* Draw alpha values into RGB channels */
cogl_pipeline_set_layer_combine (ctx->texture_download_pipeline,
@@ -1112,9 +1122,17 @@ cogl_texture_get_data (CoglTexture *texture,
rowstride,
data);
else
- target_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx,
- tex_width, tex_height,
- closest_format);
+ {
+ target_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx,
+ tex_width, tex_height,
+ closest_format,
+ &ignore_error);
+ if (!target_bmp)
+ {
+ cogl_error_free (ignore_error);
+ return 0;
+ }
+ }
tg_data.target_bits = _cogl_bitmap_map (target_bmp, COGL_BUFFER_ACCESS_WRITE,
COGL_BUFFER_MAP_HINT_DISCARD,