diff --git a/cogl/cogl/cogl-texture-2d-sliced.c b/cogl/cogl/cogl-texture-2d-sliced.c index a2f65b218..6a8df1eb4 100644 --- a/cogl/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl/cogl-texture-2d-sliced.c @@ -746,7 +746,7 @@ _cogl_texture_2d_sliced_is_sliced (CoglTexture *tex) /* It's only after allocating a sliced texture that we will know * whether it really needed to be sliced... */ - if (!tex->allocated) + if (!cogl_texture_is_allocated (tex)) cogl_texture_allocate (tex, NULL); if (tex_2ds->slice_x_spans->len != 1 || diff --git a/cogl/cogl/cogl-texture-private.h b/cogl/cogl/cogl-texture-private.h index 5e3c52a79..c623d663d 100644 --- a/cogl/cogl/cogl-texture-private.h +++ b/cogl/cogl/cogl-texture-private.h @@ -337,3 +337,5 @@ cogl_texture_get_max_level_set (CoglTexture *texture); void cogl_texture_set_max_level_set (CoglTexture *texture, int max_level_set); + +gboolean cogl_texture_is_allocated (CoglTexture *texture); diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c index 2bc774656..a20b06217 100644 --- a/cogl/cogl/cogl-texture.c +++ b/cogl/cogl/cogl-texture.c @@ -258,7 +258,7 @@ cogl_texture_get_height (CoglTexture *texture) CoglPixelFormat cogl_texture_get_format (CoglTexture *texture) { - if (!texture->allocated) + if (!cogl_texture_is_allocated (texture)) cogl_texture_allocate (texture, NULL); return COGL_TEXTURE_GET_CLASS (texture)->get_format (texture); @@ -324,7 +324,7 @@ cogl_texture_is_sliced (CoglTexture *texture) { g_return_val_if_fail (COGL_IS_TEXTURE (texture), FALSE); - if (!texture->allocated) + if (!cogl_texture_is_allocated (texture)) cogl_texture_allocate (texture, NULL); return COGL_TEXTURE_GET_CLASS (texture)->is_sliced (texture); @@ -337,7 +337,7 @@ cogl_texture_is_sliced (CoglTexture *texture) gboolean _cogl_texture_can_hardware_repeat (CoglTexture *texture) { - if (!texture->allocated) + if (!cogl_texture_is_allocated (texture)) cogl_texture_allocate (texture, NULL); return COGL_TEXTURE_GET_CLASS (texture)->can_hardware_repeat (texture); } @@ -349,7 +349,7 @@ cogl_texture_get_gl_texture (CoglTexture *texture, { g_return_val_if_fail (COGL_IS_TEXTURE (texture), FALSE); - if (!texture->allocated) + if (!cogl_texture_is_allocated (texture)) cogl_texture_allocate (texture, NULL); return COGL_TEXTURE_GET_CLASS (texture)->get_gl_texture (texture, @@ -1100,13 +1100,19 @@ _cogl_texture_set_allocated (CoglTexture *texture, _cogl_texture_free_loader (texture); } +gboolean +cogl_texture_is_allocated (CoglTexture *texture) +{ + return texture->allocated; +} + gboolean cogl_texture_allocate (CoglTexture *texture, GError **error) { g_return_val_if_fail (COGL_IS_TEXTURE (texture), FALSE); - if (texture->allocated) + if (cogl_texture_is_allocated (texture)) return TRUE; if (texture->components == COGL_TEXTURE_COMPONENTS_RG && @@ -1220,7 +1226,7 @@ cogl_texture_set_components (CoglTexture *texture, CoglTextureComponents components) { g_return_if_fail (COGL_IS_TEXTURE (texture)); - g_return_if_fail (!texture->allocated); + g_return_if_fail (!cogl_texture_is_allocated (texture)); if (texture->components == components) return; @@ -1241,7 +1247,7 @@ cogl_texture_set_premultiplied (CoglTexture *texture, gboolean premultiplied) { g_return_if_fail (COGL_IS_TEXTURE (texture)); - g_return_if_fail (!texture->allocated); + g_return_if_fail (!cogl_texture_is_allocated (texture)); premultiplied = !!premultiplied;