mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 01:48:07 +02:00
[cairo-pattern] Return the nil cairo_pattern_t for CAIRO_STATUS_NO_MEMORY.
If we asked to create a pattern after encountering an allocation failure, we can avoid another allocation by returning the nil pattern object.
This commit is contained in:
parent
e8e5f93ffe
commit
ebababc0cf
1 changed files with 3 additions and 0 deletions
|
|
@ -338,6 +338,9 @@ _cairo_pattern_create_in_error (cairo_status_t status)
|
|||
{
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
if (status == CAIRO_STATUS_NO_MEMORY)
|
||||
return (cairo_pattern_t *)&_cairo_pattern_nil.base;
|
||||
|
||||
pattern = _cairo_pattern_create_solid (_cairo_stock_color (CAIRO_STOCK_BLACK),
|
||||
CAIRO_CONTENT_COLOR);
|
||||
/* no-op on a pattern already in error i.e the _cairo_pattern_nil */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue