[cairo-commit] cairo/src cairo-meta-surface-private.h, 1.6, 1.7 cairo-meta-surface.c, 1.16, 1.17 cairo-ps-surface.c, 1.59, 1.60 cairo-scaled-font.c, 1.7, 1.8 cairo-surface.c, 1.111, 1.112 cairoint.h, 1.227, 1.228

Carl Worth commit at pdx.freedesktop.org
Tue Nov 8 17:16:24 PST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv609/src

Modified Files:
	cairo-meta-surface-private.h cairo-meta-surface.c 
	cairo-ps-surface.c cairo-scaled-font.c cairo-surface.c 
	cairoint.h 
Log Message:

2005-11-08  Carl Worth  <cworth at cworth.org>

        * src/cairo-meta-surface-private.h:
        * src/cairo-meta-surface.c: (_cairo_meta_surface_finish),
        (_cairo_meta_surface_paint),
        (_cairo_meta_surface_mask), (_cairo_meta_surface_stroke),
        (_cairo_meta_surface_fill), (_cairo_meta_surface_show_glyphs),
        (_cairo_meta_surface_replay): Add support to cairo_meta_surface
        for the 5 basic drawing operations. Remove
        _cairo_meta_surface_get_extents and
        _cairo_meta_surface_old_show_glyphs.

        * src/cairo-meta-surface.c: (_cairo_meta_surface_create),
        (_cairo_meta_surface_create_similar): Remove size for
        _cairo_meta_surface_create. It is no longer needed now that
        get_extents is not a required backend function.

        * src/cairo-ps-surface.c:
        (_cairo_ps_surface_create_for_stream_internal),
        (_cairo_ps_surface_show_page): Track change in
        cairo_meta_surface_create no longer requiring a size

        * src/cairoint.h:
        * src/cairo-scaled-font.c: (_cairo_scaled_font_show_glyphs):
        * src/cairo-surface.c: (_cairo_surface_old_show_glyphs_draw_func),
        (_fallback_show_glyphs), (_cairo_surface_show_glyphs): Qualify the
        glyphs argument to backend->show_glyphs as const.

        * src/cairo-meta-surface.c: (_init_pattern_with_snapshot):
        Whitespace style cleanup.


Index: cairo-meta-surface-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface-private.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cairo-meta-surface-private.h	4 Nov 2005 19:16:39 -0000	1.6
+++ cairo-meta-surface-private.h	9 Nov 2005 01:16:21 -0000	1.7
@@ -40,15 +40,71 @@
 #include "cairo-path-fixed-private.h"
 
 typedef enum {
+    /* The 5 basic drawing operations. */
+    CAIRO_COMMAND_PAINT,
+    CAIRO_COMMAND_MASK,
+    CAIRO_COMMAND_STROKE,
+    CAIRO_COMMAND_FILL,
+    CAIRO_COMMAND_SHOW_GLYPHS,
+
+    /* Other junk. For most of these, we should be able to assert that
+     * they never get called except as part of fallbacks for the 5
+     * basic drawing operations (which we implement already so the
+     * fallbacks should never get triggered). So the plan is to
+     * eliminate as many of these as possible. */
+
     CAIRO_COMMAND_COMPOSITE,
     CAIRO_COMMAND_FILL_RECTANGLES,
     CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS,
     CAIRO_COMMAND_SET_CLIP_REGION,
     CAIRO_COMMAND_INTERSECT_CLIP_PATH,
-    CAIRO_COMMAND_SHOW_GLYPHS,
-    CAIRO_COMMAND_FILL
+    CAIRO_COMMAND_OLD_SHOW_GLYPHS,
 } cairo_command_type_t;
 
+typedef struct _cairo_command_paint {
+    cairo_command_type_t	 type;
+    cairo_operator_t		 operator;
+    cairo_pattern_union_t	 source;
+} cairo_command_paint_t;
+
+typedef struct _cairo_command_mask {
+    cairo_command_type_t	 type;
+    cairo_operator_t		 operator;
+    cairo_pattern_union_t	 source;
+    cairo_pattern_union_t	 mask;
+} cairo_command_mask_t;
+
+typedef struct _cairo_command_stroke {
+    cairo_command_type_t	 type;
+    cairo_operator_t		 operator;
+    cairo_pattern_union_t	 source;
+    cairo_path_fixed_t		 path;
+    cairo_stroke_style_t	 style;
+    cairo_matrix_t		 ctm;
+    cairo_matrix_t		 ctm_inverse;
+    double			 tolerance;
+    cairo_antialias_t		 antialias;
+} cairo_command_stroke_t;
+
+typedef struct _cairo_command_fill {
+    cairo_command_type_t	 type;
+    cairo_operator_t		 operator;
+    cairo_pattern_union_t	 source;
+    cairo_path_fixed_t		 path;
+    cairo_fill_rule_t		 fill_rule;
+    double			 tolerance;
+    cairo_antialias_t		 antialias;
+} cairo_command_fill_t;
+
+typedef struct _cairo_command_show_glyphs {
+    cairo_command_type_t	 type;
+    cairo_operator_t		 operator;
+    cairo_pattern_union_t	 source;
+    cairo_glyph_t		*glyphs;
+    int				 num_glyphs;
+    cairo_scaled_font_t		*scaled_font;
+} cairo_command_show_glyphs_t;
+
 typedef struct _cairo_command_composite {
     cairo_command_type_t	type;
     cairo_operator_t		operator;
@@ -103,50 +159,31 @@
     cairo_antialias_t		antialias;
 } cairo_command_intersect_clip_path_t;
 
-typedef struct _cairo_command_show_glyphs {
-    cairo_command_type_t	type;
-    cairo_scaled_font_t	       *scaled_font;
-    cairo_operator_t		operator;
-    cairo_pattern_union_t	pattern;
-    int				source_x;
-    int				source_y;
-    int				dest_x;
-    int				dest_y;
-    unsigned int		width;
-    unsigned int		height;
-    cairo_glyph_t		*glyphs;
-    int				num_glyphs;
-} cairo_command_show_glyphs_t;
-
-typedef struct _cairo_command_fill {
-    cairo_command_type_t	type;
-    cairo_operator_t		operator;
-    cairo_pattern_union_t	pattern;
-    cairo_path_fixed_t		path;
-    cairo_fill_rule_t		fill_rule;
-    double			tolerance;
-    cairo_antialias_t		antialias;
-} cairo_command_fill_t;
-
 typedef union _cairo_command {
     cairo_command_type_t			type;
+
+    /* The 5 basic drawing operations. */
+    cairo_command_paint_t			paint;
+    cairo_command_mask_t			mask;
+    cairo_command_stroke_t			stroke;
+    cairo_command_fill_t			fill;
+    cairo_command_show_glyphs_t			show_glyphs;
+
+    /* The other junk. */
     cairo_command_composite_t			composite;	
     cairo_command_fill_rectangles_t		fill_rectangles;
     cairo_command_composite_trapezoids_t	composite_trapezoids;
     cairo_command_set_clip_region_t		set_clip_region;
     cairo_command_intersect_clip_path_t		intersect_clip_path;
-    cairo_command_show_glyphs_t			show_glyphs;
-    cairo_command_fill_t			fill;
 } cairo_command_t;
 
 typedef struct _cairo_meta_surface {
     cairo_surface_t base;
-    double width, height;
     cairo_array_t commands;
 } cairo_meta_surface_t;
 
 cairo_private cairo_surface_t *
-_cairo_meta_surface_create (double width, double height);
+_cairo_meta_surface_create (void);
 
 cairo_private cairo_int_status_t
 _cairo_meta_surface_replay (cairo_surface_t *surface,

Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cairo-meta-surface.c	7 Nov 2005 21:23:32 -0000	1.16
+++ cairo-meta-surface.c	9 Nov 2005 01:16:21 -0000	1.17
@@ -31,6 +31,7 @@
  *
  * Contributor(s):
  *	Kristian Høgsberg <krh at redhat.com>
+ *	Carl Worth <cworth at cworth.org>
  */
 
 #include "cairoint.h"
@@ -40,7 +41,7 @@
 static const cairo_surface_backend_t cairo_meta_surface_backend;
 
 cairo_surface_t *
-_cairo_meta_surface_create (double width, double height)
+_cairo_meta_surface_create (void)
 {
     cairo_meta_surface_t *meta;
 
@@ -50,8 +51,6 @@
 	return (cairo_surface_t*) &_cairo_surface_nil;
     }
 
-    meta->width = width;
-    meta->height = height;
     _cairo_surface_init (&meta->base, &cairo_meta_surface_backend);
     _cairo_array_init (&meta->commands, sizeof (cairo_command_t *));
 
@@ -64,7 +63,7 @@
 				    int			width,
 				    int			height)
 {
-    return _cairo_meta_surface_create (width, height);
+    return _cairo_meta_surface_create ();
 }
 
 static cairo_status_t
