[cairo-commit] 5 commits - CODING_STYLE src/cairoint.h src/cairo-ps-surface.c src/cairo-ps-surface-private.h src/cairo-type1-subset.c src/cairo-types-private.h test/clip-operator-ps-argb32-ref.png test/clip-operator-ps-rgb24-ref.png test/gradient-alpha-ps-argb32-ref.png test/gradient-alpha-ps-rgb24-ref.png test/Makefile.am test/operator-clear-ps-argb32-ref.png test/operator-source-ps-argb32-ref.png test/operator-source-ps-rgb24-ref.png test/over-around-source-ps-rgb24-ref.png

Chris Wilson ickle at kemper.freedesktop.org
Sat Sep 6 11:42:31 PDT 2008


 CODING_STYLE                             |   16 +++++-
 dev/null                                 |binary
 src/cairo-ps-surface-private.h           |    5 -
 src/cairo-ps-surface.c                   |   80 ++++++++++++-------------------
 src/cairo-type1-subset.c                 |   75 ++++++++++++-----------------
 src/cairo-types-private.h                |   18 ++++++
 src/cairoint.h                           |   18 ------
 test/Makefile.am                         |    3 -
 test/over-around-source-ps-rgb24-ref.png |binary
 9 files changed, 99 insertions(+), 116 deletions(-)

New commits:
commit d45b3168db2362eaaa8ee29fc653509bc8f67e65
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 5 06:58:56 2008 +0100

    [ps] Use a color_t rather than open-code.
    
    Simplify the code by tracking the current solid color with a
    cairo_color_t.

diff --git a/src/cairo-ps-surface-private.h b/src/cairo-ps-surface-private.h
index 79ac983..e78833d 100644
--- a/src/cairo-ps-surface-private.h
+++ b/src/cairo-ps-surface-private.h
@@ -72,10 +72,7 @@ typedef struct cairo_ps_surface {
     cairo_bool_t use_string_datasource;
 
     cairo_bool_t current_pattern_is_solid_color;
-    double current_color_red;
-    double current_color_green;
-    double current_color_blue;
-    double current_color_alpha;
+    cairo_color_t current_color;
 
     int num_pages;
 
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index bb80651..c1ec6ad 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2818,10 +2818,7 @@ _cairo_ps_surface_emit_pattern (cairo_ps_surface_t *surface,
 	cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) pattern;
 
 	if (surface->current_pattern_is_solid_color == FALSE ||
-	    surface->current_color_red != solid->color.red ||
-	    surface->current_color_green != solid->color.green ||
-	    surface->current_color_blue != solid->color.blue ||
-	    surface->current_color_alpha != solid->color.alpha)
+	    ! _cairo_color_equal (&surface->current_color, &solid->color))
 	{
 	    status = _cairo_pdf_operators_flush (&surface->pdf_operators);
 	    if (status)
@@ -2830,10 +2827,7 @@ _cairo_ps_surface_emit_pattern (cairo_ps_surface_t *surface,
 	    _cairo_ps_surface_emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
 
 	    surface->current_pattern_is_solid_color = TRUE;
-	    surface->current_color_red = solid->color.red;
-	    surface->current_color_green = solid->color.green;
-	    surface->current_color_blue = solid->color.blue;
-	    surface->current_color_alpha = solid->color.alpha;
+	    surface->current_color = solid->color;
 	}
 
 	return CAIRO_STATUS_SUCCESS;
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 91bfa8a..c2d962d 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -134,6 +134,24 @@ struct _cairo_cache {
     int freeze_count;
 };
 
+/* XXX: Right now, the _cairo_color structure puts unpremultiplied
+   color in the doubles and premultiplied color in the shorts. Yes,
+   this is crazy insane, (but at least we don't export this
+   madness). I'm still working on a cleaner API, but in the meantime,
+   at least this does prevent precision loss in color when changing
+   alpha. */
+struct _cairo_color {
+    double red;
+    double green;
+    double blue;
+    double alpha;
+
+    unsigned short red_short;
+    unsigned short green_short;
+    unsigned short blue_short;
+    unsigned short alpha_short;
+};
+
 typedef enum _cairo_paginated_mode {
     CAIRO_PAGINATED_MODE_ANALYZE,	/* analyze page regions */
     CAIRO_PAGINATED_MODE_RENDER,	/* render page contents */
diff --git a/src/cairoint.h b/src/cairoint.h
index bffceb3..654fd19 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -818,24 +818,6 @@ struct _cairo_image_surface {
 
 extern const cairo_private cairo_surface_backend_t _cairo_image_surface_backend;
 
-/* XXX: Right now, the _cairo_color structure puts unpremultiplied
-   color in the doubles and premultiplied color in the shorts. Yes,
-   this is crazy insane, (but at least we don't export this
-   madness). I'm still working on a cleaner API, but in the meantime,
-   at least this does prevent precision loss in color when changing
-   alpha. */
-struct _cairo_color {
-    double red;
-    double green;
-    double blue;
-    double alpha;
-
-    unsigned short red_short;
-    unsigned short green_short;
-    unsigned short blue_short;
-    unsigned short alpha_short;
-};
-
 #define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
 #define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
 #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_GOOD
commit 85ed37da33522efa101eb508a4091bcfa24ae944
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 6 09:10:25 2008 +0100

    [ps] A flattened gradient is not linear.
    
    We cannot express an alpha-gradient as a simple linear interpolation
    between 2 flattened colors. So fallback.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index c31ed2b..bb80651 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1427,6 +1427,10 @@ _gradient_pattern_supported (cairo_ps_surface_t    *surface,
     if (surface->ps_level == CAIRO_PS_LEVEL_2)
 	return FALSE;
 
+    /* alpha-blended gradients cannot be expressed as a linear function */
+    if (! _cairo_pattern_is_opaque (pattern))
+	return FALSE;
+
     surface->ps_level_used = CAIRO_PS_LEVEL_3;
     extend = cairo_pattern_get_extend (pattern);
 
@@ -2413,7 +2417,7 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 
 typedef struct _cairo_ps_color_stop {
     double offset;
-    double color[4];
+    double color[3];
 } cairo_ps_color_stop_t;
 
 static void
@@ -2438,7 +2442,7 @@ _cairo_ps_surface_emit_linear_colorgradient (cairo_ps_surface_t     *surface,
 
 static void
 _cairo_ps_surface_emit_stitched_colorgradient (cairo_ps_surface_t    *surface,
-					       unsigned int 	      n_stops,
+					       unsigned int	      n_stops,
 					       cairo_ps_color_stop_t  stops[])
 {
     unsigned int i;
@@ -2468,11 +2472,14 @@ calc_gradient_color (cairo_ps_color_stop_t *new_stop,
 		     cairo_ps_color_stop_t *stop1,
 		     cairo_ps_color_stop_t *stop2)
 {
-    int i;
     double offset = stop1->offset / (stop1->offset + 1.0 - stop2->offset);
+    double one_minus_offset = 1. - offset;
+    int i;
 
-    for (i = 0; i < 4; i++)
-	new_stop->color[i] = stop1->color[i] + offset*(stop2->color[i] - stop1->color[i]);
+    for (i = 0; i < 3; i++) {
+	new_stop->color[i] = stop1->color[i] * one_minus_offset +
+	                     stop2->color[i] * offset;
+    }
 }
 
 #define COLOR_STOP_EPSILON 1e-6
@@ -2484,7 +2491,8 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t       *surface,
     cairo_ps_color_stop_t *allstops, *stops;
     unsigned int i, n_stops;
 
-    allstops = _cairo_malloc_ab ((pattern->n_stops + 2), sizeof (cairo_ps_color_stop_t));
+    allstops = _cairo_malloc_ab (pattern->n_stops + 2,
+				 sizeof (cairo_ps_color_stop_t));
     if (allstops == NULL)
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
@@ -2497,7 +2505,6 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t       *surface,
 	stops[i].color[0] = stop->color.red;
 	stops[i].color[1] = stop->color.green;
 	stops[i].color[2] = stop->color.blue;
-	stops[i].color[3] = stop->color.alpha;
 	stops[i].offset = pattern->stops[i].offset;
     }
 
@@ -2507,7 +2514,8 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t       *surface,
 	    if (pattern->base.extend == CAIRO_EXTEND_REFLECT)
 		memcpy (allstops, stops, sizeof (cairo_ps_color_stop_t));
 	    else
-		calc_gradient_color (&allstops[0], &stops[0], &stops[n_stops-1]);
+		calc_gradient_color (&allstops[0], &stops[0],
+				     &stops[n_stops-1]);
 	    stops = allstops;
 	    n_stops++;
 	}
@@ -2519,34 +2527,20 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t       *surface,
 			&stops[n_stops - 1],
 			sizeof (cairo_ps_color_stop_t));
 	    } else {
-		calc_gradient_color (&stops[n_stops], &stops[0], &stops[n_stops-1]);
+		calc_gradient_color (&stops[n_stops], &stops[0],
+				     &stops[n_stops-1]);
 	    }
 	    n_stops++;
 	}
 	stops[n_stops-1].offset = 1.0;
     }
 
