[cairo-commit] cairo/src cairo-atsui-font.c, 1.24, 1.25 cairo-glitz-surface.c, 1.64, 1.65 cairo-gstate.c, 1.177, 1.178 cairo-image-surface.c, 1.64, 1.65 cairo-meta-surface.c, 1.12, 1.13 cairo-pdf-surface.c, 1.65, 1.66 cairo-ps-surface.c, 1.55, 1.56 cairo-quartz-surface.c, 1.20, 1.21 cairo-surface.c, 1.109, 1.110 cairo-win32-surface.c, 1.36, 1.37 cairo-xcb-surface.c, 1.50, 1.51 cairo-xlib-surface.c, 1.125, 1.126 cairoint.h, 1.221, 1.222

Carl Worth commit at pdx.freedesktop.org
Tue Nov 1 16:40:39 PST 2005


Committed by: cworth

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

Modified Files:
	cairo-atsui-font.c cairo-glitz-surface.c cairo-gstate.c 
	cairo-image-surface.c cairo-meta-surface.c cairo-pdf-surface.c 
	cairo-ps-surface.c cairo-quartz-surface.c cairo-surface.c 
	cairo-win32-surface.c cairo-xcb-surface.c cairo-xlib-surface.c 
	cairoint.h 
Log Message:

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

        Reviewed by: keithp

        * src/cairoint.h:
        * src/cairo-atsui-font.c: (_cairo_atsui_font_old_show_glyphs):
        * src/cairo-glitz-surface.c: (_cairo_glitz_surface_old_show_glyphs):
        * src/cairo-image-surface.c:
        * src/cairo-meta-surface.c: (_cairo_meta_surface_old_show_glyphs),
        (_cairo_meta_surface_replay):
        * src/cairo-pdf-surface.c: (_cairo_pdf_surface_old_show_glyphs):
        * src/cairo-ps-surface.c: (_cairo_ps_surface_old_show_glyphs),
        (_ps_output_old_show_glyphs):
        * src/cairo-quartz-surface.c:
        * src/cairo-win32-surface.c:
        * src/cairo-xcb-surface.c:
        * src/cairo-xlib-surface.c: (_cairo_xlib_surface_old_show_glyphs8),
        (_cairo_xlib_surface_old_show_glyphs16),
        (_cairo_xlib_surface_old_show_glyphs32),
        (_cairo_xlib_surface_old_show_glyphs):
        Rename surface->backend->show_glyphs to surface->backend->old_show_glyphs.

        * src/cairoint.h:
        * src/cairo-gstate.c: (_cairo_gstate_show_glyphs):
        * src/cairo-surface.c: (_cairo_surface_old_show_glyphs_draw_func),
        (_fallback_show_glyphs), (_cairo_surface_show_glyphs),
        (_cairo_surface_old_show_glyphs):
        Move show_glyphs fallback from gstate to surface where it belongs.


Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cairo-atsui-font.c	30 Sep 2005 15:31:36 -0000	1.24
+++ cairo-atsui-font.c	2 Nov 2005 00:40:37 -0000	1.25
@@ -541,18 +541,18 @@
 }
 
 static cairo_int_status_t 
