Let backends return NULL in create_similar to take the fallback path.

Make xlib backend use it.
This commit is contained in:
Behdad Esfahbod 2006-07-31 14:45:54 -04:00
parent bdb4e1edad
commit b3341b4eda
2 changed files with 6 additions and 4 deletions

View file

@ -244,7 +244,7 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
int width,
int height)
{
cairo_surface_t *surface;
cairo_surface_t *surface = NULL;
cairo_font_options_t options;
cairo_format_t format = _cairo_format_from_content (content);
@ -254,7 +254,8 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
if (other->backend->create_similar)
surface = other->backend->create_similar (other, content, width, height);
else
if (!surface)
surface = cairo_image_surface_create (format, width, height);
cairo_surface_get_font_options (other, &options);

View file

@ -219,10 +219,11 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
/* As a good first approximation, if the display doesn't have even
* the most elementary RENDER operation, then we're better off
* using image surfaces for all temporary operations
* using image surfaces for all temporary operations, so return NULL
* and let the fallback code happen.
*/
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE(src)) {
return cairo_image_surface_create (format, width, height);
return NULL;
}
pix = XCreatePixmap (dpy, RootWindowOfScreen (src->screen),