-    for (i = 0; i < n_stops; i++) {
-	double red, green, blue;
-	cairo_color_t color;
-
-	_cairo_color_init_rgba (&color,
-				stops[i].color[0],
-				stops[i].color[1],
-				stops[i].color[2],
-				stops[i].color[3]);
-	_cairo_ps_surface_flatten_transparency (surface, &color,
-						&red, &green, &blue);
-	stops[i].color[0] = red;
-	stops[i].color[1] = green;
-	stops[i].color[2] = blue;
-    }
-
     _cairo_output_stream_printf (surface->stream,
 				 "/CairoFunction\n");
     if (n_stops == 2) {
 	/* no need for stitched function */
-	_cairo_ps_surface_emit_linear_colorgradient (surface, &stops[0], &stops[1]);
+	_cairo_ps_surface_emit_linear_colorgradient (surface,
+						     &stops[0], &stops[1]);
     } else {
 	/* multiple stops: stitch. XXX possible optimization: regulary spaced
 	 * stops do not require stitching. XXX */
diff --git a/test/Makefile.am b/test/Makefile.am
index 562f4d4..9424d2e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -448,8 +448,6 @@ REFERENCE_IMAGES = \
 	glyph-cache-pressure-quartz-ref.png	\
 	gradient-alpha-pdf-argb32-ref.png	\
 	gradient-alpha-pdf-rgb24-ref.png	\
-	gradient-alpha-ps-argb32-ref.png	\
-	gradient-alpha-ps-rgb24-ref.png	\
 	gradient-alpha-ref.png	\
 	gradient-alpha-rgb24-ref.png	\
 	gradient-zero-stops-ref.png	\
diff --git a/test/clip-operator-ps-argb32-ref.png b/test/clip-operator-ps-argb32-ref.png
deleted file mode 100644
index 35014bd..0000000
Binary files a/test/clip-operator-ps-argb32-ref.png and /dev/null differ
diff --git a/test/clip-operator-ps-rgb24-ref.png b/test/clip-operator-ps-rgb24-ref.png
deleted file mode 100644
index 1736e4b..0000000
Binary files a/test/clip-operator-ps-rgb24-ref.png and /dev/null differ
diff --git a/test/gradient-alpha-ps-argb32-ref.png b/test/gradient-alpha-ps-argb32-ref.png
deleted file mode 100644
index 323238b..0000000
Binary files a/test/gradient-alpha-ps-argb32-ref.png and /dev/null differ
diff --git a/test/gradient-alpha-ps-rgb24-ref.png b/test/gradient-alpha-ps-rgb24-ref.png
deleted file mode 100644
index 430052c..0000000
Binary files a/test/gradient-alpha-ps-rgb24-ref.png and /dev/null differ
diff --git a/test/operator-clear-ps-argb32-ref.png b/test/operator-clear-ps-argb32-ref.png
deleted file mode 100644
index d9a7769..0000000
Binary files a/test/operator-clear-ps-argb32-ref.png and /dev/null differ
diff --git a/test/operator-source-ps-argb32-ref.png b/test/operator-source-ps-argb32-ref.png
deleted file mode 100644
index d5cb053..0000000
Binary files a/test/operator-source-ps-argb32-ref.png and /dev/null differ
diff --git a/test/operator-source-ps-rgb24-ref.png b/test/operator-source-ps-rgb24-ref.png
deleted file mode 100644
index eb73a9e..0000000
Binary files a/test/operator-source-ps-rgb24-ref.png and /dev/null differ
commit c1c86afa877b80a284365bcdaee11986bdd7da1f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 5 05:04:09 2008 +0100

    [ps] Use floating point values when flattening color.
    
    Use the full-precision color values when computing the alpha-blended
    color.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f2c4b73..c31ed2b 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1504,7 +1504,7 @@ _cairo_ps_surface_analyze_operation (cairo_ps_surface_t    *surface,
      * surface. If the analysis surface determines that there is
      * anything drawn under this operation, a fallback image will be
      * used. Otherwise the operation will be replayed during the
-     * render stage and we blend the transarency into the white
+     * render stage and we blend the transparency into the white
      * background to convert the pattern to opaque.
      */
 
@@ -2089,21 +2089,19 @@ _cairo_ps_surface_flatten_transparency (cairo_ps_surface_t	*surface,
 					double			*green,
 					double			*blue)
 {
-    *red = color->red;
+    *red   = color->red;
     *green = color->green;
-    *blue = color->blue;
+    *blue  = color->blue;
 
-    if (!CAIRO_COLOR_IS_OPAQUE(color)) {
+    if (! CAIRO_COLOR_IS_OPAQUE (color)) {
+	*red   *= color->alpha;
+	*green *= color->alpha;
+	*blue  *= color->alpha;
 	if (surface->content == CAIRO_CONTENT_COLOR_ALPHA) {
-	    uint8_t one_minus_alpha = 255 - (color->alpha_short >> 8);
-
-	    *red   = ((color->red_short   >> 8) + one_minus_alpha) / 255.0;
-	    *green = ((color->green_short >> 8) + one_minus_alpha) / 255.0;
-	    *blue  = ((color->blue_short  >> 8) + one_minus_alpha) / 255.0;
-	} else {
-	    *red   = (color->red_short   >> 8) / 255.0;
-	    *green = (color->green_short >> 8) / 255.0;
-	    *blue  = (color->blue_short  >> 8) / 255.0;
+	    double one_minus_alpha = 1. - color->alpha;
+	    *red   += one_minus_alpha;
+	    *green += one_minus_alpha;
+	    *blue  += one_minus_alpha;
 	}
     }
 }
diff --git a/test/Makefile.am b/test/Makefile.am
index fcc1601..562f4d4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -546,6 +546,7 @@ REFERENCE_IMAGES = \
 	over-above-source-ref.png                 \
 	over-above-source-rgb24-ref.png           \
 	over-around-source-ps-argb32-ref.png       \
+	over-around-source-ps-rgb24-ref.png        \
 	over-around-source-quartz-ref.png	   \
 	over-around-source-quartz-rgb24-ref.png	   \
 	over-around-source-ref.png                 \
diff --git a/test/over-around-source-ps-rgb24-ref.png b/test/over-around-source-ps-rgb24-ref.png
new file mode 100644
index 0000000..ee325ea
Binary files /dev/null and b/test/over-around-source-ps-rgb24-ref.png differ
commit e583fb061d2302b94188aabd381c566ac833bd94
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 4 13:47:05 2008 +0100

    [type1] Allocate the temporary subsetter on the stack.
    
    Avoid a reasonably small, short-lived malloc by allocating the
    cairo_type1_font_subset_t on the stack.

diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 8e1d329..a9005d3 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -61,7 +61,6 @@
 #include <ctype.h>
 
 typedef struct _cairo_type1_font_subset {
-
     cairo_scaled_font_subset_t *scaled_font_subset;
 
     struct {
@@ -76,7 +75,6 @@ typedef struct _cairo_type1_font_subset {
 	unsigned long  header_size;
 	unsigned long  data_size;
 	unsigned long  trailer_size;
-
     } base;
 
     FT_Face face;
@@ -115,15 +113,14 @@ typedef struct _cairo_type1_font_subset {
 
 
 static cairo_status_t
-_cairo_type1_font_subset_create (cairo_unscaled_font_t      *unscaled_font,
-				 cairo_type1_font_subset_t **subset_return,
-                                 cairo_bool_t                hex_encode)
+_cairo_type1_font_subset_init (cairo_type1_font_subset_t  *font,
+			       cairo_unscaled_font_t      *unscaled_font,
+			       cairo_bool_t                hex_encode)
 {
     cairo_ft_unscaled_font_t *ft_unscaled_font;
     cairo_status_t status;
     FT_Face face;
     PS_FontInfoRec font_info;
-    cairo_type1_font_subset_t *font;
     int i, j;
 
     ft_unscaled_font = (cairo_ft_unscaled_font_t *) unscaled_font;
@@ -145,12 +142,7 @@ _cairo_type1_font_subset_create (cairo_unscaled_font_t      *unscaled_font,
     }
 #endif
 
-    font = calloc (sizeof (cairo_type1_font_subset_t), 1);
-    if (font == NULL) {
-	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
-        goto fail1;
-    }
-
+    memset (font, 0, sizeof (font));
     font->base.unscaled_font = _cairo_unscaled_font_reference (unscaled_font);
     font->base.num_glyphs = face->num_glyphs;
     font->base.x_min = face->bbox.xMin;
@@ -189,8 +181,6 @@ _cairo_type1_font_subset_create (cairo_unscaled_font_t      *unscaled_font,
 
     _cairo_ft_unscaled_font_unlock_face (ft_unscaled_font);
 
-    *subset_return = font;
-
     return CAIRO_STATUS_SUCCESS;
 
  fail3:
@@ -198,7 +188,6 @@ _cairo_type1_font_subset_create (cairo_unscaled_font_t      *unscaled_font,
 	free (font->base.base_font);
  fail2:
     _cairo_unscaled_font_destroy (unscaled_font);
-    free (font);
  fail1:
     _cairo_ft_unscaled_font_unlock_face (ft_unscaled_font);
 
@@ -1261,9 +1250,8 @@ cairo_type1_font_subset_generate (void       *abstract_font,
 }
 
 static void
-cairo_type1_font_subset_destroy (void *abstract_font)
+_cairo_type1_font_subset_fini (cairo_type1_font_subset_t *font)
 {
-    cairo_type1_font_subset_t *font = abstract_font;
     unsigned int i;
 
     /* If the subset generation failed, some of the pointers below may
@@ -1282,17 +1270,15 @@ cairo_type1_font_subset_destroy (void *abstract_font)
     if (font->base.base_font)
 	free (font->base.base_font);
     free (font->glyphs);
-    free (font);
 }
 
-
 cairo_status_t
 _cairo_type1_subset_init (cairo_type1_subset_t		*type1_subset,
 			  const char			*name,
 			  cairo_scaled_font_subset_t	*scaled_font_subset,
                           cairo_bool_t                   hex_encode)
 {
-    cairo_type1_font_subset_t *font = NULL; /* hide compiler warning */
+    cairo_type1_font_subset_t font;
     cairo_status_t status;
     unsigned long parent_glyph, length;
     unsigned int i;
@@ -1308,21 +1294,21 @@ _cairo_type1_subset_init (cairo_type1_subset_t		*type1_subset,
 
     unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font_subset->scaled_font);
 
-    status = _cairo_type1_font_subset_create (unscaled_font, &font, hex_encode);
+    status = _cairo_type1_font_subset_init (&font, unscaled_font, hex_encode);
     if (status)
 	return status;
 
     for (i = 0; i < scaled_font_subset->num_glyphs; i++) {
 	parent_glyph = scaled_font_subset->glyphs[i];
-	cairo_type1_font_subset_use_glyph (font, parent_glyph);
+	cairo_type1_font_subset_use_glyph (&font, parent_glyph);
     }
 
-    status = cairo_type1_font_subset_generate (font, name);
+    status = cairo_type1_font_subset_generate (&font, name);
     if (status)
 	goto fail1;
 
-    if (font->base.base_font) {
-	type1_subset->base_font = strdup (font->base.base_font);
+    if (font.base.base_font) {
+	type1_subset->base_font = strdup (font.base.base_font);
     } else {
         snprintf(buf, sizeof (buf), "CairoFont-%u-%u",
                  scaled_font_subset->font_id, scaled_font_subset->subset_id);
@@ -1331,37 +1317,38 @@ _cairo_type1_subset_init (cairo_type1_subset_t		*type1_subset,
     if (type1_subset->base_font == NULL)
 	goto fail1;
 
-    type1_subset->widths = calloc (sizeof (int), font->num_glyphs);
+    type1_subset->widths = calloc (sizeof (int), font.num_glyphs);
     if (type1_subset->widths == NULL)
 	goto fail2;
-    for (i = 0; i < font->base.num_glyphs; i++) {
-	if (font->glyphs[i].subset_index < 0)
+    for (i = 0; i < font.base.num_glyphs; i++) {
+	if (font.glyphs[i].subset_index < 0)
 	    continue;
-	type1_subset->widths[font->glyphs[i].subset_index] =
-	    font->glyphs[i].width;
+	type1_subset->widths[font.glyphs[i].subset_index] =
+	    font.glyphs[i].width;
     }
 
-    type1_subset->x_min = font->base.x_min;
-    type1_subset->y_min = font->base.y_min;
-    type1_subset->x_max = font->base.x_max;
-    type1_subset->y_max = font->base.y_max;
-    type1_subset->ascent = font->base.ascent;
-    type1_subset->descent = font->base.descent;
+    type1_subset->x_min = font.base.x_min;
+    type1_subset->y_min = font.base.y_min;
+    type1_subset->x_max = font.base.x_max;
+    type1_subset->y_max = font.base.y_max;
+    type1_subset->ascent = font.base.ascent;
+    type1_subset->descent = font.base.descent;
 
-    length = font->base.header_size + font->base.data_size +
-	font->base.trailer_size;
+    length = font.base.header_size +
+	     font.base.data_size +
+	     font.base.trailer_size;
     type1_subset->data = malloc (length);
     if (type1_subset->data == NULL)
 	goto fail3;
 
     memcpy (type1_subset->data,
-	    _cairo_array_index (&font->contents, 0), length);
+	    _cairo_array_index (&font.contents, 0), length);
 
-    type1_subset->header_length = font->base.header_size;
-    type1_subset->data_length = font->base.data_size;
-    type1_subset->trailer_length = font->base.trailer_size;
+    type1_subset->header_length = font.base.header_size;
+    type1_subset->data_length = font.base.data_size;
+    type1_subset->trailer_length = font.base.trailer_size;
 
-    cairo_type1_font_subset_destroy (font);
+    _cairo_type1_font_subset_fini (&font);
 
     return CAIRO_STATUS_SUCCESS;
 
@@ -1370,7 +1357,7 @@ _cairo_type1_subset_init (cairo_type1_subset_t		*type1_subset,
  fail2:
     free (type1_subset->base_font);
  fail1:
-    cairo_type1_font_subset_destroy (font);
+    _cairo_type1_font_subset_fini (&font);
 
     return status;
 }
commit 0cadd4ab027c3196c8bfa3361f2507ceb62c7876
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 4 10:25:54 2008 +0100

    [CODING_STYLE] Add vim modeline
    
    Add my vim recipe that most closely matches the coding style. If you can
    improve it, please do so!

diff --git a/CODING_STYLE b/CODING_STYLE
index 92536a4..95ceac0 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -269,9 +269,23 @@ In general, be wary of performing any arithmetic operations in an
 argument to malloc.  You should explicitly check for integer overflow
 yourself in any more complex situations.
 
+Mode lines
+----------
+
+So given the rules above, what is the best way to simplify one's life as
+a code monkey? Get your editor to do most of the tedious work of
+beautifying your code!
+
+As a reward for reading this far, here are some mode lines for the more
+popular editors:
+/*
+ * vim:sw=4:sts=4:ts=8:tw=78:fo=tcroq:cindent:cino=\:0,(0
+ * vim:isk=a-z,A-Z,48-57,_,.,-,>
+ */
+
 
 TODO
 ----
 
 Write rules for common editors to use this style.  Also cleanup/unify
-the modlines in the source files.
+the modelines in the source files.


More information about the cairo-commit mailing list