-_cairo_atsui_font_show_glyphs (void		       *abstract_font,
-			       cairo_operator_t    	operator,
-			       cairo_pattern_t          *pattern,
-			       cairo_surface_t          *generic_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_atsui_font_old_show_glyphs (void		       *abstract_font,
+				   cairo_operator_t    	operator,
+				   cairo_pattern_t     *pattern,
+				   cairo_surface_t     *generic_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_atsui_font_t *font = abstract_font;
     CGContextRef myBitmapContext;
@@ -641,6 +641,6 @@
     _cairo_atsui_font_scaled_glyph_init,
     _cairo_atsui_font_text_to_glyphs,
     NULL, /* ucs4_to_index */
-    _cairo_atsui_font_show_glyphs,
+    _cairo_atsui_font_old_show_glyphs,
 };
 

Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- cairo-glitz-surface.c	10 Oct 2005 19:45:15 -0000	1.64
+++ cairo-glitz-surface.c	2 Nov 2005 00:40:37 -0000	1.65
@@ -1859,18 +1859,18 @@
 #define N_STACK_BUF 256
 
 static cairo_int_status_t
-_cairo_glitz_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
-				  cairo_operator_t    op,
-				  cairo_pattern_t     *pattern,
-				  void		      *abstract_surface,
-				  int		      src_x,
-				  int		      src_y,
-				  int		      dst_x,
-				  int		      dst_y,
-				  unsigned int	      width,
-				  unsigned int	      height,
-				  const cairo_glyph_t *glyphs,
-				  int		      num_glyphs)
+_cairo_glitz_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
+				      cairo_operator_t     op,
+				      cairo_pattern_t     *pattern,
+				      void		  *abstract_surface,
+				      int		   src_x,
+				      int		   src_y,
+				      int		   dst_x,
+				      int		   dst_y,
+				      unsigned int	   width,
+				      unsigned int	   height,
+				      const cairo_glyph_t *glyphs,
+				      int		   num_glyphs)
 {
     cairo_glitz_surface_attributes_t	attributes;
     cairo_glitz_surface_glyph_private_t *glyph_private;
@@ -2127,7 +2127,7 @@
     _cairo_glitz_surface_set_clip_region,
     NULL, /* intersect_clip_path */
     _cairo_glitz_surface_get_extents,
-    _cairo_glitz_surface_show_glyphs,
+    _cairo_glitz_surface_old_show_glyphs,
     NULL, /* fill_path */
     NULL, /* get_font_options */
     NULL, /* flush */

Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- cairo-gstate.c	1 Nov 2005 00:55:21 -0000	1.177
+++ cairo-gstate.c	2 Nov 2005 00:40:37 -0000	1.178
@@ -1936,80 +1936,15 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
-typedef struct {
-    cairo_scaled_font_t *font;
-    cairo_glyph_t *glyphs;
-    int num_glyphs;
-} cairo_show_glyphs_info_t;
-
-static cairo_status_t
-_cairo_gstate_show_glyphs_draw_func (void                    *closure,
-				     cairo_operator_t         operator,
-				     cairo_pattern_t         *src,
-				     cairo_surface_t         *dst,
-				     int                      dst_x,
-				     int                      dst_y,
-				     const cairo_rectangle_t *extents)
-{
-    cairo_show_glyphs_info_t *glyph_info = closure;
-    cairo_pattern_union_t pattern;
-    cairo_status_t status;
-
-    /* Modifying the glyph array is fine because we know that this function
-     * will be called only once, and we've already made a copy of the
-     * glyphs in the wrapper.
-     */
-    if (dst_x != 0 || dst_y != 0) {
-	int i;
-	
-	for (i = 0; i < glyph_info->num_glyphs; ++i)
-	{
-	    glyph_info->glyphs[i].x -= dst_x;
-	    glyph_info->glyphs[i].y -= dst_y;
-	}
-    }
-
-    _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
-    if (!src)
-	src = &pattern.base;
-    
-    status = _cairo_surface_show_glyphs (glyph_info->font, operator, src, 
-					 dst,
-					 extents->x, extents->y,
-					 extents->x - dst_x, extents->y - dst_y,
-					 extents->width,     extents->height,
-					 glyph_info->glyphs,
-					 glyph_info->num_glyphs);
-
-    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-	return status;
-    
-    status = _cairo_scaled_font_show_glyphs (glyph_info->font, 
-					     operator, 
-					     src, dst,
-					     extents->x,         extents->y,
-					     extents->x - dst_x, extents->y - dst_y,
-					     extents->width,     extents->height,
-					     glyph_info->glyphs,
-					     glyph_info->num_glyphs);
-
-    if (src == &pattern.base)
-	_cairo_pattern_fini (&pattern.base);
-
-    return status;
-}
-
 cairo_status_t
 _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, 
 			   cairo_glyph_t *glyphs, 
 			   int num_glyphs)
 {
     cairo_status_t status;
+    cairo_pattern_union_t source_pattern;
+    cairo_glyph_t *transformed_glyphs;
     int i;
-    cairo_glyph_t *transformed_glyphs = NULL;
-    cairo_pattern_union_t pattern;
-    cairo_rectangle_t extents;
-    cairo_show_glyphs_info_t glyph_info;
 
     if (gstate->source->status)
 	return gstate->source->status;
@@ -2021,7 +1956,7 @@
     status = _cairo_gstate_ensure_scaled_font (gstate);
     if (status)
 	return status;
-    
+
     transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
     if (transformed_glyphs == NULL)
 	return CAIRO_STATUS_NO_MEMORY;
@@ -2034,38 +1969,18 @@
 				       &transformed_glyphs[i].y);
     }
 
