mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 07:00:08 +01:00
test: Improve memfault behaviour.
Various minor tweaks to convert asserts into error returns and to improve error checking on intermediate surfaces.
This commit is contained in:
parent
c549203c8d
commit
af26560f25
8 changed files with 112 additions and 37 deletions
|
|
@ -242,7 +242,7 @@ static void
|
||||||
_cairo_boilerplate_svg_cleanup (void *closure)
|
_cairo_boilerplate_svg_cleanup (void *closure)
|
||||||
{
|
{
|
||||||
svg_target_closure_t *ptc = closure;
|
svg_target_closure_t *ptc = closure;
|
||||||
if (ptc->target) {
|
if (ptc->target != NULL) {
|
||||||
cairo_surface_finish (ptc->target);
|
cairo_surface_finish (ptc->target);
|
||||||
cairo_surface_destroy (ptc->target);
|
cairo_surface_destroy (ptc->target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -917,10 +917,23 @@ REPEAT:
|
||||||
goto UNWIND_SURFACE;
|
goto UNWIND_SURFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_set_user_data (surface,
|
if (cairo_surface_set_user_data (surface,
|
||||||
&cairo_boilerplate_output_basename_key,
|
&cairo_boilerplate_output_basename_key,
|
||||||
base_path,
|
base_path,
|
||||||
NULL);
|
NULL))
|
||||||
|
{
|
||||||
|
#if HAVE_MEMFAULT
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
|
if (target->cleanup)
|
||||||
|
target->cleanup (closure);
|
||||||
|
|
||||||
|
goto REPEAT;
|
||||||
|
#else
|
||||||
|
ret = CAIRO_TEST_FAILURE;
|
||||||
|
goto UNWIND_SURFACE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
cairo_surface_set_device_offset (surface, dev_offset, dev_offset);
|
cairo_surface_set_device_offset (surface, dev_offset, dev_offset);
|
||||||
|
|
||||||
|
|
|
||||||
34
test/png.c
34
test/png.c
|
|
@ -55,6 +55,7 @@ format_to_string (cairo_format_t format)
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case CAIRO_FORMAT_A1: return "a1";
|
case CAIRO_FORMAT_A1: return "a1";
|
||||||
case CAIRO_FORMAT_A8: return "a8";
|
case CAIRO_FORMAT_A8: return "a8";
|
||||||
|
case CAIRO_FORMAT_RGB16_565: return "rgb16";
|
||||||
case CAIRO_FORMAT_RGB24: return "rgb24";
|
case CAIRO_FORMAT_RGB24: return "rgb24";
|
||||||
case CAIRO_FORMAT_ARGB32: return "argb32";
|
case CAIRO_FORMAT_ARGB32: return "argb32";
|
||||||
case CAIRO_FORMAT_INVALID:
|
case CAIRO_FORMAT_INVALID:
|
||||||
|
|
@ -79,61 +80,72 @@ preamble (cairo_test_context_t *ctx)
|
||||||
cairo_surface_t *surface0, *surface1;
|
cairo_surface_t *surface0, *surface1;
|
||||||
cairo_status_t status;
|
cairo_status_t status;
|
||||||
uint32_t argb32 = 0xdeadbede;
|
uint32_t argb32 = 0xdeadbede;
|
||||||
cairo_test_status_t result = CAIRO_TEST_SUCCESS;
|
|
||||||
|
|
||||||
surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
|
surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
|
||||||
CAIRO_FORMAT_ARGB32,
|
CAIRO_FORMAT_ARGB32,
|
||||||
1, 1, 4);
|
1, 1, 4);
|
||||||
assert (cairo_surface_status (surface0) == CAIRO_STATUS_SUCCESS);
|
|
||||||
status = cairo_surface_write_to_png (surface0, filename);
|
status = cairo_surface_write_to_png (surface0, filename);
|
||||||
if (status) {
|
if (status) {
|
||||||
cairo_test_log (ctx, "Error writing '%s': %s\n",
|
cairo_test_log (ctx, "Error writing '%s': %s\n",
|
||||||
filename, cairo_status_to_string (status));
|
filename, cairo_status_to_string (status));
|
||||||
result = CAIRO_TEST_FAILURE;
|
|
||||||
|
cairo_surface_destroy (surface0);
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
surface1 = cairo_image_surface_create_from_png (filename);
|
surface1 = cairo_image_surface_create_from_png (filename);
|
||||||
status = cairo_surface_status (surface1);
|
status = cairo_surface_status (surface1);
|
||||||
if (status) {
|
if (status) {
|
||||||
cairo_test_log (ctx, "Error reading '%s': %s\n",
|
cairo_test_log (ctx, "Error reading '%s': %s\n",
|
||||||
filename, cairo_status_to_string (status));
|
filename, cairo_status_to_string (status));
|
||||||
result = CAIRO_TEST_FAILURE;
|
|
||||||
|
cairo_surface_destroy (surface1);
|
||||||
|
cairo_surface_destroy (surface0);
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! image_surface_equals (surface0, surface1)) {
|
if (! image_surface_equals (surface0, surface1)) {
|
||||||
cairo_test_log (ctx, "Error surface mismatch.\n");
|
cairo_test_log (ctx, "Error surface mismatch.\n");
|
||||||
cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
|
cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
|
||||||
cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);
|
cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);
|
||||||
result = CAIRO_TEST_FAILURE;
|
|
||||||
|
cairo_surface_destroy (surface0);
|
||||||
|
cairo_surface_destroy (surface1);
|
||||||
|
return CAIRO_TEST_FAILURE;
|
||||||
}
|
}
|
||||||
assert (*(uint32_t *) cairo_image_surface_get_data (surface1) == argb32);
|
assert (*(uint32_t *) cairo_image_surface_get_data (surface1) == argb32);
|
||||||
|
|
||||||
cairo_surface_destroy (surface0);
|
cairo_surface_destroy (surface0);
|
||||||
cairo_surface_destroy (surface1);
|
cairo_surface_destroy (surface1);
|
||||||
|
|
||||||
|
|
||||||
surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
|
surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
|
||||||
CAIRO_FORMAT_RGB24,
|
CAIRO_FORMAT_RGB24,
|
||||||
1, 1, 4);
|
1, 1, 4);
|
||||||
assert (cairo_surface_status (surface0) == CAIRO_STATUS_SUCCESS);
|
|
||||||
status = cairo_surface_write_to_png (surface0, filename);
|
status = cairo_surface_write_to_png (surface0, filename);
|
||||||
if (status) {
|
if (status) {
|
||||||
cairo_test_log (ctx, "Error writing '%s': %s\n",
|
cairo_test_log (ctx, "Error writing '%s': %s\n",
|
||||||
filename, cairo_status_to_string (status));
|
filename, cairo_status_to_string (status));
|
||||||
result = CAIRO_TEST_FAILURE;
|
cairo_surface_destroy (surface0);
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
surface1 = cairo_image_surface_create_from_png (filename);
|
surface1 = cairo_image_surface_create_from_png (filename);
|
||||||
status = cairo_surface_status (surface1);
|
status = cairo_surface_status (surface1);
|
||||||
if (status) {
|
if (status) {
|
||||||
cairo_test_log (ctx, "Error reading '%s': %s\n",
|
cairo_test_log (ctx, "Error reading '%s': %s\n",
|
||||||
filename, cairo_status_to_string (status));
|
filename, cairo_status_to_string (status));
|
||||||
result = CAIRO_TEST_FAILURE;
|
|
||||||
|
cairo_surface_destroy (surface1);
|
||||||
|
cairo_surface_destroy (surface0);
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! image_surface_equals (surface0, surface1)) {
|
if (! image_surface_equals (surface0, surface1)) {
|
||||||
cairo_test_log (ctx, "Error surface mismatch.\n");
|
cairo_test_log (ctx, "Error surface mismatch.\n");
|
||||||
cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
|
cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
|
||||||
cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);
|
cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);
|
||||||
result = CAIRO_TEST_FAILURE;
|
|
||||||
|
cairo_surface_destroy (surface0);
|
||||||
|
cairo_surface_destroy (surface1);
|
||||||
|
return CAIRO_TEST_FAILURE;
|
||||||
}
|
}
|
||||||
assert ((*(uint32_t *) cairo_image_surface_get_data (surface1) & RGB_MASK)
|
assert ((*(uint32_t *) cairo_image_surface_get_data (surface1) & RGB_MASK)
|
||||||
== (argb32 & RGB_MASK));
|
== (argb32 & RGB_MASK));
|
||||||
|
|
@ -141,7 +153,7 @@ preamble (cairo_test_context_t *ctx)
|
||||||
cairo_surface_destroy (surface0);
|
cairo_surface_destroy (surface0);
|
||||||
cairo_surface_destroy (surface1);
|
cairo_surface_destroy (surface1);
|
||||||
|
|
||||||
return result;
|
return CAIRO_TEST_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAIRO_TEST (png,
|
CAIRO_TEST (png,
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,16 @@ draw (cairo_t *cr, int width, int height)
|
||||||
thread_data_t thread_data[N_THREADS];
|
thread_data_t thread_data[N_THREADS];
|
||||||
cairo_test_status_t test_status = CAIRO_TEST_SUCCESS;
|
cairo_test_status_t test_status = CAIRO_TEST_SUCCESS;
|
||||||
cairo_surface_t *source;
|
cairo_surface_t *source;
|
||||||
|
cairo_status_t status;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
source = create_source (cairo_get_target (cr));
|
source = create_source (cairo_get_target (cr));
|
||||||
|
status = cairo_surface_status (source);
|
||||||
|
if (status) {
|
||||||
|
cairo_surface_destroy (source);
|
||||||
|
return cairo_test_status_from_status (cairo_test_get_context (cr),
|
||||||
|
status);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < N_THREADS; i++) {
|
for (i = 0; i < N_THREADS; i++) {
|
||||||
thread_data[i].target = cairo_surface_create_similar (cairo_get_target (cr),
|
thread_data[i].target = cairo_surface_create_similar (cairo_get_target (cr),
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ draw (cairo_t *cr, int width, int height)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_surface_t *similar;
|
cairo_surface_t *similar;
|
||||||
|
cairo_status_t status;
|
||||||
cairo_t *cr2;
|
cairo_t *cr2;
|
||||||
|
|
||||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
|
@ -143,21 +144,27 @@ draw (cairo_t *cr, int width, int height)
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* destroy the surface last, as this triggers XCloseDisplay */
|
/* destroy the surface last, as this triggers XCloseDisplay */
|
||||||
|
cairo_surface_finish (surface);
|
||||||
|
status = cairo_surface_status (surface);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
return CAIRO_TEST_SUCCESS;
|
return cairo_test_status_from_status (cairo_test_get_context (cr),
|
||||||
|
status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_test_status_t
|
static cairo_test_status_t
|
||||||
preamble (cairo_test_context_t *ctx)
|
preamble (cairo_test_context_t *ctx)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
|
cairo_status_t status;
|
||||||
|
|
||||||
surface = create_source_surface (SOURCE_SIZE);
|
surface = create_source_surface (SOURCE_SIZE);
|
||||||
if (surface == NULL) /* can't create the source so skip the test */
|
if (surface == NULL) /* can't create the source so skip the test */
|
||||||
return CAIRO_TEST_UNTESTED;
|
return CAIRO_TEST_UNTESTED;
|
||||||
|
|
||||||
|
cairo_surface_finish (surface);
|
||||||
|
status = cairo_surface_status (surface);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
return CAIRO_TEST_SUCCESS;
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ preamble (cairo_test_context_t *ctx)
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_font_face_t *font_face;
|
cairo_font_face_t *font_face;
|
||||||
|
cairo_status_t status;
|
||||||
|
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 0, 0);
|
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 0, 0);
|
||||||
cr = cairo_create (surface);
|
cr = cairo_create (surface);
|
||||||
|
|
@ -61,9 +62,12 @@ preamble (cairo_test_context_t *ctx)
|
||||||
assert (cairo_toy_font_face_get_family (font_face) != NULL);
|
assert (cairo_toy_font_face_get_family (font_face) != NULL);
|
||||||
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL);
|
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_NORMAL);
|
||||||
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL);
|
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_NORMAL);
|
||||||
assert (cairo_font_face_status(font_face) == CAIRO_STATUS_SUCCESS);
|
status = cairo_font_face_status(font_face);
|
||||||
cairo_font_face_destroy (font_face);
|
cairo_font_face_destroy (font_face);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
cairo_select_font_face (cr,
|
cairo_select_font_face (cr,
|
||||||
"bizarre",
|
"bizarre",
|
||||||
CAIRO_FONT_SLANT_OBLIQUE,
|
CAIRO_FONT_SLANT_OBLIQUE,
|
||||||
|
|
@ -73,9 +77,12 @@ preamble (cairo_test_context_t *ctx)
|
||||||
assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "bizarre"));
|
assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "bizarre"));
|
||||||
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_OBLIQUE);
|
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_OBLIQUE);
|
||||||
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_BOLD);
|
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_BOLD);
|
||||||
assert (cairo_font_face_status(font_face) == CAIRO_STATUS_SUCCESS);
|
status = cairo_font_face_status(font_face);
|
||||||
cairo_font_face_destroy (font_face);
|
cairo_font_face_destroy (font_face);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
font_face = cairo_toy_font_face_create ("bozarre",
|
font_face = cairo_toy_font_face_create ("bozarre",
|
||||||
CAIRO_FONT_SLANT_OBLIQUE,
|
CAIRO_FONT_SLANT_OBLIQUE,
|
||||||
CAIRO_FONT_WEIGHT_BOLD);
|
CAIRO_FONT_WEIGHT_BOLD);
|
||||||
|
|
@ -83,9 +90,12 @@ preamble (cairo_test_context_t *ctx)
|
||||||
assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "bozarre"));
|
assert (0 == (strcmp) (cairo_toy_font_face_get_family (font_face), "bozarre"));
|
||||||
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_OBLIQUE);
|
assert (cairo_toy_font_face_get_slant (font_face) == CAIRO_FONT_SLANT_OBLIQUE);
|
||||||
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_BOLD);
|
assert (cairo_toy_font_face_get_weight (font_face) == CAIRO_FONT_WEIGHT_BOLD);
|
||||||
assert (cairo_font_face_status(font_face) == CAIRO_STATUS_SUCCESS);
|
status = cairo_font_face_status(font_face);
|
||||||
cairo_font_face_destroy (font_face);
|
cairo_font_face_destroy (font_face);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
font_face = cairo_toy_font_face_create (NULL,
|
font_face = cairo_toy_font_face_create (NULL,
|
||||||
CAIRO_FONT_SLANT_OBLIQUE,
|
CAIRO_FONT_SLANT_OBLIQUE,
|
||||||
CAIRO_FONT_WEIGHT_BOLD);
|
CAIRO_FONT_WEIGHT_BOLD);
|
||||||
|
|
|
||||||
|
|
@ -42,43 +42,64 @@ destroy_data2 (void *p)
|
||||||
static cairo_test_status_t
|
static cairo_test_status_t
|
||||||
preamble (cairo_test_context_t *ctx)
|
preamble (cairo_test_context_t *ctx)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
|
||||||
static const cairo_user_data_key_t key1, key2;
|
static const cairo_user_data_key_t key1, key2;
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
cairo_status_t status;
|
||||||
int data1, data2;
|
int data1, data2;
|
||||||
|
|
||||||
data1 = 0;
|
data1 = 0;
|
||||||
data2 = 0;
|
data2 = 0;
|
||||||
|
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
||||||
assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1)
|
status = cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1);
|
||||||
== CAIRO_STATUS_SUCCESS);
|
if (status)
|
||||||
assert (cairo_surface_set_user_data (surface, &key2, &data2, destroy_data2)
|
goto error;
|
||||||
== CAIRO_STATUS_SUCCESS);
|
|
||||||
|
status = cairo_surface_set_user_data (surface, &key2, &data2, destroy_data2);
|
||||||
|
if (status)
|
||||||
|
goto error;
|
||||||
|
|
||||||
assert (cairo_surface_get_user_data (surface, &key1) == &data1);
|
assert (cairo_surface_get_user_data (surface, &key1) == &data1);
|
||||||
assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
|
status = cairo_surface_set_user_data (surface, &key1, NULL, NULL);
|
||||||
== CAIRO_STATUS_SUCCESS);
|
if (status)
|
||||||
|
goto error;
|
||||||
|
|
||||||
assert (cairo_surface_get_user_data (surface, &key1) == NULL);
|
assert (cairo_surface_get_user_data (surface, &key1) == NULL);
|
||||||
assert (data1 == 1);
|
assert (data1 == 1);
|
||||||
assert (data2 == 0);
|
assert (data2 == 0);
|
||||||
|
|
||||||
assert (cairo_surface_set_user_data (surface, &key2, NULL, NULL)
|
status = cairo_surface_set_user_data (surface, &key2, NULL, NULL);
|
||||||
== CAIRO_STATUS_SUCCESS);
|
if (status)
|
||||||
|
goto error;
|
||||||
|
|
||||||
assert (data2 == 2);
|
assert (data2 == 2);
|
||||||
|
|
||||||
data1 = 0;
|
data1 = 0;
|
||||||
assert (cairo_surface_set_user_data (surface, &key1, &data1, NULL)
|
status = cairo_surface_set_user_data (surface, &key1, &data1, NULL);
|
||||||
== CAIRO_STATUS_SUCCESS);
|
if (status)
|
||||||
assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
|
goto error;
|
||||||
== CAIRO_STATUS_SUCCESS);
|
|
||||||
|
status = cairo_surface_set_user_data (surface, &key1, NULL, NULL);
|
||||||
|
if (status)
|
||||||
|
goto error;
|
||||||
|
|
||||||
assert (data1 == 0);
|
assert (data1 == 0);
|
||||||
assert (cairo_surface_get_user_data (surface, &key1) == NULL);
|
assert (cairo_surface_get_user_data (surface, &key1) == NULL);
|
||||||
|
|
||||||
assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1)
|
status = cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1);
|
||||||
== CAIRO_STATUS_SUCCESS);
|
if (status)
|
||||||
|
goto error;
|
||||||
|
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
assert (data1 == 1);
|
assert (data1 == 1);
|
||||||
assert (data2 == 2);
|
assert (data2 == 2);
|
||||||
|
|
||||||
return CAIRO_TEST_SUCCESS;
|
return CAIRO_TEST_SUCCESS;
|
||||||
|
|
||||||
|
error:
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAIRO_TEST (user_data,
|
CAIRO_TEST (user_data,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,12 @@ create_source_surface (int size)
|
||||||
xrender_format,
|
xrender_format,
|
||||||
size, size);
|
size, size);
|
||||||
data->device = cairo_device_reference (cairo_surface_get_device (surface));
|
data->device = cairo_device_reference (cairo_surface_get_device (surface));
|
||||||
cairo_surface_set_user_data (surface, &closure_key, data, cleanup);
|
if (cairo_surface_set_user_data (surface, &closure_key, data, cleanup)) {
|
||||||
|
cairo_surface_finish (surface);
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
cleanup (data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue