[cairo-commit] Branch 'ps-surface' - 4 commits - src/cairo-analysis-surface.c src/cairo-analysis-surface-private.h src/cairo-analyze-surface.c src/cairo-analyze-surface-private.h src/cairo-paginated-surface.c src/cairo-paginated-surface-private.h src/cairo-ps-surface.c src/Makefile.am src/test-paginated-surface.c

Carl Worth cworth at kemper.freedesktop.org
Tue Feb 28 12:11:35 PST 2006


 src/Makefile.am                       |    6 -
 src/cairo-analysis-surface-private.h  |   18 ++---
 src/cairo-analysis-surface.c          |  104 +++++++++++++++++-----------------
 src/cairo-paginated-surface-private.h |   10 ---
 src/cairo-paginated-surface.c         |   32 +++++-----
 src/cairo-ps-surface.c                |   31 ++++------
 src/test-paginated-surface.c          |   19 +++++-
 7 files changed, 116 insertions(+), 104 deletions(-)

New commits:
diff-tree e3017c3c8de2b90e1d3470866f9bd6cc2cd313fa (from parents)
Merge: ce683a240236fbe8083f284195acf0f78aa05048 2984f60a3a4571a8d4179fdc64a9e67ce9854f21
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 28 12:07:14 2006 -0800

    Merge in upstream 'ps-surface' changes

diff --cc src/cairo-analysis-surface.c
index 20ac5ae,0000000..2bc51d3
mode 100644,000000..100644
@@@ -1,246 -1,0 +1,255 @@@
 +/*
 + * Copyright © 2006 Keith Packard
 + *
 + * This library is free software; you can redistribute it and/or
 + * modify it either under the terms of the GNU Lesser General Public
 + * License version 2.1 as published by the Free Software Foundation
 + * (the "LGPL") or, at your option, under the terms of the Mozilla
 + * Public License Version 1.1 (the "MPL"). If you do not alter this
 + * notice, a recipient may use your version of this file under either
 + * the MPL or the LGPL.
 + *
 + * You should have received a copy of the LGPL along with this library
 + * in the file COPYING-LGPL-2.1; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 + * You should have received a copy of the MPL along with this library
 + * in the file COPYING-MPL-1.1
 + *
 + * The contents of this file are subject to the Mozilla Public License
 + * Version 1.1 (the "License"); you may not use this file except in
 + * compliance with the License. You may obtain a copy of the License at
 + * http://www.mozilla.org/MPL/
 + *
 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
 + * OF ANY KIND, either express or implied. See the LGPL or the MPL for
 + * the specific language governing rights and limitations.
 + *
 + * The Original Code is the cairo graphics library.
 + *
 + * The Initial Developer of the Original Code is Keith Packard
 + *
 + * Contributor(s):
 + *      Keith Packard <keithp at keithp.com>
 + */
 +
 +#include "cairoint.h"
 +
 +#include "cairo-analysis-surface-private.h"
 +#include "cairo-paginated-surface-private.h"
 +
 +typedef struct {
 +    cairo_surface_t base;
 +    int width;
 +    int height;
 +
 +    cairo_surface_t	*target;
 +    
 +    cairo_bool_t fallback;
 +} cairo_analysis_surface_t;
 +
 +static cairo_int_status_t
++_cairo_analysis_surface_get_extents (void	 	*abstract_surface,
++				     cairo_rectangle_t	*rectangle)
++{
++    cairo_analysis_surface_t *surface = abstract_surface;
++
++    return _cairo_surface_get_extents (surface->target, rectangle);
++}
++
++static cairo_int_status_t
 +_cairo_analysis_surface_paint (void			*abstract_surface,
- 			       cairo_operator_t		op,
- 			       cairo_pattern_t		*source)
++			      cairo_operator_t		op,
++			      cairo_pattern_t		*source)
 +{
 +    cairo_analysis_surface_t *surface = abstract_surface;
 +    cairo_status_t	     status;
 +
 +    if (!surface->target->backend->paint)
 +	status = CAIRO_INT_STATUS_UNSUPPORTED;
 +    else
 +	status = (*surface->target->backend->paint) (surface->target, op,
 +						     source);
 +    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 +	surface->fallback = TRUE;
 +	status = CAIRO_STATUS_SUCCESS;
 +    }
 +    return status;
 +}
 +
 +static cairo_int_status_t
 +_cairo_analysis_surface_mask (void		*abstract_surface,
 +			      cairo_operator_t	 op,
 +			      cairo_pattern_t	*source,
 +			      cairo_pattern_t	*mask)
 +{
 +    cairo_analysis_surface_t *surface = abstract_surface;
 +    cairo_status_t	     status;
 +
 +    if (!surface->target->backend->mask)
 +	status = CAIRO_INT_STATUS_UNSUPPORTED;
 +    else
 +	status = (*surface->target->backend->mask) (surface->target, op,
 +						    source, mask);
 +    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 +	surface->fallback = TRUE;
 +	status = CAIRO_STATUS_SUCCESS;
 +    }
 +    return status;
 +}
 +
 +static cairo_int_status_t
 +_cairo_analysis_surface_stroke (void			*abstract_surface,
 +				cairo_operator_t	 op,
 +				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_analysis_surface_t *surface = abstract_surface;
 +    cairo_status_t	     status;
 +
 +    if (!surface->target->backend->stroke)
 +	status = CAIRO_INT_STATUS_UNSUPPORTED;
 +    else
 +	status = (*surface->target->backend->stroke) (surface->target, op,
 +						      source, path, style,
 +						      ctm, ctm_inverse,
 +						      tolerance, antialias);
 +    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 +	surface->fallback = TRUE;
 +	status = CAIRO_STATUS_SUCCESS;
 +    }
 +    return status;
 +}
 +
 +static cairo_int_status_t
 +_cairo_analysis_surface_fill (void			*abstract_surface,
 +			      cairo_operator_t		 op,
 +			      cairo_pattern_t		*source,
 +			      cairo_path_fixed_t	*path,
 +			      cairo_fill_rule_t	 	 fill_rule,
 +			      double			 tolerance,
 +			      cairo_antialias_t	 	 antialias)
 +{
 +    cairo_analysis_surface_t *surface = abstract_surface;
 +    cairo_status_t	     status;
 +
 +    if (!surface->target->backend->fill)
 +	status = CAIRO_INT_STATUS_UNSUPPORTED;
 +    else
 +	status = (*surface->target->backend->fill) (surface->target, op,
 +						    source, path, fill_rule,
 +						    tolerance, antialias);
 +    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 +	surface->fallback = TRUE;
 +	status = CAIRO_STATUS_SUCCESS;
 +    }
 +    return status;
 +}
 +
 +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,
 +				     int		   num_glyphs,
 +				     cairo_scaled_font_t  *scaled_font)
 +{
 +    cairo_analysis_surface_t *surface = abstract_surface;
 +    cairo_status_t	     status;
 +
 +    if (!surface->target->backend->show_glyphs)
 +	status = CAIRO_INT_STATUS_UNSUPPORTED;
 +    else
 +	status = (*surface->target->backend->show_glyphs) (surface->target, op,
 +							   source,
 +							   glyphs, num_glyphs,
 +							   scaled_font);
 +    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 +	surface->fallback = TRUE;
 +	status = CAIRO_STATUS_SUCCESS;
 +    }
 +    return status;
 +}
 +
 +static const cairo_surface_backend_t cairo_analysis_surface_backend = {
 +    NULL, /* create_similar */
 +    NULL, /* finish_surface */
 +    NULL, /* acquire_source_image */
 +    NULL, /* release_source_image */
 +    NULL, /* acquire_dest_image */
 +    NULL, /* release_dest_image */
 +    NULL, /* clone_similar */
 +    NULL, /* composite */
 +    NULL, /* fill_rectangles */
 +    NULL, /* composite_trapezoids */
 +    NULL, /* copy_page */
 +    NULL, /* show_page */
 +    NULL, /* set_clip_region */
 +    NULL, /* clip_path */
-     NULL, /* get_extents */
++    _cairo_analysis_surface_get_extents,
 +    NULL, /* old_show_glyphs */
 +    NULL, /* get_font_options */
 +    NULL, /* flush */
 +    NULL, /* mark_dirty_rectangle */
 +    NULL, /* scaled_font_fini */
 +    NULL, /* scaled_glyph_fini */
 +    _cairo_analysis_surface_paint,
 +    _cairo_analysis_surface_mask,
 +    _cairo_analysis_surface_stroke,
 +    _cairo_analysis_surface_fill,
 +    _cairo_analysis_surface_show_glyphs,
 +    NULL, /* snapshot */
 +};
 +
 +cairo_private cairo_surface_t *
 +_cairo_analysis_surface_create (cairo_surface_t		*target,
 +				int			 width,
 +				int			 height)
 +{
 +    cairo_analysis_surface_t *surface;
 +
 +    surface = malloc (sizeof (cairo_analysis_surface_t));
 +    if (surface == NULL)
 +	goto FAIL;
 +
 +    _cairo_surface_init (&surface->base, &cairo_analysis_surface_backend);
 +
 +    surface->width = width;
 +    surface->height = height;
 +
 +    surface->target = target;
 +    surface->fallback = FALSE;
 +
 +    return &surface->base;
 +FAIL:
 +    _cairo_error (CAIRO_STATUS_NO_MEMORY);
 +    return NULL;
 +}
 +
 +cairo_private pixman_region16_t *
 +_cairo_analysis_surface_get_supported (cairo_surface_t *abstract_surface)
 +{
 +    /* XXX */
 +    return NULL;
 +}
 +
 +cairo_private pixman_region16_t *
 +_cairo_analysis_surface_get_unsupported (cairo_surface_t *abstract_surface)
 +{
 +    /* XXX */
 +    return NULL;
 +}
 +
 +cairo_private cairo_bool_t
 +_cairo_analysis_surface_has_unsupported (cairo_surface_t *abstract_surface)
 +{
 +    cairo_analysis_surface_t	*surface = (cairo_analysis_surface_t *) abstract_surface;
 +
 +    return surface->fallback;
 +}
 +
 +
diff --cc src/test-paginated-surface.c
index 155f277,155f277..d07ac37
@@@ -51,6 -51,6 +51,22 @@@
  
  #include "cairo-paginated-surface-private.h"
  
++static void
++_test_paginated_surface_set_paginated_mode (cairo_surface_t *target,
++					    cairo_paginated_mode_t mode)
++{
++    /* XXX: We don't do anything to save the paginated mode here. This
++     * means that all the rendering will hit the image surface
++     * twice. This will work (but less efficiently) for all tests that
++     * explicitly initialize all pixels. Tests that expect the
++     * background to initially be transparent and leave it that way in
++     * spots will likely fail.
++     *
++     * If we see this as worth fixing, it will just require shoving
++     * some set_paginated_mode support into cairo_image_surface_t.
++     */
++}
++
  cairo_surface_t *
  _test_paginated_surface_create_for_data (unsigned char		*data,
  					 cairo_content_t	 content,
@@@ -64,5 -64,5 +80,6 @@@
  								width, height,
  								stride);
  
--    return _cairo_paginated_surface_create (target, content, width, height);
++    return _cairo_paginated_surface_create (target, content, width, height,
++					    _test_paginated_surface_set_paginated_mode);
  }
diff-tree ce683a240236fbe8083f284195acf0f78aa05048 (from aecb07a26d1db73cf6eee183de0f77615dea6830)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 15:12:15 2006 -0800

    Drop gratuitous structure with single function pointer. Rename
    paginated_set_mode to set_paginated_mode.

diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index b81b78b..cb32596 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -43,19 +43,15 @@ typedef enum {
     CAIRO_PAGINATED_MODE_RENDER		/* render page contents */
 } cairo_paginated_mode_t;
 
-typedef void (*cairo_paginated_set_mode_t) (cairo_surface_t 	   *target,
-					    cairo_paginated_mode_t mode);
-
-typedef struct {
-    cairo_paginated_set_mode_t	set_mode;
-} cairo_paginated_funcs_t;
+typedef void (*cairo_set_paginated_mode_func_t) (cairo_surface_t	*target,
+						 cairo_paginated_mode_t	 mode);
 
 cairo_private cairo_surface_t *
 _cairo_paginated_surface_create (cairo_surface_t	*target,
 				 cairo_content_t	 content,
 				 int			 width,
 				 int			 height,
-				 const cairo_paginated_funcs_t *funcs);
+				 cairo_set_paginated_mode_func_t set_paginated_mode);
 
 cairo_private cairo_surface_t *
 _cairo_paginated_surface_get_target (cairo_surface_t *surface);
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 80e87ab..bb5e034 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -87,8 +87,8 @@ typedef struct _cairo_paginated_surface 
     /* The target surface to hold the final result. */
     cairo_surface_t *target;
 
-    /* Paginated-surface specific functions for the target */
-    const cairo_paginated_funcs_t *funcs;
+    /* Paginated-surface specific function for the target */
+    cairo_set_paginated_mode_func_t set_paginated_mode;
 
     /* A cairo_meta_surface to record all operations. To be replayed
      * against target, and also against image surface as necessary for
@@ -107,7 +107,7 @@ _cairo_paginated_surface_create (cairo_s
 				 cairo_content_t	 content,
 				 int			 width,
 				 int			 height,
-				 const cairo_paginated_funcs_t *funcs)
+				 cairo_set_paginated_mode_func_t set_paginated_mode)
 {
     cairo_paginated_surface_t *surface;
 
@@ -122,7 +122,7 @@ _cairo_paginated_surface_create (cairo_s
     surface->height = height;
 
     surface->target = target;
-    surface->funcs = funcs;
+    surface->set_paginated_mode = set_paginated_mode;
 
     surface->meta = _cairo_meta_surface_create (content, width, height);
     if (cairo_surface_status (surface->meta))
@@ -209,9 +209,9 @@ _paint_page (cairo_paginated_surface_t *
     analysis = _cairo_analysis_surface_create (surface->target,
 					       surface->width, surface->height);
 
-    surface->funcs->set_mode (surface->target, CAIRO_PAGINATED_MODE_ANALYZE);
+    surface->set_paginated_mode (surface->target, CAIRO_PAGINATED_MODE_ANALYZE);
     _cairo_meta_surface_replay (surface->meta, analysis);
-    surface->funcs->set_mode (surface->target, CAIRO_PAGINATED_MODE_RENDER);
+    surface->set_paginated_mode (surface->target, CAIRO_PAGINATED_MODE_RENDER);
 
     if (analysis->status) {
 	status = analysis->status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f1ae414..7f31f58 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -56,7 +56,10 @@
  */
 
 static const cairo_surface_backend_t cairo_ps_surface_backend;
-static const cairo_paginated_funcs_t cairo_ps_paginated_funcs;
+
+static void
+_cairo_ps_set_paginated_mode (cairo_surface_t *target,
+			      cairo_paginated_mode_t mode);
 
 typedef struct cairo_ps_surface {
     cairo_surface_t base;
@@ -72,7 +75,7 @@ typedef struct cairo_ps_surface {
     cairo_bool_t need_start_page; 
     int num_pages;
 
-    cairo_paginated_mode_t mode;
+    cairo_paginated_mode_t paginated_mode;
 
 #if DONE_ADDING_FONTS_SUPPORT_BACK_AFTER_SWITCHING_TO_PAGINATED
     cairo_array_t fonts;
@@ -144,7 +147,7 @@ _cairo_ps_surface_create_for_stream_inte
     surface->height = height;
     surface->x_dpi = PS_SURFACE_DPI_DEFAULT;
     surface->y_dpi = PS_SURFACE_DPI_DEFAULT;
-    surface->mode = CAIRO_PAGINATED_MODE_ANALYZE;
+    surface->paginated_mode = CAIRO_PAGINATED_MODE_ANALYZE;
 #if DONE_ADDING_DEVICE_SCALE_SUPPORT_AFTER_SWITCHING_TO_PAGINATED
     surface->base.device_x_scale = surface->x_dpi / 72.0;
     surface->base.device_y_scale = surface->y_dpi / 72.0;
@@ -162,7 +165,7 @@ _cairo_ps_surface_create_for_stream_inte
     return _cairo_paginated_surface_create (&surface->base,
 					    CAIRO_CONTENT_COLOR_ALPHA,
 					    width, height,
-					    &cairo_ps_paginated_funcs);
+					    _cairo_ps_set_paginated_mode);
 }
 
 /**
@@ -943,7 +946,7 @@ _cairo_ps_surface_intersect_clip_path (v
     cairo_ps_surface_path_info_t info;
     const char *ps_operator;
 
-    if (surface->mode == CAIRO_PAGINATED_MODE_ANALYZE)
+    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return CAIRO_STATUS_SUCCESS;
 
     _cairo_output_stream_printf (stream,
@@ -1084,7 +1087,7 @@ _cairo_ps_surface_paint (void			*abstrac
     cairo_output_stream_t *stream = surface->stream;
     cairo_ps_surface_path_info_t info;
 
-    if (surface->mode == CAIRO_PAGINATED_MODE_ANALYZE) {
+    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
 	if (!pattern_operation_supported (op, source))
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 	return CAIRO_STATUS_SUCCESS;
@@ -1158,7 +1161,7 @@ _cairo_ps_surface_stroke (void			*abstra
     cairo_int_status_t status;
     cairo_ps_surface_path_info_t info;
 
-    if (surface->mode == CAIRO_PAGINATED_MODE_ANALYZE) {
+    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
 	if (!pattern_operation_supported (op, source))
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
     
@@ -1236,7 +1239,7 @@ _cairo_ps_surface_fill (void		*abstract_
     cairo_ps_surface_path_info_t info;
     const char *ps_operator;
 
-    if (surface->mode == CAIRO_PAGINATED_MODE_ANALYZE) {
+    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
 	if (!pattern_operation_supported (op, source))
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 	return CAIRO_STATUS_SUCCESS;
@@ -1315,14 +1318,10 @@ static const cairo_surface_backend_t cai
 };
 
 static void
-_cairo_ps_paginated_set_mode (cairo_surface_t *target,
-			      cairo_paginated_mode_t mode)
+_cairo_ps_set_paginated_mode (cairo_surface_t *target,
+			      cairo_paginated_mode_t paginated_mode)
 {
-    cairo_ps_surface_t	*surface = (cairo_ps_surface_t *) target;
+    cairo_ps_surface_t *surface = (cairo_ps_surface_t *) target;
 
-    surface->mode = mode;
+    surface->paginated_mode = paginated_mode;
 }
-
-static const cairo_paginated_funcs_t cairo_ps_paginated_funcs = {
-    _cairo_ps_paginated_set_mode,
-};
diff-tree aecb07a26d1db73cf6eee183de0f77615dea6830 (from 2660e79e674a55e71014f83e9247372edd9ab531)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 14:58:51 2006 -0800

    cairo_analysis_surface: Rename region_[un]supported() to get_[un]supported().

diff --git a/src/cairo-analysis-surface-private.h b/src/cairo-analysis-surface-private.h
index 75ec9ff..62e67ae 100644
--- a/src/cairo-analysis-surface-private.h
+++ b/src/cairo-analysis-surface-private.h
@@ -44,10 +44,10 @@ _cairo_analysis_surface_create (cairo_su
 				int			 height);
 
 cairo_private pixman_region16_t *
-_cairo_analysis_surface_region_supported (cairo_surface_t *surface);
+_cairo_analysis_surface_get_supported (cairo_surface_t *surface);
 
 cairo_private pixman_region16_t *
-_cairo_analysis_surface_region_unsupported (cairo_surface_t *unsupported);
+_cairo_analysis_surface_get_unsupported (cairo_surface_t *unsupported);
 
 cairo_private cairo_bool_t
 _cairo_analysis_surface_has_unsupported (cairo_surface_t *unsupported);
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index 4349da7..20ac5ae 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -222,14 +222,14 @@ FAIL:
 }
 
 cairo_private pixman_region16_t *
-_cairo_analysis_surface_region_supported (cairo_surface_t *abstract_surface)
+_cairo_analysis_surface_get_supported (cairo_surface_t *abstract_surface)
 {
     /* XXX */
     return NULL;
 }
 
 cairo_private pixman_region16_t *