-    if (_cairo_operator_bounded_by_mask (gstate->operator))
-	status = _cairo_scaled_font_glyph_device_extents (gstate->scaled_font,
-							  transformed_glyphs, 
-							  num_glyphs, 
-							  &extents);
-    else
-	status = _cairo_surface_get_extents (gstate->target, &extents);
-
-    if (status)
-        goto CLEANUP_GLYPHS;
-    
-    status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &extents);
-    if (status)
-	goto CLEANUP_GLYPHS;
-    
-    _cairo_gstate_copy_transformed_source (gstate, &pattern.base);
+    _cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
 
-    glyph_info.font = gstate->scaled_font;
-    glyph_info.glyphs = transformed_glyphs;
-    glyph_info.num_glyphs = num_glyphs;
-    
-    status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator,
-					       &pattern.base,
-					       _cairo_gstate_show_glyphs_draw_func, &glyph_info,
-					       gstate->target,
-					       &extents);
+    status = _cairo_surface_show_glyphs (gstate->operator,
+					 &source_pattern.base,
+					 gstate->target,
+					 gstate->scaled_font,
+					 transformed_glyphs,
+					 num_glyphs);
 
-    _cairo_pattern_fini (&pattern.base);
-    
- CLEANUP_GLYPHS:
+    _cairo_pattern_fini (&source_pattern.base);
     free (transformed_glyphs);
-    
+
     return status;
 }
 

Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- cairo-image-surface.c	29 Oct 2005 03:41:22 -0000	1.64
+++ cairo-image-surface.c	2 Nov 2005 00:40:37 -0000	1.65
@@ -872,5 +872,5 @@
     _cairo_image_abstract_surface_set_clip_region,
     NULL, /* intersect_clip_path */
     _cairo_image_abstract_surface_get_extents,
-    NULL /* show_glyphs */
+    NULL /* old_show_glyphs */
 };

Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cairo-meta-surface.c	1 Nov 2005 00:55:21 -0000	1.12
+++ cairo-meta-surface.c	2 Nov 2005 00:40:37 -0000	1.13
@@ -349,18 +349,18 @@
 }
 
 static cairo_int_status_t
-_cairo_meta_surface_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_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_meta_surface_t *meta = abstract_surface;
     cairo_command_show_glyphs_t *command;
@@ -470,7 +470,7 @@
     NULL, /* set_clip_region */
     _cairo_meta_surface_intersect_clip_path,
     _cairo_meta_surface_get_extents,
-    _cairo_meta_surface_show_glyphs,
+    _cairo_meta_surface_old_show_glyphs,
     _cairo_meta_surface_fill_path,
 };
 
@@ -567,7 +567,7 @@
 	    if (status)
 		break;
 
-	    status = _cairo_surface_show_glyphs
+	    status = _cairo_surface_old_show_glyphs
 		(command->show_glyphs.scaled_font,
 		 command->show_glyphs.operator,
 		 &command->show_glyphs.pattern.base,

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cairo-pdf-surface.c	14 Oct 2005 03:15:29 -0000	1.65
+++ cairo-pdf-surface.c	2 Nov 2005 00:40:37 -0000	1.66
@@ -1426,18 +1426,18 @@
 }
 
 static cairo_int_status_t
-_cairo_pdf_surface_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_pdf_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_pdf_surface_t *surface = abstract_surface;
     cairo_pdf_document_t *document = surface->document;
@@ -1573,7 +1573,7 @@
     NULL, /* set_clip_region */
     _cairo_pdf_surface_intersect_clip_path,
     _cairo_pdf_surface_get_extents,
-    _cairo_pdf_surface_show_glyphs,
+    _cairo_pdf_surface_old_show_glyphs,
     _cairo_pdf_surface_fill_path,
     _cairo_pdf_surface_get_font_options
 };

Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- cairo-ps-surface.c	18 Oct 2005 23:09:21 -0000	1.55
+++ cairo-ps-surface.c	2 Nov 2005 00:40:37 -0000	1.56
@@ -419,18 +419,18 @@
 }
 
 static cairo_int_status_t
-_cairo_ps_surface_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_ps_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_ps_surface_t *surface = abstract_surface;
     cairo_font_subset_t *subset;
@@ -448,18 +448,18 @@
     for (i = 0; i < num_glyphs; i++)
 	_cairo_font_subset_use_glyph (subset, glyphs[i].index);
 
-    return _cairo_surface_show_glyphs (scaled_font,
-				       operator,
-				       pattern,
-				       surface->current_page,
-				       source_x,
-				       source_y,
-				       dest_x,
-				       dest_y,
-				       width,
-				       height,
-				       glyphs,
-				       num_glyphs);
+    return _cairo_surface_old_show_glyphs (scaled_font,
+					   operator,
+					   pattern,
+					   surface->current_page,
+					   source_x,
+					   source_y,
+					   dest_x,
+					   dest_y,
+					   width,
+					   height,
+					   glyphs,
+					   num_glyphs);
 }
 
 static cairo_int_status_t
@@ -511,7 +511,7 @@
     NULL, /* set_clip_region */
     _cairo_ps_surface_intersect_clip_path,
     _cairo_ps_surface_get_extents,
-    _cairo_ps_surface_show_glyphs,
+    _cairo_ps_surface_old_show_glyphs,
     _cairo_ps_surface_fill_path
 };
 
@@ -1309,18 +1309,18 @@
 
 
 static cairo_int_status_t
-_ps_output_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)
+_ps_output_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)
 {
     ps_output_surface_t *surface = abstract_surface;
     cairo_output_stream_t *stream = surface->parent->stream;
@@ -1338,7 +1338,7 @@
 	return _ps_output_add_fallback_area (surface, dest_x, dest_y, width, height);
 
     _cairo_output_stream_printf (stream,
-				 "%% _ps_output_show_glyphs\n");
+				 "%% _ps_output_old_show_glyphs\n");
 
     emit_pattern (surface->parent, pattern);
 
@@ -1442,7 +1442,7 @@
     NULL, /* set_clip_region */
     _ps_output_intersect_clip_path,
     NULL, /* get_extents */
-    _ps_output_show_glyphs,
+    _ps_output_old_show_glyphs,
     _ps_output_fill_path
 };
 

Index: cairo-quartz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-quartz-surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cairo-quartz-surface.c	18 Aug 2005 21:34:10 -0000	1.20
+++ cairo-quartz-surface.c	2 Nov 2005 00:40:37 -0000	1.21
@@ -222,7 +222,7 @@
     _cairo_quartz_surface_set_clip_region,
     NULL, /* intersect_clip_path */
     _cairo_quartz_surface_get_extents,
-    NULL  /* show_glyphs */
+    NULL  /* old_show_glyphs */
 };
 
 

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- cairo-surface.c	1 Nov 2005 18:33:34 -0000	1.109
+++ cairo-surface.c	2 Nov 2005 00:40:37 -0000	1.110
@@ -1849,19 +1849,162 @@
     return surface->backend->get_extents (surface, rectangle);
 }
 
+typedef struct {
+    cairo_scaled_font_t *font;
+    cairo_glyph_t *glyphs;
+    int num_glyphs;
+} cairo_show_glyphs_info_t;
+
+static cairo_status_t
+_cairo_surface_old_show_glyphs_draw_func (void                    *closure,
+					  cairo_operator_t         operator,
+					  cairo_pattern_t         *src,
+					  cairo_surface_t         *dst,
+					  int                      dst_x,
+					  int                      dst_y,
+					  const cairo_rectangle_t *extents)
+{
+    cairo_show_glyphs_info_t *glyph_info = closure;
+    cairo_pattern_union_t pattern;
+    cairo_status_t status;
+
+    /* Modifying the glyph array is fine because we know that this function
+     * will be called only once, and we've already made a copy of the
+     * glyphs in the wrapper.
+     */
+    if (dst_x != 0 || dst_y != 0) {
+	int i;
+	
+	for (i = 0; i < glyph_info->num_glyphs; ++i)
+	{
+	    glyph_info->glyphs[i].x -= dst_x;
+	    glyph_info->glyphs[i].y -= dst_y;
+	}
+    }
+
+    _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
+    if (!src)
+	src = &pattern.base;
+    
+    status = _cairo_surface_old_show_glyphs (glyph_info->font, operator, src, 
+					     dst,
+					     extents->x, extents->y,
+					     extents->x - dst_x,
+					     extents->y - dst_y,
+					     extents->width,
+					     extents->height,
+					     glyph_info->glyphs,
+					     glyph_info->num_glyphs);
+
+    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+	return status;
+    
+    status = _cairo_scaled_font_show_glyphs (glyph_info->font, 
+					     operator, 
+					     src, dst,
+					     extents->x,         extents->y,
+					     extents->x - dst_x, extents->y - dst_y,
+					     extents->width,     extents->height,
+					     glyph_info->glyphs,
+					     glyph_info->num_glyphs);
+
+    if (src == &pattern.base)
+	_cairo_pattern_fini (&pattern.base);
+
+    return status;
+}
+
+static cairo_status_t
+_fallback_show_glyphs (cairo_operator_t		 operator,
+		       cairo_pattern_t		*source_pattern,
+		       cairo_surface_t		*dst,
+		       cairo_scaled_font_t	*scaled_font,
+		       cairo_glyph_t		*glyphs,
+		       int			 num_glyphs)
+{
+    cairo_status_t status;
+    cairo_rectangle_t extents, glyph_extents;
+    cairo_show_glyphs_info_t glyph_info;
+
+    status = _cairo_surface_get_extents (dst, &extents);
+    if (status)
+	return status;
+
+    if (_cairo_operator_bounded_by_mask (operator)) {
+	status = _cairo_scaled_font_glyph_device_extents (scaled_font,
+							  glyphs, 
+							  num_glyphs, 
+							  &glyph_extents);
+	if (status)
+	    return status;
+
+	_cairo_rectangle_intersect (&extents, &glyph_extents);
+    }
+    
+    status = _cairo_clip_intersect_to_rectangle (dst->clip, &extents);
+    if (status)
+	return status;
+    
+    glyph_info.font = scaled_font;
+    glyph_info.glyphs = glyphs;
+    glyph_info.num_glyphs = num_glyphs;
+    
+    status = _cairo_gstate_clip_and_composite (dst->clip,
+					       operator,
+					       source_pattern,
+					       _cairo_surface_old_show_glyphs_draw_func,
+					       &glyph_info,
+					       dst,
+					       &extents);
+    
+    return status;
+}
+
 cairo_status_t
-_cairo_surface_show_glyphs (cairo_scaled_font_t	        *scaled_font,
-			    cairo_operator_t		operator,
-			    cairo_pattern_t		*pattern,
-			    cairo_surface_t		*dst,
-			    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_surface_show_glyphs (cairo_operator_t	 operator,
+			    cairo_pattern_t	*source_pattern,
+			    cairo_surface_t	*dst,
+			    cairo_scaled_font_t	*scaled_font,
+			    cairo_glyph_t	*glyphs,
+			    int			 num_glyphs)
+{
+    /* cairo_status_t status; */
+
+    assert (! dst->is_snapshot);
+
+    /* XXX: Need to add this to the backend.
+    if (dst->backend->show_glyphs) {
+	status = dst->backend->show_glyphs (operator, source_pattern, dst,
+					    scaled_font,
+					    glyphs, num_glyphs);
+	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+	    return status;
+    }
+    */
+
+    return _fallback_show_glyphs (operator, source_pattern, dst,
+				  scaled_font,
+				  glyphs, num_glyphs);
+}
+
+/* XXX: Previously, we had a function named _cairo_surface_show_glyphs
+ * with not-so-useful semantics. We've now got a new
+ * _cairo_surface_show_glyphs with the proper semantics, and its
+ * fallback still uses this old function (which still needs to be
+ * cleaned up in terms of both semantics and naming). */
+cairo_status_t
+_cairo_surface_old_show_glyphs (cairo_scaled_font_t	*scaled_font,
+				cairo_operator_t	 operator,
+				cairo_pattern_t		*pattern,
+				cairo_surface_t		*dst,
+				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;
 
@@ -1873,12 +2016,13 @@
     if (dst->finished)
 	return CAIRO_STATUS_SURFACE_FINISHED;
 
-    if (dst->backend->show_glyphs)
-	status = dst->backend->show_glyphs (scaled_font, operator, pattern, dst,
-					    source_x, source_y,
-					    dest_x, dest_y,
-					    width, height,
-					    glyphs, num_glyphs);
+    if (dst->backend->old_show_glyphs)
+	status = dst->backend->old_show_glyphs (scaled_font,
+						operator, pattern, dst,
+						source_x, source_y,
+						dest_x, dest_y,
+						width, height,
+						glyphs, num_glyphs);
     else
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
 

Index: cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cairo-win32-surface.c	27 Sep 2005 20:22:46 -0000	1.36
+++ cairo-win32-surface.c	2 Nov 2005 00:40:37 -0000	1.37
@@ -1045,7 +1045,7 @@
     _cairo_win32_surface_set_clip_region,
     NULL, /* intersect_clip_path */
     _cairo_win32_surface_get_extents,
-    NULL, /* show_glyphs */
+    NULL, /* old_show_glyphs */
     NULL, /* fill_path */
     NULL, /* get_font_options */
     _cairo_win32_surface_flush,

Index: cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- cairo-xcb-surface.c	25 Oct 2005 23:02:08 -0000	1.50
+++ cairo-xcb-surface.c	2 Nov 2005 00:40:37 -0000	1.51
@@ -1040,7 +1040,7 @@
     NULL, /* _cairo_xcb_surface_set_clip_region */
     NULL, /* intersect_clip_path */
     _cairo_xcb_surface_get_extents,
-    NULL, /* show_glyphs */
+    NULL, /* old_show_glyphs */
     NULL, /* fill_path */
     NULL, /* get_font_options */
     NULL, /* flush */

Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- cairo-xlib-surface.c	29 Oct 2005 03:41:22 -0000	1.125
+++ cairo-xlib-surface.c	2 Nov 2005 00:40:37 -0000	1.126
@@ -1654,18 +1654,18 @@
 }
 
 static cairo_int_status_t
-_cairo_xlib_surface_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_xlib_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);
 
 static void
 _cairo_xlib_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font);
@@ -1690,7 +1690,7 @@
     _cairo_xlib_surface_set_clip_region,
     NULL, /* intersect_clip_path */
     _cairo_xlib_surface_get_extents,
-    _cairo_xlib_surface_show_glyphs,
+    _cairo_xlib_surface_old_show_glyphs,
     NULL, /* fill_path */
     _cairo_xlib_surface_get_font_options,
     NULL, /* flush */
@@ -2201,14 +2201,14 @@
 #define N_STACK_BUF 1024
 
 static cairo_status_t
-_cairo_xlib_surface_show_glyphs8  (cairo_scaled_font_t    *scaled_font,
-				   cairo_operator_t       operator,
-				   cairo_xlib_surface_t   *src,
-				   cairo_xlib_surface_t   *self,
-				   int                    source_x,
-				   int                    source_y,
-				   const cairo_glyph_t    *glyphs,
-				   int                    num_glyphs)
+_cairo_xlib_surface_old_show_glyphs8  (cairo_scaled_font_t    *scaled_font,
+				       cairo_operator_t        operator,
+				       cairo_xlib_surface_t   *src,
+				       cairo_xlib_surface_t   *self,
+				       int                     source_x,
+				       int                     source_y,
+				       const cairo_glyph_t    *glyphs,
+				       int                     num_glyphs)
 {
     cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
     XGlyphElt8 *elts = NULL;
@@ -2263,14 +2263,14 @@
 }
 
 static cairo_status_t
-_cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t    *scaled_font,
-				   cairo_operator_t       operator,
-				   cairo_xlib_surface_t   *src,
-				   cairo_xlib_surface_t   *self,
-				   int                    source_x,
-				   int                    source_y,
-				   const cairo_glyph_t    *glyphs,
-				   int                    num_glyphs)
+_cairo_xlib_surface_old_show_glyphs16 (cairo_scaled_font_t    *scaled_font,
+				       cairo_operator_t        operator,
+				       cairo_xlib_surface_t   *src,
+				       cairo_xlib_surface_t   *self,
+				       int                     source_x,
+				       int                     source_y,
+				       const cairo_glyph_t    *glyphs,
+				       int                     num_glyphs)
 {
     cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
     XGlyphElt16 *elts = NULL;
@@ -2325,14 +2325,14 @@
 }
 
 static cairo_status_t
