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

Carl Worth cworth at kemper.freedesktop.org
Sat Jun 10 10:42:41 PDT 2006


 src/cairo-surface.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

New commits:
diff-tree d758d5104a09019b65c1b2e93fd5ab80b0e4d056 (from 0662928e4fd7bd432fdd815b95271d5c74eaba70)
Author: Carl Worth <cworth at cworth.org>
Date:   Sat Jun 10 10:42:32 2006 -0700

    Don't create a new scaled_font if there's a device_offset but no device_scale.
    
    (This is covering up my mistake from the last batch of 12 commits which
    wasn't ready to be pushed yet. This fixes some of the crashes which
    were introduced, and is a good thing to do regardless.)

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 17c2953..0b245f8 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1692,20 +1692,11 @@ _cairo_surface_show_glyphs (cairo_surfac
     if (_cairo_surface_has_device_transform (surface))
     {
         int i;
-	cairo_font_options_t *font_options;
-	cairo_matrix_t font_matrix, dev_ctm;
 
         dev_glyphs = malloc (sizeof(cairo_glyph_t) * num_glyphs);
         if (!dev_glyphs)
             return CAIRO_STATUS_NO_MEMORY;
 
-	font_options = cairo_font_options_create ();
-	status = cairo_font_options_status(font_options);
-	if (status) {
-	    free (dev_glyphs);
-	    return status;
-	}
-
         for (i = 0; i < num_glyphs; i++) {
             dev_glyphs[i].index = glyphs[i].index;
             dev_glyphs[i].x = glyphs[i].x;
@@ -1715,15 +1706,22 @@ _cairo_surface_show_glyphs (cairo_surfac
 					  &dev_glyphs[i].y);
         }
 
-	cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix),
-	cairo_scaled_font_get_ctm (scaled_font, &dev_ctm);
-	cairo_matrix_multiply (&dev_ctm, &dev_ctm, &surface->device_transform);
-	cairo_scaled_font_get_font_options (scaled_font, font_options);
-	dev_scaled_font = cairo_scaled_font_create (cairo_scaled_font_get_font_face (scaled_font),
-						    &font_matrix,
-						    &dev_ctm,
-						    font_options);
-	cairo_font_options_destroy (font_options);
+	if (! _cairo_matrix_is_integer_translation (&surface->device_transform, NULL, NULL)) {
+	    cairo_font_options_t *font_options;
+	    cairo_matrix_t font_matrix, dev_ctm;
+
+	    font_options = cairo_font_options_create ();
+
+	    cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
+	    cairo_scaled_font_get_ctm (scaled_font, &dev_ctm);
+	    cairo_matrix_multiply (&dev_ctm, &dev_ctm, &surface->device_transform);
+	    cairo_scaled_font_get_font_options (scaled_font, font_options);
+	    dev_scaled_font = cairo_scaled_font_create (cairo_scaled_font_get_font_face (scaled_font),
+							&font_matrix,
+							&dev_ctm,
+							font_options);
+	    cairo_font_options_destroy (font_options);
+	}
     }
 
     if (surface->backend->show_glyphs) {


More information about the cairo-commit mailing list