[cairo] cairo_font.c patch
Maarten Breddels
dmon at xs4all.nl
Thu May 27 09:44:21 PDT 2004
There is a bug in cairo_font.c:_cairo_glyph_surface_init.
(Or cairo_image_surface.c:_cairo_image_surface_set_image has to be
implemented)
When the surface->backend != image->backend, but the surface is using
the image backend as 'similars', glyph images aren't copied to the
glyph->surface since the _cairo_image_surface_set_image function isn't
implemented. This patch does an extra check on the similar surface
backend, to avoid the _cairo_surface_set_image.
Maybe there is a better way to detect if the backend uses image surfaces
as similars, because now, a surface is created and destroyed for each
glyph created.
-Maarten Breddels
-------------- next part --------------
Index: src/cairo_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_font.c,v
retrieving revision 1.19
diff -u -r1.19 cairo_font.c
--- a/src/cairo_font.c 24 May 2004 09:28:05 -0000 1.19
+++ b/src/cairo_font.c 27 May 2004 16:27:33 -0000
@@ -283,14 +283,23 @@
glyph_surface->size.height);
if (glyph_surface->surface == NULL)
return;
-
- status = _cairo_surface_set_image (glyph_surface->surface,
- (cairo_image_surface_t *) image);
- if (status) {
- cairo_surface_destroy (glyph_surface->surface);
- glyph_surface->surface = NULL;
+
+ if(glyph_surface->surface->backend == image->backend)
+ {
+ /* the backend accepts image backends afterall */
+ cairo_surface_destroy(glyph_surface->surface);
+ glyph_surface->surface = image;
+ }
+ else
+ {
+ status = _cairo_surface_set_image (glyph_surface->surface,
+ (cairo_image_surface_t *) image);
+ if (status) {
+ cairo_surface_destroy (glyph_surface->surface);
+ glyph_surface->surface = NULL;
+ }
+ cairo_surface_destroy (image);
}
- cairo_surface_destroy (image);
} else
glyph_surface->surface = image;
}
More information about the cairo
mailing list