These two fixes are from David Reveman <c99drn@cs.umu.se>:

Move NULL test from create_similar_scratch to create_similar_solid.
Fix for when surface->backend != image->backend, but the backend does use images for similar surfaces.
This commit is contained in:
Carl Worth 2004-05-28 12:47:00 +00:00
parent 41f549a870
commit f82f1ba380
4 changed files with 20 additions and 20 deletions

View file

@ -281,9 +281,11 @@ _cairo_glyph_surface_init (cairo_font_t *font,
CAIRO_FORMAT_A8, 0,
glyph_surface->size.width,
glyph_surface->size.height);
if (glyph_surface->surface == NULL)
if (glyph_surface->surface == NULL) {
glyph_surface->surface = image;
return;
}
status = _cairo_surface_set_image (glyph_surface->surface,
(cairo_image_surface_t *) image);
if (status) {

View file

@ -60,17 +60,11 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
int width,
int height)
{
cairo_surface_t *surface;
if (other == NULL)
return NULL;
surface = other->backend->create_similar (other, format, drawable,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
return surface;
return other->backend->create_similar (other, format, drawable,
width, height);
}
cairo_surface_t *
@ -103,6 +97,10 @@ _cairo_surface_create_similar_solid (cairo_surface_t *other,
surface = _cairo_surface_create_similar_scratch (other, format, 1,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
status = _cairo_surface_fill_rectangle (surface,
CAIRO_OPERATOR_SRC, color,
0, 0, width, height);

View file

@ -281,9 +281,11 @@ _cairo_glyph_surface_init (cairo_font_t *font,
CAIRO_FORMAT_A8, 0,
glyph_surface->size.width,
glyph_surface->size.height);
if (glyph_surface->surface == NULL)
if (glyph_surface->surface == NULL) {
glyph_surface->surface = image;
return;
}
status = _cairo_surface_set_image (glyph_surface->surface,
(cairo_image_surface_t *) image);
if (status) {

View file

@ -60,17 +60,11 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
int width,
int height)
{
cairo_surface_t *surface;
if (other == NULL)
return NULL;
surface = other->backend->create_similar (other, format, drawable,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
return surface;
return other->backend->create_similar (other, format, drawable,
width, height);
}
cairo_surface_t *
@ -103,6 +97,10 @@ _cairo_surface_create_similar_solid (cairo_surface_t *other,
surface = _cairo_surface_create_similar_scratch (other, format, 1,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
status = _cairo_surface_fill_rectangle (surface,
CAIRO_OPERATOR_SRC, color,
0, 0, width, height);