mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 03:48:03 +02:00
Check return from pixman_image_set_filter().
Adding warn_unused_result to pixman detected a couple of instances where we abused the knowledge that the code currently can not fail, but in deference to its independent existence we should be more cautious.
This commit is contained in:
parent
56619a16dd
commit
7c1078b830
2 changed files with 21 additions and 6 deletions
|
|
@ -792,8 +792,9 @@ _cairo_image_surface_set_matrix (cairo_image_surface_t *surface,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t filter)
|
||||
static cairo_status_t
|
||||
_cairo_image_surface_set_filter (cairo_image_surface_t *surface,
|
||||
cairo_filter_t filter)
|
||||
{
|
||||
pixman_filter_t pixman_filter;
|
||||
|
||||
|
|
@ -823,7 +824,14 @@ _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t
|
|||
pixman_filter = PIXMAN_FILTER_BEST;
|
||||
}
|
||||
|
||||
pixman_image_set_filter (surface->pixman_image, pixman_filter, NULL, 0);
|
||||
if (! pixman_image_set_filter (surface->pixman_image,
|
||||
pixman_filter,
|
||||
NULL, 0))
|
||||
{
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -851,7 +859,9 @@ _cairo_image_surface_set_attributes (cairo_image_surface_t *surface,
|
|||
break;
|
||||
}
|
||||
|
||||
_cairo_image_surface_set_filter (surface, attributes->filter);
|
||||
status = _cairo_image_surface_set_filter (surface, attributes->filter);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1318,6 +1318,13 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
|
|||
}
|
||||
}
|
||||
|
||||
if (! pixman_image_set_filter (pixman_image, PIXMAN_FILTER_BILINEAR,
|
||||
NULL, 0))
|
||||
{
|
||||
pixman_image_unref (pixman_image);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
image = (cairo_image_surface_t *)
|
||||
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||
if (image->base.status) {
|
||||
|
|
@ -1325,8 +1332,6 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
|
|||
return image->base.status;
|
||||
}
|
||||
|
||||
pixman_image_set_filter (pixman_image, PIXMAN_FILTER_BILINEAR, NULL, 0);
|
||||
|
||||
_cairo_matrix_to_pixman_matrix (&pattern->base.matrix, &pixman_transform);
|
||||
if (!pixman_image_set_transform (pixman_image, &pixman_transform)) {
|
||||
cairo_surface_destroy (&image->base);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue