michael@0: diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c michael@0: index e9e544d..cde68a1 100644 michael@0: --- a/src/cairo-image-surface.c michael@0: +++ b/src/cairo-image-surface.c michael@0: @@ -324,8 +324,8 @@ _cairo_image_surface_create_with_pixman_format (unsigned char *data, michael@0: cairo_surface_t *surface; michael@0: pixman_image_t *pixman_image; michael@0: michael@0: - pixman_image = pixman_image_create_bits (pixman_format, width, height, michael@0: - (uint32_t *) data, stride); michael@0: + pixman_image = pixman_image_create_bits (pixman_format, width ? width : 1, height ? height : 1, michael@0: + (uint32_t *) data, stride ? stride : 4); michael@0: michael@0: if (unlikely (pixman_image == NULL)) michael@0: return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); michael@0: diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c michael@0: index f86a133..ddcb600 100644 michael@0: --- a/src/cairo-xlib-surface.c michael@0: +++ b/src/cairo-xlib-surface.c michael@0: @@ -675,7 +675,8 @@ _get_image_surface (cairo_xlib_surface_t *surface, michael@0: michael@0: pixmap = XCreatePixmap (surface->dpy, michael@0: surface->drawable, michael@0: - extents.width, extents.height, michael@0: + extents.width <= 0 ? 1 : extents.width, michael@0: + extents.height <= 0 ? 1 : extents.height, michael@0: surface->depth); michael@0: if (pixmap) { michael@0: XCopyArea (surface->dpy, surface->drawable, pixmap, surface->gc, michael@0: @@ -686,7 +687,8 @@ _get_image_surface (cairo_xlib_surface_t *surface, michael@0: ximage = XGetImage (surface->dpy, michael@0: pixmap, michael@0: 0, 0, michael@0: - extents.width, extents.height, michael@0: + extents.width <= 0 ? 1 : extents.width, michael@0: + extents.height <= 0 ? 1 : extents.height, michael@0: AllPlanes, ZPixmap); michael@0: michael@0: XFreePixmap (surface->dpy, pixmap);