-_cairo_analysis_surface_region_unsupported (cairo_surface_t *abstract_surface)
+_cairo_analysis_surface_get_unsupported (cairo_surface_t *abstract_surface)
 {
     /* XXX */
     return NULL;
diff-tree 2660e79e674a55e71014f83e9247372edd9ab531 (from f9d4482137e7f13e634cc578c64d84ffdea16bca)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Feb 27 14:56:41 2006 -0800

    Rename cairo_analyze_surface_t to cairo_analysis_surface_t.

diff --git a/src/Makefile.am b/src/Makefile.am
index 38947d4..adc6552 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -173,8 +173,8 @@ libcairo_la_SOURCES =				\
 	cairo-meta-surface-private.h		\
 	cairo-paginated-surface.c		\
 	cairo-paginated-surface-private.h	\
-	cairo-analyze-surface.c			\
-	cairo-analyze-surface-private.h		\
+	cairo-analysis-surface.c		\
+	cairo-analysis-surface-private.h	\
 	$(libcairo_atsui_sources)		\
 	$(libcairo_ft_sources)			\
 	$(libcairo_ps_sources)			\
@@ -189,7 +189,7 @@ libcairo_la_SOURCES =				\
 	$(libcairo_glitz_sources)		\
 	$(libcairo_win32_sources)		\
 	$(libcairo_beos_sources)		\
- 	$(libcairo_directfb_sources)	\
+	$(libcairo_directfb_sources)		\
 	cairoint.h
 
 libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined $(export_symbols)
diff --git a/src/cairo-analysis-surface-private.h b/src/cairo-analysis-surface-private.h
new file mode 100644
index 0000000..75ec9ff
--- /dev/null
+++ b/src/cairo-analysis-surface-private.h
@@ -0,0 +1,55 @@
+/* $Id: $
+ *
+ * Copyright © 2005 Keith Packard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Keith Packard
+ *
+ * Contributor(s):
+ *      Keith Packard <keithp at keithp.com>
+ */
+
+#ifndef CAIRO_ANALYSIS_SURFACE_H
+#define CAIRO_ANALYSIS_SURFACE_H
+
+#include "cairoint.h"
+
+cairo_private cairo_surface_t *
+_cairo_analysis_surface_create (cairo_surface_t		*target,
+				int			 width,
+				int			 height);
+
+cairo_private pixman_region16_t *
+_cairo_analysis_surface_region_supported (cairo_surface_t *surface);
+
+cairo_private pixman_region16_t *
+_cairo_analysis_surface_region_unsupported (cairo_surface_t *unsupported);
+
+cairo_private cairo_bool_t
+_cairo_analysis_surface_has_unsupported (cairo_surface_t *unsupported);
+
+#endif /* CAIRO_ANALYSIS_SURFACE_H */
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
new file mode 100644
index 0000000..4349da7
--- /dev/null
+++ b/src/cairo-analysis-surface.c
@@ -0,0 +1,246 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Keith Packard
+ *
+ * Contributor(s):
+ *      Keith Packard <keithp at keithp.com>
+ */
+
+#include "cairoint.h"
+
+#include "cairo-analysis-surface-private.h"
+#include "cairo-paginated-surface-private.h"
+
+typedef struct {
+    cairo_surface_t base;
+    int width;
+    int height;
+
+    cairo_surface_t	*target;
+    
+    cairo_bool_t fallback;
+} cairo_analysis_surface_t;
+
+static cairo_int_status_t
+_cairo_analysis_surface_paint (void			*abstract_surface,
+			       cairo_operator_t		op,
+			       cairo_pattern_t		*source)
+{
+    cairo_analysis_surface_t *surface = abstract_surface;
+    cairo_status_t	     status;
+
+    if (!surface->target->backend->paint)
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+    else
+	status = (*surface->target->backend->paint) (surface->target, op,
+						     source);
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	surface->fallback = TRUE;
+	status = CAIRO_STATUS_SUCCESS;
+    }
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_analysis_surface_mask (void		*abstract_surface,
+			      cairo_operator_t	 op,
+			      cairo_pattern_t	*source,
+			      cairo_pattern_t	*mask)
+{
+    cairo_analysis_surface_t *surface = abstract_surface;
+    cairo_status_t	     status;
+
+    if (!surface->target->backend->mask)
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+    else
+	status = (*surface->target->backend->mask) (surface->target, op,
+						    source, mask);
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	surface->fallback = TRUE;
+	status = CAIRO_STATUS_SUCCESS;
+    }
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_analysis_surface_stroke (void			*abstract_surface,
+				cairo_operator_t	 op,
+				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_analysis_surface_t *surface = abstract_surface;
+    cairo_status_t	     status;
+
+    if (!surface->target->backend->stroke)
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+    else
+	status = (*surface->target->backend->stroke) (surface->target, op,
+						      source, path, style,
+						      ctm, ctm_inverse,
+						      tolerance, antialias);
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	surface->fallback = TRUE;
+	status = CAIRO_STATUS_SUCCESS;
+    }
+    return status;
+}
+
+static cairo_int_status_t
+_cairo_analysis_surface_fill (void			*abstract_surface,
+			      cairo_operator_t		 op,
+			      cairo_pattern_t		*source,
+			      cairo_path_fixed_t	*path,
+			      cairo_fill_rule_t	 	 fill_rule,
+			      double			 tolerance,
+			      cairo_antialias_t	 	 antialias)
+{
+    cairo_analysis_surface_t *surface = abstract_surface;
+    cairo_status_t	     status;
+
+    if (!surface->target->backend->fill)
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+    else
+	status = (*surface->target->backend->fill) (surface->target, op,
+						    source, path, fill_rule,
+						    tolerance, antialias);
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	surface->fallback = TRUE;
+	status = CAIRO_STATUS_SUCCESS;
+    }
+    return status;
+}
+
+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,
+				     int		   num_glyphs,
+				     cairo_scaled_font_t  *scaled_font)
+{
+    cairo_analysis_surface_t *surface = abstract_surface;
+    cairo_status_t	     status;
+
+    if (!surface->target->backend->show_glyphs)
+	status = CAIRO_INT_STATUS_UNSUPPORTED;
+    else
+	status = (*surface->target->backend->show_glyphs) (surface->target, op,
+							   source,
+							   glyphs, num_glyphs,
+							   scaled_font);
+    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+	surface->fallback = TRUE;
+	status = CAIRO_STATUS_SUCCESS;
+    }
+    return status;
+}
+
+static const cairo_surface_backend_t cairo_analysis_surface_backend = {
+    NULL, /* create_similar */
+    NULL, /* finish_surface */
+    NULL, /* acquire_source_image */
+    NULL, /* release_source_image */
+    NULL, /* acquire_dest_image */
+    NULL, /* release_dest_image */
+    NULL, /* clone_similar */
+    NULL, /* composite */
+    NULL, /* fill_rectangles */
+    NULL, /* composite_trapezoids */
+    NULL, /* copy_page */
+    NULL, /* show_page */
+    NULL, /* set_clip_region */
+    NULL, /* clip_path */
+    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 */
+    _cairo_analysis_surface_paint,
+    _cairo_analysis_surface_mask,
+    _cairo_analysis_surface_stroke,
+    _cairo_analysis_surface_fill,
+    _cairo_analysis_surface_show_glyphs,
+    NULL, /* snapshot */
+};
+
+cairo_private cairo_surface_t *
+_cairo_analysis_surface_create (cairo_surface_t		*target,
+				int			 width,
+				int			 height)
+{
+    cairo_analysis_surface_t *surface;
+
+    surface = malloc (sizeof (cairo_analysis_surface_t));
+    if (surface == NULL)
+	goto FAIL;
+
+    _cairo_surface_init (&surface->base, &cairo_analysis_surface_backend);
+
+    surface->width = width;
+    surface->height = height;
+
+    surface->target = target;
+    surface->fallback = FALSE;
+
+    return &surface->base;
+FAIL:
+    _cairo_error (CAIRO_STATUS_NO_MEMORY);
+    return NULL;
+}
+
+cairo_private pixman_region16_t *
+_cairo_analysis_surface_region_supported (cairo_surface_t *abstract_surface)
+{
+    /* XXX */
+    return NULL;
+}
+
+cairo_private pixman_region16_t *
+_cairo_analysis_surface_region_unsupported (cairo_surface_t *abstract_surface)
+{
+    /* XXX */
+    return NULL;
+}
+
+cairo_private cairo_bool_t
+_cairo_analysis_surface_has_unsupported (cairo_surface_t *abstract_surface)
+{
+    cairo_analysis_surface_t	*surface = (cairo_analysis_surface_t *) abstract_surface;
+
+    return surface->fallback;
+}
+
+
diff --git a/src/cairo-analyze-surface-private.h b/src/cairo-analyze-surface-private.h
deleted file mode 100644
index 1c90fc9..0000000
--- a/src/cairo-analyze-surface-private.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $Id: $
- *
- * Copyright © 2005 Keith Packard
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Keith Packard
- *
- * Contributor(s):
- *      Keith Packard <keithp at keithp.com>
- */
-
-#ifndef CAIRO_ANALYZE_SURFACE_H
-#define CAIRO_ANALYZE_SURFACE_H
-
-#include "cairoint.h"
-
-cairo_private cairo_surface_t *
-_cairo_analyze_surface_create (cairo_surface_t		*target,
-			       int			 width,
-			       int			 height);
-
-cairo_private pixman_region16_t *
-_cairo_analyze_surface_region_supported (cairo_surface_t *surface);
-
-cairo_private pixman_region16_t *
-_cairo_analyze_surface_region_unsupported (cairo_surface_t *unsupported);
-
-cairo_private cairo_bool_t
-_cairo_analyze_surface_has_unsupported (cairo_surface_t *unsupported);
-
-#endif /* CAIRO_ANALYZE_SURFACE_H */
diff --git a/src/cairo-analyze-surface.c b/src/cairo-analyze-surface.c
deleted file mode 100644
index e2d5e84..0000000
--- a/src/cairo-analyze-surface.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Keith Packard
- *
- * Contributor(s):
- *      Keith Packard <keithp at keithp.com>
- */
-
-#include "cairoint.h"
-
-#include "cairo-analyze-surface-private.h"
-#include "cairo-paginated-surface-private.h"
-
-typedef struct {
-    cairo_surface_t base;
-    int width;
-    int height;
-
-    cairo_surface_t	*target;
-    
-    cairo_bool_t fallback;
-} cairo_analyze_surface_t;
-
-static cairo_int_status_t
-_cairo_analyze_surface_paint (void			*abstract_surface,
-			      cairo_operator_t		op,
-			      cairo_pattern_t		*source)
-{
-    cairo_analyze_surface_t *surface = abstract_surface;
-    cairo_status_t	     status;
-
-    if (!surface->target->backend->paint)
-	status = CAIRO_INT_STATUS_UNSUPPORTED;
-    else
-	status = (*surface->target->backend->paint) (surface->target, op,
-						     source);
-    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	surface->fallback = TRUE;
-	status = CAIRO_STATUS_SUCCESS;
-    }
-    return status;
-}
-
-static cairo_int_status_t
-_cairo_analyze_surface_mask (void		*abstract_surface,
-			     cairo_operator_t	 op,
-			     cairo_pattern_t	*source,
-			     cairo_pattern_t	*mask)
-{
-    cairo_analyze_surface_t *surface = abstract_surface;
-    cairo_status_t	     status;
-
-    if (!surface->target->backend->mask)
-	status = CAIRO_INT_STATUS_UNSUPPORTED;
-    else
-	status = (*surface->target->backend->mask) (surface->target, op,
-						    source, mask);
-    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	surface->fallback = TRUE;
-	status = CAIRO_STATUS_SUCCESS;
-    }
-    return status;
-}
-
-static cairo_int_status_t
-_cairo_analyze_surface_stroke (void			*abstract_surface,
-			       cairo_operator_t	 	 op,
-			       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_analyze_surface_t *surface = abstract_surface;
-    cairo_status_t	     status;
-
-    if (!surface->target->backend->stroke)
-	status = CAIRO_INT_STATUS_UNSUPPORTED;
-    else
-	status = (*surface->target->backend->stroke) (surface->target, op,
-						      source, path, style,
-						      ctm, ctm_inverse,
-						      tolerance, antialias);
-    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	surface->fallback = TRUE;
-	status = CAIRO_STATUS_SUCCESS;
-    }
-    return status;
-}
-
-static cairo_int_status_t
-_cairo_analyze_surface_fill (void			*abstract_surface,
-			     cairo_operator_t		 op,
-			     cairo_pattern_t		*source,
-			     cairo_path_fixed_t		*path,
-			     cairo_fill_rule_t	 	 fill_rule,
-			     double			 tolerance,
-			     cairo_antialias_t	 	 antialias)
-{
-    cairo_analyze_surface_t *surface = abstract_surface;
-    cairo_status_t	     status;
-
-    if (!surface->target->backend->fill)
-	status = CAIRO_INT_STATUS_UNSUPPORTED;
-    else
-	status = (*surface->target->backend->fill) (surface->target, op,
-						    source, path, fill_rule,
-						    tolerance, antialias);
-    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	surface->fallback = TRUE;
-	status = CAIRO_STATUS_SUCCESS;
-    }
-    return status;
-}
-
-static cairo_int_status_t
-_cairo_analyze_surface_show_glyphs (void		  *abstract_surface,
-				    cairo_operator_t	   op,
-				    cairo_pattern_t	  *source,
-				    const cairo_glyph_t	  *glyphs,
-				    int		   	   num_glyphs,
-				    cairo_scaled_font_t   *scaled_font)
-{
-    cairo_analyze_surface_t *surface = abstract_surface;
-    cairo_status_t	     status;
-
-    if (!surface->target->backend->show_glyphs)
-	status = CAIRO_INT_STATUS_UNSUPPORTED;
-    else
-	status = (*surface->target->backend->show_glyphs) (surface->target, op,
-							   source,
-							   glyphs, num_glyphs,
-							   scaled_font);
-    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
-	surface->fallback = TRUE;
-	status = CAIRO_STATUS_SUCCESS;
-    }
-    return status;
-}
-
-static const cairo_surface_backend_t cairo_analyze_surface_backend = {
-    NULL, /* create_similar */
-    NULL, /* finish_surface */
-    NULL, /* acquire_source_image */
-    NULL, /* release_source_image */
-    NULL, /* acquire_dest_image */
-    NULL, /* release_dest_image */
-    NULL, /* clone_similar */
-    NULL, /* composite */
-    NULL, /* fill_rectangles */
-    NULL, /* composite_trapezoids */
-    NULL, /* copy_page */
-    NULL, /* show_page */
-    NULL, /* set_clip_region */
-    NULL, /* clip_path */
-    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 */
-    _cairo_analyze_surface_paint,
-    _cairo_analyze_surface_mask,
-    _cairo_analyze_surface_stroke,
-    _cairo_analyze_surface_fill,
-    _cairo_analyze_surface_show_glyphs,
-    NULL, /* snapshot */
-};
-
-cairo_private cairo_surface_t *
-_cairo_analyze_surface_create (cairo_surface_t		*target,
-				int			 width,
-				int			 height)
-{
-    cairo_analyze_surface_t *surface;
-
-    surface = malloc (sizeof (cairo_analyze_surface_t));
-    if (surface == NULL)
-	goto FAIL;
-
-    _cairo_surface_init (&surface->base, &cairo_analyze_surface_backend);
-
-    surface->width = width;
-    surface->height = height;
-
-    surface->target = target;
-    surface->fallback = FALSE;
-
-    return &surface->base;
-FAIL:
-    _cairo_error (CAIRO_STATUS_NO_MEMORY);
-    return NULL;
-}
-
-cairo_private pixman_region16_t *
-_cairo_analyze_surface_region_supported (cairo_surface_t *abstract_surface)
-{
-    /* XXX */
-    return NULL;
-}
-
-cairo_private pixman_region16_t *
-_cairo_analyze_surface_region_unsupported (cairo_surface_t *abstract_surface)
-{
-    /* XXX */
-    return NULL;
-}
-
-cairo_private cairo_bool_t
-_cairo_analyze_surface_has_unsupported (cairo_surface_t *abstract_surface)
-{
-    cairo_analyze_surface_t	*surface = (cairo_analyze_surface_t *) abstract_surface;
-
-    return surface->fallback;
-}
-
-
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index a4979c1..80e87ab 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -69,7 +69,7 @@
 
 #include "cairo-paginated-surface-private.h"
 #include "cairo-meta-surface-private.h"
