[cairo-commit] src/cairo-analysis-surface.c src/cairo-directfb-surface.c src/cairo-glitz-surface.c src/cairo-gstate.c src/cairoint.h src/cairo-meta-surface.c src/cairo-paginated-surface.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-quartz-surface.c src/cairo-scaled-font.c src/cairo-surface.c src/cairo-surface-fallback.c src/cairo-surface-fallback-private.h src/cairo-svg-surface.c src/cairo-win32-font.c src/cairo-win32-surface.c src/cairo-xcb-surface.c src/cairo-xlib-surface.c src/test-meta-surface.c src/test-paginated-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Aug 31 08:54:42 PDT 2007


 src/cairo-analysis-surface.c         |    2 -
 src/cairo-directfb-surface.c         |    2 -
 src/cairo-glitz-surface.c            |    2 -
 src/cairo-gstate.c                   |   43 ++++++++---------------------------
 src/cairo-meta-surface.c             |    2 -
 src/cairo-paginated-surface.c        |    2 -
 src/cairo-pdf-surface.c              |    2 -
 src/cairo-ps-surface.c               |    2 -
 src/cairo-quartz-surface.c           |    2 -
 src/cairo-scaled-font.c              |    2 -
 src/cairo-surface-fallback-private.h |    2 -
 src/cairo-surface-fallback.c         |    4 +--
 src/cairo-surface.c                  |    4 +--
 src/cairo-svg-surface.c              |    2 -
 src/cairo-win32-font.c               |    2 -
 src/cairo-win32-surface.c            |    2 -
 src/cairo-xcb-surface.c              |   20 ++++++++--------
 src/cairo-xlib-surface.c             |    4 +--
 src/cairoint.h                       |   12 ++++-----
 src/test-meta-surface.c              |    2 -
 src/test-paginated-surface.c         |    2 -
 21 files changed, 48 insertions(+), 69 deletions(-)

New commits:
diff-tree e8e3bfc1308aa30ea08ec530b6a5ddf532fd3088 (from 919bea6dbb32746f11781cd3a94eb44f5c4a32e6)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 31 16:53:21 2007 +0100

    Revert "[cairo-gstate] Avoid copying untransformed glyphs."
    
    This reverts commit 919bea6dbb32746f11781cd3a94eb44f5c4a32e6.
    
    Sadly as Behdad points out some backends do modify the glyph array and,
    for example cairo-xlib-surface, hide this from the compiler with some
    evil casts.

diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index e49af66..afbd30f 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -393,7 +393,7 @@ static cairo_int_status_t
 _cairo_analysis_surface_show_glyphs (void		  *abstract_surface,
 				     cairo_operator_t	   op,
 				     cairo_pattern_t	  *source,
-				     const cairo_glyph_t  *glyphs,
+				     cairo_glyph_t	  *glyphs,
 				     int		   num_glyphs,
 				     cairo_scaled_font_t  *scaled_font)
 {
diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c
index 198c198..409f79d 100644
--- a/src/cairo-directfb-surface.c
+++ b/src/cairo-directfb-surface.c
@@ -1451,7 +1451,7 @@ static cairo_int_status_t
 _cairo_directfb_surface_show_glyphs ( void                 *abstract_dst,
                                      cairo_operator_t      op,
                                      cairo_pattern_t      *pattern,
-                                     const cairo_glyph_t  *glyphs,
+                                     cairo_glyph_t	  *glyphs,
                                      int                   num_glyphs,
                                      cairo_scaled_font_t  *scaled_font)
 {
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index c61ec4d..8f497a9 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -2086,7 +2086,7 @@ _cairo_glitz_surface_old_show_glyphs (ca
 				      int		   dst_y,
 				      unsigned int	   width,
 				      unsigned int	   height,
-				      const cairo_glyph_t *glyphs,
+				      cairo_glyph_t       *glyphs,
 				      int		   num_glyphs)
 {
     cairo_glitz_surface_attributes_t	attributes;
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index e0d3065..cda40b1 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -58,9 +58,6 @@ _cairo_gstate_transform_glyphs_to_backen
                                            int                  num_glyphs,
                                            cairo_glyph_t       *transformed_glyphs);
 
-static cairo_bool_t
-_cairo_gstate_transform_glyphs_to_backend_required (cairo_gstate_t *gstate);
-
 cairo_status_t
 _cairo_gstate_init (cairo_gstate_t  *gstate,
 		    cairo_surface_t *target)
@@ -1570,19 +1567,16 @@ _cairo_gstate_show_glyphs (cairo_gstate_
     if (status)
 	return status;
 
-    if (_cairo_gstate_transform_glyphs_to_backend_required (gstate)) {
-	if (num_glyphs <= STACK_GLYPHS_LEN) {
-	    transformed_glyphs = stack_transformed_glyphs;
-	} else {
-	    transformed_glyphs = _cairo_malloc_ab (num_glyphs, sizeof(cairo_glyph_t));
-	    if (transformed_glyphs == NULL)
-		return CAIRO_STATUS_NO_MEMORY;
-	}
-
-	_cairo_gstate_transform_glyphs_to_backend (gstate, glyphs, num_glyphs,
-						   transformed_glyphs);
-    } else
-	transformed_glyphs = (cairo_glyph_t *) glyphs;
+    if (num_glyphs <= STACK_GLYPHS_LEN) {
+	transformed_glyphs = stack_transformed_glyphs;
+    } else {
+	transformed_glyphs = _cairo_malloc_ab (num_glyphs, sizeof(cairo_glyph_t));
+	if (transformed_glyphs == NULL)
+	    return CAIRO_STATUS_NO_MEMORY;
+    }
+
+    _cairo_gstate_transform_glyphs_to_backend (gstate, glyphs, num_glyphs,
+                                               transformed_glyphs);
 
     status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
     if (status)
@@ -1598,8 +1592,7 @@ _cairo_gstate_show_glyphs (cairo_gstate_
     _cairo_pattern_fini (&source_pattern.base);
 
 CLEANUP_GLYPHS:
-    if (transformed_glyphs != stack_transformed_glyphs &&
-	    transformed_glyphs != glyphs)
+    if (transformed_glyphs != stack_transformed_glyphs)
       free (transformed_glyphs);
 
     return status;
@@ -1655,20 +1648,6 @@ _cairo_gstate_get_antialias (cairo_gstat
     return gstate->antialias;
 }
 
-static cairo_bool_t
-_cairo_gstate_transform_glyphs_to_backend_required (cairo_gstate_t *gstate)
-{
-    cairo_matrix_t *ctm = &gstate->ctm;
-    cairo_matrix_t *device_transform = &gstate->target->device_transform;
-
-    if (_cairo_matrix_is_identity (ctm) &&
-        _cairo_matrix_is_identity (device_transform) &&
-	gstate->font_matrix.x0 == 0 && gstate->font_matrix.y0 == 0)
-	return FALSE;
-
-    return TRUE;
-}
-
 /**
  * _cairo_gstate_transform_glyphs_to_backend:
  * @gstate: a #cairo_gstate_t
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index bc5434c..d8f5064 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -426,7 +426,7 @@ static cairo_int_status_t
 _cairo_meta_surface_show_glyphs (void			*abstract_surface,
 				 cairo_operator_t	 op,
 				 cairo_pattern_t	*source,
-				 const cairo_glyph_t	*glyphs,
+				 cairo_glyph_t		*glyphs,
 				 int			 num_glyphs,
 				 cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index e8bdc2a..85f00fa 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -530,7 +530,7 @@ static cairo_int_status_t
 _cairo_paginated_surface_show_glyphs (void			*abstract_surface,
 				      cairo_operator_t		 op,
 				      cairo_pattern_t		*source,
-				      const cairo_glyph_t	*glyphs,
+				      cairo_glyph_t		*glyphs,
 				      int			 num_glyphs,
 				      cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index aa65dad..2677605 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -3880,7 +3880,7 @@ static cairo_int_status_t
 _cairo_pdf_surface_show_glyphs (void			*abstract_surface,
 				cairo_operator_t	 op,
 				cairo_pattern_t		*source,
-				const cairo_glyph_t	*glyphs,
+				cairo_glyph_t		*glyphs,
 				int			 num_glyphs,
 				cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 53e55dc..211ecd1 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2230,7 +2230,7 @@ static cairo_int_status_t
 _cairo_ps_surface_show_glyphs (void		     *abstract_surface,
 			       cairo_operator_t	      op,
 			       cairo_pattern_t	     *source,
-			       const cairo_glyph_t   *glyphs,
+			       cairo_glyph_t         *glyphs,
 			       int		      num_glyphs,
 			       cairo_scaled_font_t   *scaled_font)
 {
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index d87d31e..540bdca 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1315,7 +1315,7 @@ static cairo_int_status_t
 _cairo_quartz_surface_show_glyphs (void *abstract_surface,
 				    cairo_operator_t op,
 				    cairo_pattern_t *source,
-				    const cairo_glyph_t *glyphs,
+				    cairo_glyph_t *glyphs,
 				    int num_glyphs,
 				    cairo_scaled_font_t *scaled_font)
 {
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 387a1b9..cb3af9f 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -1140,7 +1140,7 @@ _cairo_scaled_font_show_glyphs (cairo_sc
 				int			dest_y,
 				unsigned int		width,
 				unsigned int		height,
-				const cairo_glyph_t    *glyphs,
+				cairo_glyph_t	       *glyphs,
 				int                     num_glyphs)
 {
     cairo_status_t status;
diff --git a/src/cairo-surface-fallback-private.h b/src/cairo-surface-fallback-private.h
index 00ad49e..82c5625 100644
--- a/src/cairo-surface-fallback-private.h
+++ b/src/cairo-surface-fallback-private.h
@@ -75,7 +75,7 @@ cairo_private cairo_status_t
 _cairo_surface_fallback_show_glyphs (cairo_surface_t		*surface,
 				     cairo_operator_t		 op,
 				     cairo_pattern_t		*source,
-				     const cairo_glyph_t	*glyphs,
+				     cairo_glyph_t		*glyphs,
 				     int			 num_glyphs,
 				     cairo_scaled_font_t	*scaled_font);
 
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index ced4dc5..ab19d2c 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -915,7 +915,7 @@ _cairo_surface_fallback_fill (cairo_surf
 
 typedef struct {
     cairo_scaled_font_t *font;
-    const cairo_glyph_t *glyphs;
+    cairo_glyph_t *glyphs;
     int num_glyphs;
 } cairo_show_glyphs_info_t;
 
@@ -984,7 +984,7 @@ cairo_status_t
 _cairo_surface_fallback_show_glyphs (cairo_surface_t		*surface,
 				     cairo_operator_t		 op,
 				     cairo_pattern_t		*source,
-				     const cairo_glyph_t	*glyphs,
+				     cairo_glyph_t		*glyphs,
 				     int			 num_glyphs,
 				     cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 8e39b5e..b44b853 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1901,7 +1901,7 @@ cairo_status_t
 _cairo_surface_show_glyphs (cairo_surface_t	*surface,
 			    cairo_operator_t	 op,
 			    cairo_pattern_t	*source,
-			    const cairo_glyph_t	*glyphs,
+			    cairo_glyph_t	*glyphs,
 			    int			 num_glyphs,
 			    cairo_scaled_font_t	*scaled_font)
 {
@@ -1986,7 +1986,7 @@ _cairo_surface_old_show_glyphs (cairo_sc
 				int			 dest_y,
 				unsigned int		 width,
 				unsigned int		 height,
-				const cairo_glyph_t	*glyphs,
+				cairo_glyph_t		*glyphs,
 				int			 num_glyphs)
 {
     cairo_status_t status;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 60fea96..eafec32 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1954,7 +1954,7 @@ static cairo_int_status_t
 _cairo_svg_surface_show_glyphs (void			*abstract_surface,
 				cairo_operator_t	 op,
 				cairo_pattern_t		*pattern,
-				const cairo_glyph_t	*glyphs,
+				cairo_glyph_t		*glyphs,
 				int			 num_glyphs,
 				cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index d9e82c0..484ca17 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1170,7 +1170,7 @@ _cairo_win32_scaled_font_show_glyphs (vo
 				      int			dest_y,
 				      unsigned int		width,
 				      unsigned int		height,
-				      const cairo_glyph_t      *glyphs,
+				      cairo_glyph_t	       *glyphs,
 				      int                 	num_glyphs)
 {
     cairo_win32_scaled_font_t *scaled_font = abstract_font;
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index e82a528..1358670 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1497,7 +1497,7 @@ static cairo_int_status_t
 _cairo_win32_surface_show_glyphs (void			*surface,
 				  cairo_operator_t	 op,
 				  cairo_pattern_t	*source,
-				  const cairo_glyph_t   *glyphs,
+				  cairo_glyph_t		*glyphs,
 				  int			 num_glyphs,
 				  cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 46ee162..bcdadae 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1620,11 +1620,11 @@ _cairo_xcb_surface_scaled_glyph_fini (ca
 
 static cairo_int_status_t
 _cairo_xcb_surface_show_glyphs (void                *abstract_dst,
-				cairo_operator_t     op,
-				cairo_pattern_t     *src_pattern,
-				const cairo_glyph_t *glyphs,
-				int		     num_glyphs,
-				cairo_scaled_font_t *scaled_font);
+				 cairo_operator_t     op,
+				 cairo_pattern_t     *src_pattern,
+				 cairo_glyph_t       *glyphs,
+				 int		      num_glyphs,
+				 cairo_scaled_font_t *scaled_font);
 
 static cairo_bool_t
 _cairo_xcb_surface_is_similar (void *surface_a,
@@ -2307,11 +2307,11 @@ typedef cairo_status_t (*cairo_xcb_surfa
 
 static cairo_int_status_t
 _cairo_xcb_surface_show_glyphs (void                *abstract_dst,
-				cairo_operator_t     op,
-				cairo_pattern_t     *src_pattern,
-				const cairo_glyph_t *glyphs,
-				int		     num_glyphs,
-				cairo_scaled_font_t *scaled_font)
+				 cairo_operator_t     op,
+				 cairo_pattern_t     *src_pattern,
+				 cairo_glyph_t       *glyphs,
+				 int		      num_glyphs,
+				 cairo_scaled_font_t *scaled_font)
 {
     cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_xcb_surface_t *dst = abstract_dst;
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 6021622..c95ec16 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -68,7 +68,7 @@ static cairo_int_status_t
 _cairo_xlib_surface_show_glyphs (void                *abstract_dst,
 				 cairo_operator_t     op,
 				 cairo_pattern_t     *src_pattern,
-				 const cairo_glyph_t *glyphs,
+				 cairo_glyph_t       *glyphs,
 				 int		      num_glyphs,
 				 cairo_scaled_font_t *scaled_font);
 
@@ -2984,7 +2984,7 @@ static cairo_int_status_t
 _cairo_xlib_surface_show_glyphs (void                *abstract_dst,
 				 cairo_operator_t     op,
 				 cairo_pattern_t     *src_pattern,
-				 const cairo_glyph_t *glyphs,
+				 cairo_glyph_t       *glyphs,
 				 int		      num_glyphs,
 				 cairo_scaled_font_t *scaled_font)
 {
diff --git a/src/cairoint.h b/src/cairoint.h
index dcdcb9a..58f2ea3 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -570,7 +570,7 @@ struct _cairo_scaled_font_backend {
 			 int			 dest_y,
 			 unsigned int		 width,
 			 unsigned int		 height,
-			 const cairo_glyph_t	*glyphs,
+			 cairo_glyph_t		*glyphs,
 			 int			 num_glyphs);
 
     cairo_warn cairo_int_status_t
@@ -798,7 +798,7 @@ struct _cairo_surface_backend {
 				 int				 dest_y,
 				 unsigned int			 width,
 				 unsigned int			 height,
-				 const cairo_glyph_t		*glyphs,
+				 cairo_glyph_t			*glyphs,
 				 int				 num_glyphs);
 
     void
@@ -860,7 +860,7 @@ struct _cairo_surface_backend {
     (*show_glyphs)		(void			*surface,
 				 cairo_operator_t	 op,
 				 cairo_pattern_t	*source,
-				 const cairo_glyph_t	*glyphs,
+				 cairo_glyph_t		*glyphs,
 				 int			 num_glyphs,
 				 cairo_scaled_font_t	*scaled_font);
 
@@ -1638,7 +1638,7 @@ _cairo_scaled_font_show_glyphs (cairo_sc
 				int		     dest_y,
 				unsigned int	     width,
 				unsigned int	     height,
-				const cairo_glyph_t *glyphs,
+				cairo_glyph_t	    *glyphs,
 				int		     num_glyphs);
 
 cairo_private cairo_status_t
@@ -1810,7 +1810,7 @@ cairo_private cairo_status_t
 _cairo_surface_show_glyphs (cairo_surface_t	*surface,
 			    cairo_operator_t	 op,
 			    cairo_pattern_t	*source,
-			    const cairo_glyph_t	*glyphs,
+			    cairo_glyph_t	*glyphs,
 			    int			 num_glyphs,
 			    cairo_scaled_font_t	*scaled_font);
 
@@ -1917,7 +1917,7 @@ _cairo_surface_old_show_glyphs (cairo_sc
 				int			 dest_y,
 				unsigned int		 width,
 				unsigned int		 height,
-				const cairo_glyph_t	*glyphs,
+				cairo_glyph_t		*glyphs,
 				int			 num_glyphs);
 
 cairo_private cairo_status_t
diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c
index 41eb7c4..3992b4c 100644
--- a/src/test-meta-surface.c
+++ b/src/test-meta-surface.c
@@ -251,7 +251,7 @@ static cairo_int_status_t
 _test_meta_surface_show_glyphs (void			*abstract_surface,
 				cairo_operator_t	 op,
 				cairo_pattern_t		*source,
-				const cairo_glyph_t	*glyphs,
+				cairo_glyph_t		*glyphs,
 				int			 num_glyphs,
 				cairo_scaled_font_t	*scaled_font)
 {
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index 9f8040f..1e08c2d 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -228,7 +228,7 @@ static cairo_int_status_t
 _test_paginated_surface_show_glyphs (void			*abstract_surface,
 				     cairo_operator_t		 op,
 				     cairo_pattern_t		*source,
-				     const cairo_glyph_t	*glyphs,
+				     cairo_glyph_t		*glyphs,
 				     int			 num_glyphs,
 				     cairo_scaled_font_t	*scaled_font)
 {


More information about the cairo-commit mailing list