mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-18 09:30:40 +01:00
gl: Propagate surface creation error instead of crashing
This commit is contained in:
parent
faa4e6761c
commit
a4e292507c
1 changed files with 16 additions and 6 deletions
|
|
@ -127,9 +127,10 @@ _cairo_gl_glyph_cache_lock (cairo_gl_glyph_cache_t *cache,
|
|||
return _cairo_rtree_pin (&cache->rtree, scaled_glyph->surface_private);
|
||||
}
|
||||
|
||||
static cairo_gl_glyph_cache_t *
|
||||
static cairo_status_t
|
||||
cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
|
||||
cairo_format_t format)
|
||||
cairo_format_t format,
|
||||
cairo_gl_glyph_cache_t **cache_out)
|
||||
{
|
||||
cairo_gl_glyph_cache_t *cache;
|
||||
cairo_content_t content;
|
||||
|
|
@ -148,7 +149,7 @@ cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
|
|||
break;
|
||||
case CAIRO_FORMAT_INVALID:
|
||||
ASSERT_NOT_REACHED;
|
||||
return NULL;
|
||||
return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
|
||||
}
|
||||
|
||||
if (unlikely (cache->pattern.surface == NULL)) {
|
||||
|
|
@ -157,13 +158,19 @@ cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
|
|||
content,
|
||||
GLYPH_CACHE_WIDTH,
|
||||
GLYPH_CACHE_HEIGHT);
|
||||
if (unlikely (surface->status)) {
|
||||
cairo_status_t status = surface->status;
|
||||
cairo_surface_destroy (surface);
|
||||
return status;
|
||||
}
|
||||
_cairo_surface_release_device_reference (surface);
|
||||
_cairo_pattern_init_for_surface (&cache->pattern, surface);
|
||||
cairo_surface_destroy (surface);
|
||||
cache->pattern.base.has_component_alpha = (content == CAIRO_CONTENT_COLOR_ALPHA);
|
||||
}
|
||||
|
||||
return cache;
|
||||
*cache_out = cache;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -293,8 +300,11 @@ _render_glyphs (cairo_gl_surface_t *dst,
|
|||
}
|
||||
|
||||
if (scaled_glyph->surface->format != last_format) {
|
||||
cache = cairo_gl_context_get_glyph_cache (ctx,
|
||||
scaled_glyph->surface->format);
|
||||
status = cairo_gl_context_get_glyph_cache (ctx,
|
||||
scaled_glyph->surface->format,
|
||||
&cache);
|
||||
if (unlikely (status))
|
||||
goto FINISH;
|
||||
|
||||
last_format = scaled_glyph->surface->format;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue