mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
cogl-atlas-texture: Check for errors when creating the atlas texture
cogl_texture_2d_new may fail in certain circumstances so cogl_atlas_texture_reserve_space should detect this and also fail. This will cause cogl_texture_new to fallback to a sliced texture. Thanks to Vladimir Ivakin for reporting this problem.
This commit is contained in:
parent
9e74b04fbd
commit
0238be686a
@ -861,15 +861,20 @@ _cogl_atlas_texture_reserve_space (CoglAtlasTexture *new_sub_tex,
|
||||
COGL_NOTE (ATLAS, "Could not fit texture in the atlas");
|
||||
ret = FALSE;
|
||||
}
|
||||
/* We need to migrate the existing textures into a new texture */
|
||||
else if ((new_tex =
|
||||
_cogl_texture_2d_new_with_size (_cogl_atlas_get_width (new_atlas),
|
||||
_cogl_atlas_get_height (new_atlas),
|
||||
COGL_TEXTURE_NONE,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888)) ==
|
||||
COGL_INVALID_HANDLE)
|
||||
{
|
||||
COGL_NOTE (ATLAS, "Could not create a CoglTexture2D");
|
||||
_cogl_atlas_free (new_atlas);
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We need to migrate the existing textures into a new texture */
|
||||
new_tex =
|
||||
_cogl_texture_2d_new_with_size (_cogl_atlas_get_width (new_atlas),
|
||||
_cogl_atlas_get_height (new_atlas),
|
||||
COGL_TEXTURE_NONE,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888);
|
||||
|
||||
COGL_NOTE (ATLAS,
|
||||
"Atlas %s with size %ix%i",
|
||||
ctx->atlas == NULL ||
|
||||
|
Loading…
Reference in New Issue
Block a user