summaryrefslogtreecommitdiff
path: root/cogl-pango
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-11-22 23:01:08 +0000
committerRobert Bragg <robert@linux.intel.com>2013-01-22 17:48:17 +0000
commit73e8a6d7ce25d6bb994a78935cc589edf02b5130 (patch)
treeb3f47f034b978a9c5ea9927dec1d12cb8d6d9595 /cogl-pango
parent5a814e386aa4aac5c7e9436cb3d11c0d7ce5c677 (diff)
downloadmutter-73e8a6d7ce25d6bb994a78935cc589edf02b5130.tar.gz
Allow lazy texture storage allocation
Consistent with how we lazily allocate framebuffers this patch allows us to instantiate textures but still specify constraints and requirements before allocating storage so that we can be sure to allocate the most appropriate/efficient storage. This adds a cogl_texture_allocate() function that is analogous to cogl_framebuffer_allocate() which can optionally be called to explicitly allocate storage and catch any errors. If this function isn't used explicitly then Cogl will implicitly ensure textures are allocated before the storage is needed. It is generally recommended to rely on lazy storage allocation or at least perform explicit allocation as late as possible so Cogl can be fully informed about the best way to allocate storage. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 1fa7c0f10a8a03043e3c75cb079a49625df098b7) Note: This reverts the cogl_texture_rectangle_new_with_size API change that dropped the CoglError argument and keeps the semantics of allocating the texture immediately. This is because Mutter currently uses this API so we will probably look at updating this later once we have a corresponding Mutter patch prepared. The other API changes were kept since they only affected experimental api.
Diffstat (limited to 'cogl-pango')
-rw-r--r--cogl-pango/cogl-pango-glyph-cache.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cogl-pango/cogl-pango-glyph-cache.c b/cogl-pango/cogl-pango-glyph-cache.c
index 14c8295a7..59cb5f430 100644
--- a/cogl-pango/cogl-pango-glyph-cache.c
+++ b/cogl-pango/cogl-pango-glyph-cache.c
@@ -214,6 +214,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
CoglPangoGlyphCacheValue *value)
{
CoglAtlasTexture *texture;
+ CoglError *ignore_error = NULL;
if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))
return FALSE;
@@ -227,10 +228,14 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
value->draw_width,
value->draw_height,
COGL_TEXTURE_NONE,
- COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+ COGL_PIXEL_FORMAT_RGBA_8888_PRE,
+ &ignore_error);
if (texture == NULL)
- return FALSE;
+ {
+ cogl_error_free (ignore_error);
+ return FALSE;
+ }
value->texture = COGL_TEXTURE (texture);
value->tx1 = 0;