[cairo-commit] src/cairo-xlib-surface.c

罗晶华 Jinghua Luo jinghua at kemper.freedesktop.org
Sun Jun 11 23:19:16 PDT 2006


 src/cairo-xlib-surface.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

New commits:
diff-tree 9d3443e86ab32711d332b1474bc2fe23f9796723 (from 79928101352a84af1884e993fd06bf6cd44f2af3)
Author: Jinghua Luo <sunmoon1997 at gmail.com>
Date:   Mon Jun 12 14:18:25 2006 +0800

    xlib: bugfix for #7172.
    
    When the glyph format does not match the font format, the glyph will
    be rendered incorrectly. Setting the {x, y}_offset correctly when
    converting glyph format fix that.

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 5f57229..ad00416 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2232,12 +2232,14 @@ _cairo_xlib_surface_add_glyph (Display *
     if (glyph_surface->format != font_private->format) {
 	cairo_t *cr;
 	cairo_surface_t *tmp_surface;
+	double x_offset, y_offset;
 
 	tmp_surface = cairo_image_surface_create (font_private->format,
 						  glyph_surface->width,
 						  glyph_surface->height);
 	cr = cairo_create (tmp_surface);
-	cairo_set_source_surface (cr, &glyph_surface->base, 0, 0);
+	cairo_surface_get_device_offset (&glyph_surface->base, &x_offset, &y_offset);
+	cairo_set_source_surface (cr, &glyph_surface->base, x_offset, y_offset);
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 	cairo_paint (cr);
 


More information about the cairo-commit mailing list