-_cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t    *scaled_font,
-				   cairo_operator_t       operator,
-				   cairo_xlib_surface_t   *src,
-				   cairo_xlib_surface_t   *self,
-				   int                    source_x,
-				   int                    source_y,
-				   const cairo_glyph_t    *glyphs,
-				   int                    num_glyphs)
+_cairo_xlib_surface_old_show_glyphs32 (cairo_scaled_font_t    *scaled_font,
+				       cairo_operator_t        operator,
+				       cairo_xlib_surface_t   *src,
+				       cairo_xlib_surface_t   *self,
+				       int                     source_x,
+				       int                     source_y,
+				       const cairo_glyph_t    *glyphs,
+				       int                     num_glyphs)
 {
     cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
     XGlyphElt32 *elts = NULL;
@@ -2387,18 +2387,18 @@
 }
 
 static cairo_int_status_t
-_cairo_xlib_surface_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_xlib_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_surface_attributes_t	attributes;
     cairo_int_status_t		status;
@@ -2461,17 +2461,17 @@
     /* Call the appropriate sub-function. */
 
     if (max_index < 256)
-	status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, src, self,
+	status = _cairo_xlib_surface_old_show_glyphs8 (scaled_font, operator, src, self,
 						   source_x + attributes.x_offset - dest_x,
 						   source_y + attributes.y_offset - dest_y, 
 						   glyphs, num_glyphs);
     else if (max_index < 65536)
-	status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, src, self,
+	status = _cairo_xlib_surface_old_show_glyphs16 (scaled_font, operator, src, self,
 						    source_x + attributes.x_offset - dest_x,
 						    source_y + attributes.y_offset - dest_y, 
 						    glyphs, num_glyphs);
     else 
-	status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, src, self,
+	status = _cairo_xlib_surface_old_show_glyphs32 (scaled_font, operator, src, self,
 						    source_x + attributes.x_offset - dest_x,
 						    source_y + attributes.y_offset - dest_y, 
 						    glyphs, num_glyphs);

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -d -r1.221 -r1.222
--- cairoint.h	1 Nov 2005 00:55:21 -0000	1.221
+++ cairoint.h	2 Nov 2005 00:40:37 -0000	1.222
@@ -696,7 +696,7 @@
      * surfaces as glyphs. 
      */    
     cairo_int_status_t 
-    (*show_glyphs)		(cairo_scaled_font_t	        *font,
+    (*old_show_glyphs)		(cairo_scaled_font_t	        *font,
 				 cairo_operator_t		 operator,
 				 cairo_pattern_t		*pattern,
 				 void				*surface,
@@ -1620,6 +1620,14 @@
 			  double		tolerance,
 			  cairo_clip_t	       *clip,
 			  cairo_antialias_t	antialias);
+
+cairo_status_t
+_cairo_surface_show_glyphs (cairo_operator_t	 operator,
+			    cairo_pattern_t	*source_pattern,
+			    cairo_surface_t	*dst,
+			    cairo_scaled_font_t	*scaled_font,
+			    cairo_glyph_t	*glyphs,
+			    int			 num_glyphs);
   
 cairo_private cairo_status_t
 _cairo_surface_composite_trapezoids (cairo_operator_t	operator,
@@ -1710,18 +1718,18 @@
 			    cairo_rectangle_t *rectangle);
 
 cairo_private cairo_status_t
-_cairo_surface_show_glyphs (cairo_scaled_font_t	        *scaled_font,
-			    cairo_operator_t		operator,
-			    cairo_pattern_t		*pattern,
-			    cairo_surface_t		*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_surface_old_show_glyphs (cairo_scaled_font_t	*scaled_font,
+				cairo_operator_t	 operator,
+				cairo_pattern_t		*pattern,
+				cairo_surface_t		*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_private cairo_status_t
 _cairo_surface_composite_fixup_unbounded (cairo_surface_t            *dst,



More information about the cairo-commit mailing list