mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
texture: Fix error handling in get_texture_bits_via_offscreen
get_texture_bits_via_offscreen does not check the return value of cogl_framebuffer_read_pixels_into_bitmap which results into never using the fallback path texture_get_cb. cogl_framebuffer_read_pixels_into_bitmap does not check whether the framebuffer is properly allocated though; so fix that as well. https://bugzilla.gnome.org/show_bug.cgi?id=673137 Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
8af076ced1
commit
a000189c68
@ -1963,6 +1963,9 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|||||||
_COGL_RETURN_VAL_IF_FAIL (source == COGL_READ_PIXELS_COLOR_BUFFER, FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (source == COGL_READ_PIXELS_COLOR_BUFFER, FALSE);
|
||||||
_COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE);
|
_COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE);
|
||||||
|
|
||||||
|
if (!cogl_framebuffer_allocate (framebuffer, NULL))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
ctx = cogl_framebuffer_get_context (framebuffer);
|
ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
|
|
||||||
width = cogl_bitmap_get_width (bitmap);
|
width = cogl_bitmap_get_width (bitmap);
|
||||||
|
@ -965,6 +965,7 @@ get_texture_bits_via_offscreen (CoglTexture *texture,
|
|||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
CoglBitmap *bitmap;
|
CoglBitmap *bitmap;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
@ -986,7 +987,7 @@ get_texture_bits_via_offscreen (CoglTexture *texture,
|
|||||||
dst_format,
|
dst_format,
|
||||||
dst_rowstride,
|
dst_rowstride,
|
||||||
dst_bits);
|
dst_bits);
|
||||||
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
|
ret = cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
|
||||||
x, y,
|
x, y,
|
||||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||||
bitmap);
|
bitmap);
|
||||||
@ -994,7 +995,7 @@ get_texture_bits_via_offscreen (CoglTexture *texture,
|
|||||||
|
|
||||||
cogl_object_unref (framebuffer);
|
cogl_object_unref (framebuffer);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user