@@ -80,6 +79,42 @@
     for (i = 0; i < num_elements; i++) {
 	command = elements[i];
 	switch (command->type) {
+
+	/* 5 basic drawing operations */
+
+	case CAIRO_COMMAND_PAINT:
+	    _cairo_pattern_fini (&command->paint.source.base);
+	    free (command);
+	    break;
+
+	case CAIRO_COMMAND_MASK:
+	    _cairo_pattern_fini (&command->mask.source.base);
+	    _cairo_pattern_fini (&command->mask.mask.base);
+	    free (command);
+	    break;
+ 
+	case CAIRO_COMMAND_STROKE:
+	    _cairo_pattern_fini (&command->stroke.source.base);
+	    _cairo_path_fixed_fini (&command->stroke.path);
+	    _cairo_stroke_style_fini (&command->stroke.style);
+	    free (command);
+	    break;
+
+	case CAIRO_COMMAND_FILL:
+	    _cairo_pattern_fini (&command->fill.source.base);
+	    _cairo_path_fixed_fini (&command->fill.path);
+	    free (command);
+	    break;
+
+	case CAIRO_COMMAND_SHOW_GLYPHS:
+	    _cairo_pattern_fini (&command->show_glyphs.source.base);
+	    free (command->show_glyphs.glyphs);
+	    cairo_scaled_font_destroy (command->show_glyphs.scaled_font);
+	    free (command);
+	    break;
+
+	/* Other junk. */
+
 	case CAIRO_COMMAND_COMPOSITE:
 	    _cairo_pattern_fini (&command->composite.src_pattern.base);
 	    if (command->composite.mask_pattern_pointer)
@@ -104,19 +139,6 @@
 	    free (command);
 	    break;
 
-	case CAIRO_COMMAND_SHOW_GLYPHS:
-	    cairo_scaled_font_destroy (command->show_glyphs.scaled_font);
-	    _cairo_pattern_fini (&command->show_glyphs.pattern.base);
-	    free (command->show_glyphs.glyphs);
-	    free (command);
-	    break;
-
-	case CAIRO_COMMAND_FILL:
-	    _cairo_pattern_fini (&command->fill.pattern.base);
-	    _cairo_path_fixed_fini (&command->fill.path);
-	    free (command);
-	    break;
-
 	default:
 	    ASSERT_NOT_REACHED;
 	}
@@ -134,7 +156,8 @@
     _cairo_pattern_init_copy (pattern, other);
 
     if (pattern->type == CAIRO_PATTERN_SURFACE) {
-	cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
+	cairo_surface_pattern_t *surface_pattern =
+	    (cairo_surface_pattern_t *) pattern;
 	cairo_surface_t *surface = surface_pattern->surface;
 
 	surface_pattern->surface = _cairo_surface_snapshot (surface);
@@ -149,6 +172,232 @@
 }
 
 static cairo_int_status_t
+_cairo_meta_surface_paint (void			*abstract_surface,
+			   cairo_operator_t	 operator,
+			   cairo_pattern_t	*source)
+{
+    cairo_status_t status;
+    cairo_meta_surface_t *meta = abstract_surface;
+    cairo_command_paint_t *command;
+
+    command = malloc (sizeof (cairo_command_paint_t));
+    if (command == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
+    command->type = CAIRO_COMMAND_PAINT;
+    command->operator = operator;
+
+    status = _init_pattern_with_snapshot (&command->source.base, source);
+    if (status)
+	goto CLEANUP_COMMAND;
+    
+    status = _cairo_array_append (&meta->commands, &command);
+    if (status)
+	goto CLEANUP_SOURCE;
+
+    return CAIRO_STATUS_SUCCESS;
+
+  CLEANUP_SOURCE:
+    _cairo_pattern_fini (&command->source.base);
+  CLEANUP_COMMAND:
+    free (command);
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_meta_surface_mask (void			*abstract_surface,
+			  cairo_operator_t	 operator,
+			  cairo_pattern_t	*source,
+			  cairo_pattern_t	*mask)
+{
+    cairo_status_t status;
+    cairo_meta_surface_t *meta = abstract_surface;
+    cairo_command_mask_t *command;
+
+    command = malloc (sizeof (cairo_command_mask_t));
+    if (command == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
+    command->type = CAIRO_COMMAND_MASK;
+    command->operator = operator;
+
+    status = _init_pattern_with_snapshot (&command->source.base, source);
+    if (status)
+	goto CLEANUP_COMMAND;
+
+    status = _init_pattern_with_snapshot (&command->mask.base, mask);
+    if (status)
+	goto CLEANUP_SOURCE;
+    
+    status = _cairo_array_append (&meta->commands, &command);
+    if (status)
+	goto CLEANUP_MASK;
+
+    return CAIRO_STATUS_SUCCESS;
+
+  CLEANUP_MASK:
+    _cairo_pattern_fini (&command->mask.base);
+  CLEANUP_SOURCE:
+    _cairo_pattern_fini (&command->source.base);
+  CLEANUP_COMMAND:
+    free (command);
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_meta_surface_stroke (void			*abstract_surface,
+			    cairo_operator_t		 operator,
+			    cairo_pattern_t		*source,
+			    cairo_path_fixed_t		*path,
+			    cairo_stroke_style_t	*style,
+			    cairo_matrix_t		*ctm,
+			    cairo_matrix_t		*ctm_inverse,
+			    double			 tolerance,
+			    cairo_antialias_t		 antialias)
+{
+    cairo_status_t status;
+    cairo_meta_surface_t *meta = abstract_surface;
+    cairo_command_stroke_t *command;
+    
+    command = malloc (sizeof (cairo_command_stroke_t));
+    if (command == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
+    command->type = CAIRO_COMMAND_STROKE;
+    command->operator = operator;
+
+    status = _init_pattern_with_snapshot (&command->source.base, source);
+    if (status)
+	goto CLEANUP_COMMAND;
+
+    status = _cairo_path_fixed_init_copy (&command->path, path);
+    if (status)
+	goto CLEANUP_SOURCE;
+
+    status = _cairo_stroke_style_init_copy (&command->style, style);
+    if (status)
+	goto CLEANUP_PATH;
+
+    command->ctm = *ctm;
+    command->ctm_inverse = *ctm_inverse;
+    command->tolerance = tolerance;
+    command->antialias = antialias;
+
+    status = _cairo_array_append (&meta->commands, &command);
+    if (status)
+	goto CLEANUP_STYLE;
+
+    return CAIRO_STATUS_SUCCESS;
+
+  CLEANUP_STYLE:
+    _cairo_stroke_style_fini (&command->style);
+  CLEANUP_PATH:
+    _cairo_path_fixed_fini (&command->path);
+  CLEANUP_SOURCE:
+    _cairo_pattern_fini (&command->source.base);
+  CLEANUP_COMMAND:
+    free (command);
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_meta_surface_fill (void			*abstract_surface,
+			  cairo_operator_t	 operator,
+			  cairo_pattern_t	*source,
+			  cairo_path_fixed_t	*path,
+			  cairo_fill_rule_t	 fill_rule,
+			  double		 tolerance,
+			  cairo_antialias_t	 antialias)
+{
+    cairo_status_t status;
+    cairo_meta_surface_t *meta = abstract_surface;
+    cairo_command_fill_t *command;
+
+    command = malloc (sizeof (cairo_command_fill_t));
+    if (command == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
+    command->type = CAIRO_COMMAND_FILL;
+    command->operator = operator;
+
+    status = _init_pattern_with_snapshot (&command->source.base, source);
+    if (status)
+	goto CLEANUP_COMMAND;
+
+    status = _cairo_path_fixed_init_copy (&command->path, path);
+    if (status)
+	goto CLEANUP_SOURCE;
+
+    command->fill_rule = fill_rule;
+    command->tolerance = tolerance;
+    command->antialias = antialias;
+
+    status = _cairo_array_append (&meta->commands, &command);
+    if (status)
+	goto CLEANUP_PATH;
+
+    return CAIRO_STATUS_SUCCESS;
+
+  CLEANUP_PATH:
+    _cairo_path_fixed_fini (&command->path);
+  CLEANUP_SOURCE:
+    _cairo_pattern_fini (&command->source.base);
+  CLEANUP_COMMAND:
+    free (command);
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_meta_surface_show_glyphs (void			*abstract_surface,
+				 cairo_operator_t	 operator,
+				 cairo_pattern_t	*source,
+				 const cairo_glyph_t	*glyphs,
+				 int			 num_glyphs,
+				 cairo_scaled_font_t	*scaled_font)
+{
+    cairo_status_t status;
+    cairo_meta_surface_t *meta = abstract_surface;
+    cairo_command_show_glyphs_t *command;
+
+    command = malloc (sizeof (cairo_command_show_glyphs_t));
+    if (command == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
+    command->type = CAIRO_COMMAND_SHOW_GLYPHS;
+    command->operator = operator;
+
+    status = _init_pattern_with_snapshot (&command->source.base, source);
+    if (status)
+	goto CLEANUP_COMMAND;
+
+    command->glyphs = malloc (sizeof (cairo_glyph_t) * num_glyphs);
+    if (command->glyphs == NULL) {
+	status = CAIRO_STATUS_NO_MEMORY;
+	goto CLEANUP_SOURCE;
+    }
+    memcpy (command->glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
+
+    command->num_glyphs = num_glyphs;
+
+    command->scaled_font = cairo_scaled_font_reference (scaled_font);
+
+    status = _cairo_array_append (&meta->commands, &command);
+    if (status)
+	goto CLEANUP_SCALED_FONT;
+
+    return CAIRO_STATUS_SUCCESS;
+
+  CLEANUP_SCALED_FONT:
+    cairo_scaled_font_destroy (command->scaled_font);
+    free (command->glyphs);
+  CLEANUP_SOURCE:
+    _cairo_pattern_fini (&command->source.base);
+  CLEANUP_COMMAND:
+    free (command);
+    return status;
+}
+
+static cairo_int_status_t
 _cairo_meta_surface_composite (cairo_operator_t	operator,
 			       cairo_pattern_t	*src_pattern,
 			       cairo_pattern_t	*mask_pattern,
@@ -345,120 +594,6 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
-static cairo_int_status_t
-_cairo_meta_surface_get_extents (void		   *abstract_surface,
-				 cairo_rectangle_t *rectangle)
-{
-    cairo_meta_surface_t *meta = abstract_surface;
-
-    /* Currently this is used for getting the extents of the surface
-     * before calling cairo_paint().  This is the only this that
-     * requires the meta surface to have an explicit size.  If paint
-     * was just a backend function, this would not be necessary. */
-
-    rectangle->x = 0;
-    rectangle->y = 0;
-    rectangle->width = meta->width;
-    rectangle->height = meta->height;
-    
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_old_show_glyphs (cairo_scaled_font_t	*scaled_font,
-				     cairo_operator_t		 operator,
-				     cairo_pattern_t		*pattern,
-				     void			*abstract_surface,
-				     int			 source_x,
-				     int			 source_y,
-				     int			 dest_x,
-				     int			 dest_y,
-				     unsigned int		 width,
-				     unsigned int		 height,
-				     const cairo_glyph_t	*glyphs,
-				     int			 num_glyphs)
-{
-    cairo_status_t status;
-    cairo_meta_surface_t *meta = abstract_surface;
-    cairo_command_show_glyphs_t *command;
-
-    command = malloc (sizeof (cairo_command_show_glyphs_t));
-    if (command == NULL)
-	return CAIRO_STATUS_NO_MEMORY;
-
-    command->type = CAIRO_COMMAND_SHOW_GLYPHS;
-    command->scaled_font = cairo_scaled_font_reference (scaled_font);
-    command->operator = operator;
-    _init_pattern_with_snapshot (&command->pattern.base, pattern);
-    command->source_x = source_x;
-    command->source_y = source_y;
-    command->dest_x = dest_x;
-    command->dest_y = dest_y;
-    command->width = width;
-    command->height = height;
-
-    command->glyphs = malloc (sizeof (cairo_glyph_t) * num_glyphs);
-    if (command->glyphs == NULL) {
-	_cairo_pattern_fini (&command->pattern.base);
-	free (command);
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-    memcpy (command->glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
-
-    command->num_glyphs = num_glyphs;
-
-    status = _cairo_array_append (&meta->commands, &command);
-    if (status) {
-	_cairo_pattern_fini (&command->pattern.base);
-	free (command->glyphs);
-	free (command);
-	return status;
-    }
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_fill (void			*abstract_surface,
-			  cairo_operator_t	 operator,
-			  cairo_pattern_t	*pattern,
-			  cairo_path_fixed_t	*path,
-			  cairo_fill_rule_t	 fill_rule,
-			  double		 tolerance,
-			  cairo_antialias_t	 antialias)
-{
-    cairo_meta_surface_t *meta = abstract_surface;
-    cairo_command_fill_t *command;
-    cairo_status_t status;
-
-    command = malloc (sizeof (cairo_command_fill_t));
-    if (command == NULL)
-	return CAIRO_STATUS_NO_MEMORY;
-
-    command->type = CAIRO_COMMAND_FILL;
-    command->operator = operator;
-    _init_pattern_with_snapshot (&command->pattern.base, pattern);
-    status = _cairo_path_fixed_init_copy (&command->path, path);
-    if (status) {
-	_cairo_pattern_fini (&command->pattern.base);
-	free (command);
-	return CAIRO_STATUS_NO_MEMORY;
-    }	
-    command->fill_rule = fill_rule;
-    command->tolerance = tolerance;
-    command->antialias = antialias;
-
-    status = _cairo_array_append (&meta->commands, &command);
-    if (status) {
-	_cairo_path_fixed_fini (&command->path);
-	_cairo_pattern_fini (&command->pattern.base);
-	free (command);
-	return status;
-    }
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
 /**
  * _cairo_surface_is_meta:
  * @surface: a #cairo_surface_t
@@ -488,23 +623,23 @@
     NULL, /* show_page */
     NULL, /* set_clip_region */
     _cairo_meta_surface_intersect_clip_path,
-    _cairo_meta_surface_get_extents,
-    _cairo_meta_surface_old_show_glyphs,
+    NULL, /* get_extents */
+    NULL, /* old_show_glyphs */
     NULL, /* get_font_options */
     NULL, /* flush */
     NULL, /* mark_dirty_rectangle */
     NULL, /* scaled_font_fini */
     NULL, /* scaled_glyph_fini */
 
-    /* Here are the drawing functions, (which are in some sense the
-     * only things that cairo_meta_surface should need to
+    /* Here are the 5 basic drawing operations, (which are in some
+     * sense the only things that cairo_meta_surface should need to
      * implement). */
     
-    NULL, /* paint */
-    NULL, /* mask */
-    NULL, /* stroke */
+    _cairo_meta_surface_paint,
+    _cairo_meta_surface_mask,
+    _cairo_meta_surface_stroke,
     _cairo_meta_surface_fill,
-    NULL  /* show_glyphs */
+    _cairo_meta_surface_show_glyphs
 };
 
 cairo_int_status_t
@@ -515,7 +650,6 @@
     cairo_command_t *command, **elements;
     int i, num_elements;
     cairo_int_status_t status;
-    cairo_traps_t traps;
     cairo_clip_t clip;
 
     meta = (cairo_meta_surface_t *) surface;
@@ -528,6 +662,70 @@
     for (i = 0; i < num_elements; i++) {
 	command = elements[i];
 	switch (command->type) {
+	case CAIRO_COMMAND_PAINT:
+	    status = _cairo_surface_set_clip (target, &clip);
+	    if (status)
+		break;
+
+	    status = _cairo_surface_paint (target,
+					   command->paint.operator,
+					   &command->paint.source.base);
+	    break;
+
+	case CAIRO_COMMAND_MASK:
+	    status = _cairo_surface_set_clip (target, &clip);
+	    if (status)
+		break;
+
+	    status = _cairo_surface_mask (target,
+					  command->mask.operator,
+					  &command->mask.source.base,
+					  &command->mask.mask.base);
+	    break;
+
+	case CAIRO_COMMAND_STROKE:
+	    status = _cairo_surface_set_clip (target, &clip);
+	    if (status)
+		break;
+
+	    status = _cairo_surface_stroke (target,
+					    command->stroke.operator,
+					    &command->stroke.source.base,
+					    &command->stroke.path,
+					    &command->stroke.style,
+					    &command->stroke.ctm,
+					    &command->stroke.ctm_inverse,
+					    command->stroke.tolerance,
+					    command->stroke.antialias);
+	    break;
+
+	case CAIRO_COMMAND_FILL:
+	    status = _cairo_surface_set_clip (target, &clip);
+	    if (status)
+		break;
+
+	    status = _cairo_surface_fill (target,
+					  command->fill.operator,
+					  &command->fill.source.base,
+					  &command->fill.path,
+					  command->fill.fill_rule,
+					  command->fill.tolerance,
+					  command->fill.antialias);
+	    break;
+
+	case CAIRO_COMMAND_SHOW_GLYPHS:
+	    status = _cairo_surface_set_clip (target, &clip);
+	    if (status)
+		break;
+
+	    status = _cairo_surface_show_glyphs	(target,
+						 command->show_glyphs.operator,
+						 &command->show_glyphs.source.base,
+						 command->show_glyphs.glyphs,
+						 command->show_glyphs.num_glyphs,
+						 command->show_glyphs.scaled_font);
+	    break;
+
 	case CAIRO_COMMAND_COMPOSITE:
 	    status = _cairo_surface_set_clip (target, &clip);
 	    if (status)
@@ -595,79 +793,6 @@
 					   target);
 	    break;
 
-	case CAIRO_COMMAND_SHOW_GLYPHS:
-	    status = _cairo_surface_set_clip (target, &clip);
-	    if (status)
-		break;
-
-	    status = _cairo_surface_old_show_glyphs
-		(command->show_glyphs.scaled_font,
-		 command->show_glyphs.operator,
-		 &command->show_glyphs.pattern.base,
-		 target,
-		 command->show_glyphs.source_x,
-		 command->show_glyphs.source_y,
-		 command->show_glyphs.dest_x,
-		 command->show_glyphs.dest_y,
-		 command->show_glyphs.width,
-		 command->show_glyphs.height,
-		 command->show_glyphs.glyphs,
-		 command->show_glyphs.num_glyphs);
-	    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-		break;
-	    
-	    status = (*command->show_glyphs.scaled_font->backend->
-		      show_glyphs) (command->show_glyphs.scaled_font,
-				    command->show_glyphs.operator,
-				    &command->show_glyphs.pattern.base,
-				    target,
-				    command->show_glyphs.source_x,
-				    command->show_glyphs.source_y,
-				    command->show_glyphs.dest_x,
-				    command->show_glyphs.dest_y,
-				    command->show_glyphs.width,
-				    command->show_glyphs.height,
-				    command->show_glyphs.glyphs,
-				    command->show_glyphs.num_glyphs);
-
-	    break;
-
-	case CAIRO_COMMAND_FILL:
-	    status = _cairo_surface_set_clip (target, &clip);
-	    if (status)
-		break;
-
-	    status = _cairo_surface_fill (target,
-					  command->fill.operator,
-					  &command->fill.pattern.base,
-					  &command->fill.path,
-					  command->fill.fill_rule,
-					  command->fill.tolerance,
-					  command->fill.antialias);
-	    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-		break;
-
-	    _cairo_traps_init (&traps);
-
-	    status = _cairo_path_fixed_fill_to_traps (&command->fill.path,
-						      command->fill.fill_rule,
-						      command->fill.tolerance,
-						      &traps);
-	    if (status) {
-		_cairo_traps_fini (&traps);
-		break;
-	    }
-
-	    status = _cairo_surface_clip_and_composite_trapezoids (&command->fill.pattern.base,
-								   command->fill.operator,
-								   target,
-								   &traps,
-								   &clip,
-								   command->fill.antialias);
-
-	    _cairo_traps_fini (&traps);
-	    break;
-
 	default:
 	    ASSERT_NOT_REACHED;
 	}

Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-ps-surface.c	6 Nov 2005 06:43:06 -0000	1.59
+++ cairo-ps-surface.c	9 Nov 2005 01:16:21 -0000	1.60
@@ -106,8 +106,7 @@
     surface->base.device_x_scale = surface->x_dpi / 72.0;
     surface->base.device_y_scale = surface->y_dpi / 72.0;
 
-    surface->current_page = _cairo_meta_surface_create (width,
-							height);
+    surface->current_page = _cairo_meta_surface_create ();
     if (surface->current_page->status) {
 	free (surface);
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
@@ -344,8 +343,7 @@
     if (status)
 	return status;
 
-    surface->current_page = _cairo_meta_surface_create (surface->width,
-							surface->height);
+    surface->current_page = _cairo_meta_surface_create ();
     if (surface->current_page->status)
 	return CAIRO_STATUS_NO_MEMORY;
 

Index: cairo-scaled-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-scaled-font.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cairo-scaled-font.c	13 Sep 2005 22:53:19 -0000	1.7
+++ cairo-scaled-font.c	9 Nov 2005 01:16:21 -0000	1.8
@@ -785,7 +785,7 @@
 				int			dest_y,
 				unsigned int		width,
 				unsigned int		height,
-				cairo_glyph_t          *glyphs,
+				const cairo_glyph_t    *glyphs,
 				int                     num_glyphs)
 {
     cairo_status_t status;

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- cairo-surface.c	4 Nov 2005 19:16:39 -0000	1.111
+++ cairo-surface.c	9 Nov 2005 01:16:21 -0000	1.112
@@ -1826,7 +1826,7 @@
 
 typedef struct {
     cairo_scaled_font_t *font;
-    cairo_glyph_t *glyphs;
+    const cairo_glyph_t *glyphs;
     int num_glyphs;
 } cairo_show_glyphs_info_t;
 
@@ -1852,8 +1852,8 @@
 	
 	for (i = 0; i < glyph_info->num_glyphs; ++i)
 	{
-	    glyph_info->glyphs[i].x -= dst_x;
-	    glyph_info->glyphs[i].y -= dst_y;
+	    ((cairo_glyph_t *) glyph_info->glyphs)[i].x -= dst_x;
+	    ((cairo_glyph_t *) glyph_info->glyphs)[i].y -= dst_y;
 	}
     }
 
@@ -1893,7 +1893,7 @@
 _fallback_show_glyphs (cairo_surface_t		*surface,
 		       cairo_operator_t		 operator,
 		       cairo_pattern_t		*source,
-		       cairo_glyph_t		*glyphs,
+		       const cairo_glyph_t	*glyphs,
 		       int			 num_glyphs,
 		       cairo_scaled_font_t	*scaled_font)
 {
@@ -1939,7 +1939,7 @@
 _cairo_surface_show_glyphs (cairo_surface_t	*surface,
 			    cairo_operator_t	 operator,
 			    cairo_pattern_t	*source,
-			    cairo_glyph_t	*glyphs,
+			    const cairo_glyph_t	*glyphs,
 			    int			 num_glyphs,
 			    cairo_scaled_font_t	*scaled_font)
 {

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -d -r1.227 -r1.228
--- cairoint.h	7 Nov 2005 21:23:32 -0000	1.227
+++ cairoint.h	9 Nov 2005 01:16:21 -0000	1.228
@@ -787,7 +787,7 @@
     (*show_glyphs)		(void			*surface,
 				 cairo_operator_t	 operator,
 				 cairo_pattern_t	*source,
-				 cairo_glyph_t		*glyphs,
+				 const cairo_glyph_t	*glyphs,
 				 int			 num_glyphs,
 				 cairo_scaled_font_t	*scaled_font);
 };
@@ -1528,7 +1528,7 @@
 				int		     dest_y,
 				unsigned int	     width,
 				unsigned int	     height,
-				cairo_glyph_t	    *glyphs,
+				const cairo_glyph_t *glyphs,
 				int		     num_glyphs);
 
 cairo_private cairo_status_t
@@ -1651,7 +1651,7 @@
 		       cairo_operator_t		 operator,
 		       cairo_pattern_t		*source,
 		       cairo_path_fixed_t	*path,
-		       cairo_stroke_style_t	*stroke_style,
+		       cairo_stroke_style_t	*style,
 		       cairo_matrix_t		*ctm,
 		       cairo_matrix_t		*ctm_inverse,
 		       double			 tolerance,
@@ -1670,7 +1670,7 @@
 _cairo_surface_show_glyphs (cairo_surface_t	*surface,
 			    cairo_operator_t	 operator,
 			    cairo_pattern_t	*source,
-			    cairo_glyph_t	*glyphs,
+			    const cairo_glyph_t	*glyphs,
 			    int			 num_glyphs,
 			    cairo_scaled_font_t	*scaled_font);
   



More information about the cairo-commit mailing list