-#include "cairo-analyze-surface-private.h"
+#include "cairo-analysis-surface-private.h"
 
 typedef struct _cairo_paginated_surface {
     cairo_surface_t base;
@@ -201,25 +201,25 @@ _cairo_paginated_surface_release_source_
 static cairo_int_status_t
 _paint_page (cairo_paginated_surface_t *surface)
 {
-    cairo_surface_t *analyze;
+    cairo_surface_t *analysis;
     cairo_surface_t *image;
     cairo_pattern_t *pattern;
     cairo_status_t status;
 
-    analyze = _cairo_analyze_surface_create (surface->target,
-					     surface->width, surface->height);
+    analysis = _cairo_analysis_surface_create (surface->target,
+					       surface->width, surface->height);
 
     surface->funcs->set_mode (surface->target, CAIRO_PAGINATED_MODE_ANALYZE);
-    _cairo_meta_surface_replay (surface->meta, analyze);
+    _cairo_meta_surface_replay (surface->meta, analysis);
     surface->funcs->set_mode (surface->target, CAIRO_PAGINATED_MODE_RENDER);
 
-    if (analyze->status) {
-	status = analyze->status;
-	cairo_surface_destroy (analyze);
+    if (analysis->status) {
+	status = analysis->status;
+	cairo_surface_destroy (analysis);
 	return status;
     }
     
-    if (_cairo_analyze_surface_has_unsupported (analyze))
+    if (_cairo_analysis_surface_has_unsupported (analysis))
     {
 	image = _cairo_image_surface_create_with_content (surface->content,
 							  surface->width,


More information about the cairo-commit mailing list