[cairo] Empty surface creation

Benoit Perrot benoit at lrde.epita.fr
Tue Dec 20 22:41:29 PST 2005


I've investigated one ("clip-all") of the failing tests on glitz backend
and it fails because the backend is asked to create an empty surface, ie
a surface of 0 width and 0 height.

And in glitz/src/glitz_surface.c:

glitz_surface_t *
glitz_surface_create (/* [Args] */)
{
    /* [Vars] */

    if (!width || !height)
	return NULL;

... glitz_surface_create returns NULL, which results in:

cairo/src/cairo-surface.c:

cairo_surface_t *
_cairo_surface_create_similar_solid (/* [Args] */)
{
    /* [Vars] */

    /* This calls other->backend->create_similar, hence
       glitz_surface_create
     */
    surface = _cairo_surface_create_similar_scratch (other, content,
						     width, height);
    /* */

    if (surface->status) {
	_cairo_error (CAIRO_STATUS_NO_MEMORY);
	return (cairo_surface_t*) &_cairo_surface_nil;
    }

... in a wonderfull CAIRO_STATUS_NO_MEMORY.



So the question is: what must a backend do when asked for an empty
surface? (the pixman one effectively creates a surface with null w&h)

(Should this be written in the documentation?
 Could a specific test be interesting?)

-- 
benoit




More information about the cairo mailing list