st_theme_node_prerender_shadow: guard against failure to allocate a texture
If we are trying to render a shadow at a size that is very large in one direction, but small in the other direction (so that we don't 9-slice the texture), then allocating the backing texture for the offscreen buffer may fail due to texture-size limits. Don't crash in that case. https://bugzilla.gnome.org/show_bug.cgi?id=757150
This commit is contained in:
parent
9e64a1e3d6
commit
e7528bf2fa
@ -2150,7 +2150,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
|
|||||||
guint border_radius[4];
|
guint border_radius[4];
|
||||||
int max_borders[4];
|
int max_borders[4];
|
||||||
int center_radius, corner_id;
|
int center_radius, corner_id;
|
||||||
CoglHandle buffer, offscreen;
|
CoglHandle buffer, offscreen = COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
/* Get infos from the node */
|
/* Get infos from the node */
|
||||||
if (state->alloc_width < node->box_shadow_min_width ||
|
if (state->alloc_width < node->box_shadow_min_width ||
|
||||||
@ -2191,6 +2191,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
|
|||||||
state->box_shadow_height,
|
state->box_shadow_height,
|
||||||
COGL_TEXTURE_NO_SLICING,
|
COGL_TEXTURE_NO_SLICING,
|
||||||
COGL_PIXEL_FORMAT_ANY);
|
COGL_PIXEL_FORMAT_ANY);
|
||||||
|
if (buffer != COGL_INVALID_HANDLE)
|
||||||
offscreen = cogl_offscreen_new_to_texture (buffer);
|
offscreen = cogl_offscreen_new_to_texture (buffer);
|
||||||
|
|
||||||
if (offscreen != COGL_INVALID_HANDLE)
|
if (offscreen != COGL_INVALID_HANDLE)
|
||||||
@ -2211,6 +2212,8 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
|
|||||||
state->box_shadow_material = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
|
state->box_shadow_material = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
|
||||||
buffer);
|
buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buffer != COGL_INVALID_HANDLE)
|
||||||
cogl_handle_unref (buffer);
|
cogl_handle_unref (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user