[cairo] Assertion failed in sample code
Nis Martensen
nis.martensen at web.de
Thu Mar 17 15:15:07 PDT 2011
Am 26.02.2011 09:57, schrieb Nis Martensen:
> The code used to generate the samples on the operator page,
> http://cgit.freedesktop.org/cairo-www/tree/src/operators/ops.c
> does not work any more, but hits an assertion.
Reduced to this sample program:
----
#include <cairo.h>
#include <cairo-svg.h>
int main (int argc, char *argv[])
{
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_svg_surface_create ("foo.svg", 160, 120);
cr = cairo_create (surface);
cairo_rectangle (cr, 0, 0, 120, 90);
cairo_fill (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_rectangle (cr, 40, 30, 120, 90);
cairo_fill (cr);
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "foo.png");
cairo_surface_destroy (surface);
return 0;
}
----
The result is:
cairo-surface.c:178: _cairo_surface_set_error: Assertion `status <
CAIRO_STATUS_LAST_STATUS' failed.
The status value that makes it fail is CAIRO_INT_STATUS_IMAGE_FALLBACK.
The png file is successfully created, but the svg file es empty (zero
bytes).
While https://bugs.freedesktop.org/show_bug.cgi?id=34810 was closed, it
looks like the basic problem is still there and Benjamin's comment still
applies...?
Nis
More information about the cairo
mailing list