[cairo-commit] 24 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate-pdf.c boilerplate/cairo-boilerplate-ps.c boilerplate/cairo-boilerplate-ps.h boilerplate/cairo-boilerplate-scaled-font.h boilerplate/cairo-boilerplate-svg.c boilerplate/cairo-boilerplate-svg.h boilerplate/cairo-boilerplate-xlib.c boilerplate/cairo-boilerplate-xlib-private.h boilerplate/Makefile.am doc/public RELEASING src/cairo-analysis-surface.c src/cairo-cache.c src/cairo-cache-private.h src/cairo-hash-private.h src/cairoint.h src/cairo-output-stream-private.h src/cairo-paginated-private.h src/cairo-paginated-surface.c src/cairo-paginated-surface-private.h src/cairo-pdf-surface.c src/cairo-pdf-surface-private.h src/cairo-pdf-test.h src/cairo-ps-surface.c src/cairo-ps-surface-private.h src/cairo-ps-test.h src/cairo-scaled-font.c src/cairo-scaled-font-private.h src/cairo-scaled-font-subsets-private.h src/cairo-scaled-font-test.h src/cairo-surface-private.h src/cairo-svg-surface.c src/cairo-svg-surface-private.h src/cairo-svg-test.h src/cairo-types-private.h src/cairo-xlib-private.h src/cairo-xlib-surface.c src/cairo-xlib-surface-private.h src/cairo-xlib-test.h src/check-def.sh src/Makefile.am src/test-paginated-surface.c test/fallback-resolution.c test/glyph-cache-pressure.c test/xlib-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Apr 21 01:07:14 PDT 2007


 RELEASING                                    |    2 
 boilerplate/Makefile.am                      |    5 
 boilerplate/cairo-boilerplate-pdf.c          |   19 +++
 boilerplate/cairo-boilerplate-ps.c           |   19 +++
 boilerplate/cairo-boilerplate-ps.h           |   33 ++++++
 boilerplate/cairo-boilerplate-scaled-font.h  |   34 ++++++
 boilerplate/cairo-boilerplate-svg.c          |   19 +++
 boilerplate/cairo-boilerplate-svg.h          |   33 ++++++
 boilerplate/cairo-boilerplate-xlib-private.h |   12 +-
 boilerplate/cairo-boilerplate-xlib.c         |   15 ++
 boilerplate/cairo-boilerplate.c              |   11 ++
 doc/public/Headers.mk                        |   13 +-
 src/Makefile.am                              |   15 +-
 src/cairo-analysis-surface.c                 |    2 
 src/cairo-cache-private.h                    |    2 
 src/cairo-cache.c                            |   11 --
 src/cairo-hash-private.h                     |   42 -------
 src/cairo-output-stream-private.h            |    2 
 src/cairo-paginated-private.h                |  136 +++++++++++++++++++++++++
 src/cairo-paginated-surface-private.h        |  127 +++++-------------------
 src/cairo-paginated-surface.c                |   32 ------
 src/cairo-pdf-surface-private.h              |   91 +++++++++++++++++
 src/cairo-pdf-surface.c                      |   81 ++-------------
 src/cairo-pdf-test.h                         |   54 ----------
 src/cairo-ps-surface-private.h               |   80 +++++++++++++++
 src/cairo-ps-surface.c                       |   61 -----------
 src/cairo-ps-test.h                          |   54 ----------
 src/cairo-scaled-font-private.h              |  112 +++++++++++++++++++++
 src/cairo-scaled-font-subsets-private.h      |    2 
 src/cairo-scaled-font-test.h                 |   49 ---------
 src/cairo-scaled-font.c                      |   15 --
 src/cairo-surface-private.h                  |   96 ++++++++++++++++++
 src/cairo-svg-surface-private.h              |   73 +++++++++++++
 src/cairo-svg-surface.c                      |   60 +----------
 src/cairo-svg-test.h                         |   54 ----------
 src/cairo-types-private.h                    |  128 ++++++++++++++++++++++++
 src/cairo-xlib-private.h                     |    1 
 src/cairo-xlib-surface-private.h             |   93 +++++++++++++++++
 src/cairo-xlib-surface.c                     |   77 --------------
 src/cairo-xlib-test.h                        |   54 ----------
 src/cairoint.h                               |  142 ---------------------------
 src/check-def.sh                             |    2 
 src/test-paginated-surface.c                 |    2 
 test/fallback-resolution.c                   |   12 +-
 test/glyph-cache-pressure.c                  |    6 -
 test/xlib-surface.c                          |    8 -
 46 files changed, 1109 insertions(+), 882 deletions(-)

New commits:
diff-tree de425ada871c71277a53687dcd8a93a607d4faab (from 519b722747d606170741ccc520d6ec7332b2481f)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:46:18 2007 -0400

    [doc/public/Headers.mk] Update.

diff --git a/doc/public/Headers.mk b/doc/public/Headers.mk
index 106c998..9b8991d 100644
--- a/doc/public/Headers.mk
+++ b/doc/public/Headers.mk
@@ -13,22 +13,25 @@ PRIVATE_TEST_HFILES = \
 	cairo-mutex-private.h \
 	cairo-os2-private.h \
 	cairo-output-stream-private.h \
+	cairo-paginated-private.h \
 	cairo-paginated-surface-private.h \
 	cairo-path-fixed-private.h \
 	cairo-path-private.h \
-	cairo-pdf-test.h \
+	cairo-pdf-surface-private.h \
 	cairo-private.h \
-	cairo-ps-test.h \
+	cairo-ps-surface-private.h \
 	cairo-quartz-private.h \
+	cairo-scaled-font-private.h \
 	cairo-scaled-font-subsets-private.h \
-	cairo-scaled-font-test.h \
 	cairo-skiplist-private.h \
 	cairo-surface-fallback-private.h \
-	cairo-svg-test.h \
+	cairo-surface-private.h \
+	cairo-svg-surface-private.h \
 	cairo-truetype-subset-private.h \
 	cairo-type1-private.h \
+	cairo-types-private.h \
 	cairo-wideint-private.h \
 	cairo-win32-private.h \
 	cairo-xlib-private.h \
-	cairo-xlib-test.h \
+	cairo-xlib-surface-private.h \
 	cairoint.h
diff-tree 519b722747d606170741ccc520d6ec7332b2481f (from 0108f9c69f2f5391ff6b1066ae6b58fe3f71255a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:45:51 2007 -0400

    [RELEASING] Remove *-test.h from instructions
    as they are all removed now.

diff --git a/RELEASING b/RELEASING
index adc4292..0573b1e 100644
--- a/RELEASING
+++ b/RELEASING
@@ -42,7 +42,7 @@ Here are the steps to follow to create a
 	the following command will show each patch that has changed a
 	public header file since the given version:
 
-		find src/ -name '*.h' ! -name '*-private.h' ! -name '*-test.h' ! -name 'cairoint.h' | \
+		find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' | \
 		xargs git log -p X.Y.Z.. --
 
 4) Increment cairo_version_{minor|micro} and LT_{CURRENT|VERSION|AGE}
diff-tree 0108f9c69f2f5391ff6b1066ae6b58fe3f71255a (from 79098c037043f45df0a18265417e96d6214d68e1)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:44:53 2007 -0400

    [check-def.sh] Do not allow _cairo_.*_test_ symbols anymore
    as all are removed now.

diff --git a/src/check-def.sh b/src/check-def.sh
index 0b8e665..235263d 100755
--- a/src/check-def.sh
+++ b/src/check-def.sh
@@ -27,7 +27,7 @@ for def in $defs; do
 
 	{
 		echo EXPORTS
-		eval $get_cairo_syms | grep -v '^_cairo_.*test_\|^_fini\|^_init' | sort -u
+		eval $get_cairo_syms | grep -v '^_cairo_test_\|^_fini\|^_init' | sort -u
 		# cheat: copy the last line from the def file!
 		tail -n1 $def
 	} | diff $def - || status=1
diff-tree 79098c037043f45df0a18265417e96d6214d68e1 (from 44563161de82a5ee7bbf8f100213ea1a3af6d5db)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:43:04 2007 -0400

    [scaled-font] Get rid of _cairo_scaled_font_test_set_max_glyphs_cached_per_font
    in favor of cairo_boilerplate_scaled_font_set_max_glyphs_cached.

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 08f8bb2..a55412a 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -3,6 +3,7 @@ EXTRA_LTLIBRARIES = libcairoboilerplate.
 libcairoboilerplate_la_SOURCES =\
 cairo-boilerplate.c	\
 cairo-boilerplate.h	\
+cairo-boilerplate-scaled-font.h	\
 xmalloc.c		\
 xmalloc.h
 libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la $(CAIRO_LDADD)
diff --git a/boilerplate/cairo-boilerplate-scaled-font.h b/boilerplate/cairo-boilerplate-scaled-font.h
new file mode 100644
index 0000000..4d27cd0
--- /dev/null
+++ b/boilerplate/cairo-boilerplate-scaled-font.h
@@ -0,0 +1,34 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Behdad Esfahbod <behdad at behdad.org>
+ */
+
+#ifndef _CAIRO_BOILERPLATE_SCALED_FONT_H_
+#define _CAIRO_BOILERPLATE_SCALED_FONT_H_
+
+void
+cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_scaled_font_t *scaled_font,
+						     int max_glyphs);
+
+#endif
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 2a6d31c..5c86a1d 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -25,6 +25,7 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-scaled-font.h"
 
 #if CAIRO_HAS_BEOS_SURFACE
 #include "cairo-boilerplate-beos-private.h"
@@ -60,6 +61,9 @@
 #include "cairo-boilerplate-xlib-private.h"
 #endif
 
+#include <cairo-types-private.h>
+#include <cairo-scaled-font-private.h>
+
 #include <stdlib.h>
 #include <ctype.h>
 #include <assert.h>
@@ -434,3 +438,10 @@ cairo_boilerplate_surface_set_user_data 
 	exit (1);
     }
 }
+
+void
+cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_scaled_font_t *scaled_font,
+						     int max_glyphs)
+{
+    scaled_font->glyphs->max_size = max_glyphs;
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index c4dd4a6..554c4fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -205,7 +205,6 @@ libcairo_la_SOURCES =				\
 	cairo-rectangle.c			\
 	cairo-region.c				\
 	cairo-scaled-font.c			\
-	cairo-scaled-font-test.h		\
 	cairo-scaled-font-private.h		\
 	cairo-skiplist.c			\
 	cairo-skiplist-private.h		\
diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h
index 32d7854..6ff416d 100644
--- a/src/cairo-scaled-font-private.h
+++ b/src/cairo-scaled-font-private.h
@@ -41,6 +41,7 @@
 #include "cairo.h"
 
 #include "cairo-types-private.h"
+#include "cairo-mutex-private.h"
 
 struct _cairo_scaled_font {
     /* For most cairo objects, the rule for multiple threads is that
diff --git a/src/cairo-scaled-font-test.h b/src/cairo-scaled-font-test.h
deleted file mode 100644
index 0304078..0000000
--- a/src/cairo-scaled-font-test.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2006 Red Hat, Inc.
- *
- * 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 University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_SCALED_FONT_TEST_H
-#define CAIRO_SCALED_FONT_TEST_H
-
-#include <cairo.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public void
-_cairo_scaled_font_test_set_max_glyphs_cached_per_font (int max);
-
-CAIRO_END_DECLS
-
-#endif /* CAIRO_SCALED_FONT_TEST_H */
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 41f3ddb..e3ad070 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -38,7 +38,6 @@
 
 #include "cairoint.h"
 #include "cairo-scaled-font-private.h"
-#include "cairo-scaled-font-test.h"
 
 static cairo_bool_t
 _cairo_scaled_glyph_keys_equal (const void *abstract_key_a, const void *abstract_key_b)
@@ -332,14 +331,7 @@ _cairo_scaled_font_keys_equal (const voi
  * separately is probably not what we want anyway. Would probably be
  * much better to have a single cache for glyphs with random
  * replacement across all glyphs of all fonts. */
-static int max_glyphs_cached_per_font = 256;
-
-/* For internal testing purposes only. Not part of the supported API. */
-void
-_cairo_scaled_font_test_set_max_glyphs_cached_per_font (int max)
-{
-    max_glyphs_cached_per_font = max;
-}
+#define MAX_GLYPHS_CACHED_PER_FONT 256
 
 /*
  * Basic cairo_scaled_font_t object management
@@ -372,7 +364,7 @@ _cairo_scaled_font_init (cairo_scaled_fo
 
     scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
 					       _cairo_scaled_glyph_destroy,
-					       max_glyphs_cached_per_font);
+					       MAX_GLYPHS_CACHED_PER_FONT);
     if (scaled_font->glyphs == NULL)
 	return CAIRO_STATUS_NO_MEMORY;
 
@@ -410,7 +402,7 @@ _cairo_scaled_font_reset_cache (cairo_sc
     _cairo_cache_destroy (scaled_font->glyphs);
     scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
 					       _cairo_scaled_glyph_destroy,
-					       max_glyphs_cached_per_font);
+					       MAX_GLYPHS_CACHED_PER_FONT);
 }
 
 void
diff --git a/test/glyph-cache-pressure.c b/test/glyph-cache-pressure.c
index ba90fa3..72044ee 100644
--- a/test/glyph-cache-pressure.c
+++ b/test/glyph-cache-pressure.c
@@ -24,7 +24,7 @@
  */
 
 #include "cairo-test.h"
-#include "cairo-scaled-font-test.h"
+#include "cairo-boilerplate-scaled-font.h"
 
 #define TEXT_SIZE 12
 
@@ -67,8 +67,6 @@ draw (cairo_t *cr, int width, int height
     cairo_paint (cr);
     cairo_restore (cr);
 
-    _cairo_scaled_font_test_set_max_glyphs_cached_per_font (1);
-
     cairo_select_font_face (cr, "Bitstream Vera Sans",
 			    CAIRO_FONT_SLANT_NORMAL,
 			    CAIRO_FONT_WEIGHT_NORMAL);
@@ -76,6 +74,8 @@ draw (cairo_t *cr, int width, int height
 
     cairo_set_source_rgb (cr, 0, 0, 0); /* black */
 
+    cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_get_scaled_font (cr), 1);
+
     cairo_move_to (cr, 1, TEXT_SIZE);
     cairo_show_text (cr, "the five boxing wizards jump quickly");
 
diff-tree 44563161de82a5ee7bbf8f100213ea1a3af6d5db (from 737d20a5702a18a1480c3b45f876e886b82b065c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:38:24 2007 -0400

    Move a couple typedefs to cairo-types-private.h

diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index bbbc337..37b131e 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -114,6 +114,8 @@ typedef struct _cairo_clip cairo_clip_t;
 typedef struct _cairo_output_stream cairo_output_stream_t;
 typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
 typedef struct _cairo_paginated_surface_backend cairo_paginated_surface_backend_t;
+typedef struct _cairo_scaled_font_backend   cairo_scaled_font_backend_t;
+typedef struct _cairo_font_face_backend     cairo_font_face_backend_t;
 
 
 typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
diff --git a/src/cairoint.h b/src/cairoint.h
index 7fbbe04..eba7398 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -469,8 +469,6 @@ cairo_private unsigned long
 _cairo_hash_string (const char *c);
 
 typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
-typedef struct _cairo_scaled_font_backend   cairo_scaled_font_backend_t;
-typedef struct _cairo_font_face_backend     cairo_font_face_backend_t;
 
 /*
  * A cairo_unscaled_font_t is just an opaque handle we use in the
diff-tree 737d20a5702a18a1480c3b45f876e886b82b065c (from 51ce92c3db093c8d26c8002ddbc105b11e7607bf)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:35:07 2007 -0400

    Move cairo_hash_entry_t to cairo-types-private.h

diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h
index b3593df..8ed3ba8 100644
--- a/src/cairo-hash-private.h
+++ b/src/cairo-hash-private.h
@@ -46,44 +46,6 @@
  * monolithic cairoint.h. So, for now, just include cairoint.h instead
  * if you want to include this file. */
 
-/**
- * cairo_hash_entry_t:
- *
- * A #cairo_hash_entry_t contains both a key and a value for
- * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must
- * be type-compatible with this structure (eg. they must have an
- * unsigned long as the first parameter. The easiest way to get this
- * is to use:
- *
- * 	typedef _my_entry {
- *	    cairo_hash_entry_t base;
- *	    ... Remainder of key and value fields here ..
- *	} my_entry_t;
- *
- * which then allows a pointer to my_entry_t to be passed to any of
- * the cairo_hash_table functions as follows without requiring a cast:
- *
- *	_cairo_hash_table_insert (hash_table, &my_entry->base);
- *
- * IMPORTANT: The caller is reponsible for initializing
- * my_entry->base.hash with a hash code derived from the key. The
- * essential property of the hash code is that keys_equal must never
- * return TRUE for two keys that have different hashes. The best hash
- * code will reduce the frequency of two keys with the same code for
- * which keys_equal returns FALSE.
- *
- * Which parts of the entry make up the "key" and which part make up
- * the value are entirely up to the caller, (as determined by the
- * computation going into base.hash as well as the keys_equal
- * function). A few of the cairo_hash_table functions accept an entry
- * which will be used exclusively as a "key", (indicated by a
- * parameter name of key). In these cases, the value-related fields of
- * the entry need not be initialized if so desired.
- **/
-typedef struct _cairo_hash_entry {
-    unsigned long hash;
-} cairo_hash_entry_t;
-
 typedef cairo_bool_t
 (*cairo_hash_keys_equal_func_t) (const void *key_a, const void *key_b);
 
diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h
index a73110e..32d7854 100644
--- a/src/cairo-scaled-font-private.h
+++ b/src/cairo-scaled-font-private.h
@@ -40,6 +40,8 @@
 
 #include "cairo.h"
 
+#include "cairo-types-private.h"
+
 struct _cairo_scaled_font {
     /* For most cairo objects, the rule for multiple threads is that
      * the user is responsible for any locking if the same object is
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 0300182..bbbc337 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -70,6 +70,44 @@ typedef struct _cairo_cache {
     int freeze_count;
 } cairo_cache_t;
 
+/**
+ * cairo_hash_entry_t:
+ *
+ * A #cairo_hash_entry_t contains both a key and a value for
+ * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must
+ * be type-compatible with this structure (eg. they must have an
+ * unsigned long as the first parameter. The easiest way to get this
+ * is to use:
+ *
+ * 	typedef _my_entry {
+ *	    cairo_hash_entry_t base;
+ *	    ... Remainder of key and value fields here ..
+ *	} my_entry_t;
+ *
+ * which then allows a pointer to my_entry_t to be passed to any of
+ * the cairo_hash_table functions as follows without requiring a cast:
+ *
+ *	_cairo_hash_table_insert (hash_table, &my_entry->base);
+ *
+ * IMPORTANT: The caller is reponsible for initializing
+ * my_entry->base.hash with a hash code derived from the key. The
+ * essential property of the hash code is that keys_equal must never
+ * return TRUE for two keys that have different hashes. The best hash
+ * code will reduce the frequency of two keys with the same code for
+ * which keys_equal returns FALSE.
+ *
+ * Which parts of the entry make up the "key" and which part make up
+ * the value are entirely up to the caller, (as determined by the
+ * computation going into base.hash as well as the keys_equal
+ * function). A few of the cairo_hash_table functions accept an entry
+ * which will be used exclusively as a "key", (indicated by a
+ * parameter name of key). In these cases, the value-related fields of
+ * the entry need not be initialized if so desired.
+ **/
+typedef struct _cairo_hash_entry {
+    unsigned long hash;
+} cairo_hash_entry_t;
+
 
 typedef struct _cairo_surface_backend cairo_surface_backend_t;
 typedef struct _cairo_clip cairo_clip_t;
diff-tree 51ce92c3db093c8d26c8002ddbc105b11e7607bf (from 91f1056caf46d71c99eb044afbc943b92fb5550c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:24:31 2007 -0400

    [scaled-font] Move cairo_scaled_font_t to cairo-scaled-font-private.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 9a8e51f..c4dd4a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -206,6 +206,7 @@ libcairo_la_SOURCES =				\
 	cairo-region.c				\
 	cairo-scaled-font.c			\
 	cairo-scaled-font-test.h		\
+	cairo-scaled-font-private.h		\
 	cairo-skiplist.c			\
 	cairo-skiplist-private.h		\
 	cairo-slope.c				\
diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h
new file mode 100644
index 0000000..a73110e
--- /dev/null
+++ b/src/cairo-scaled-font-private.h
@@ -0,0 +1,109 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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 University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ */
+
+#ifndef CAIRO_SCALED_FONT_PRIVATE_H
+#define CAIRO_SCALED_FONT_PRIVATE_H
+
+#include "cairo.h"
+
+struct _cairo_scaled_font {
+    /* For most cairo objects, the rule for multiple threads is that
+     * the user is responsible for any locking if the same object is
+     * manipulated from multiple threads simultaneously.
+     *
+     * However, with the caching that cairo does for scaled fonts, a
+     * user can easily end up with the same cairo_scaled_font object
+     * being manipulated from multiple threads without the user ever
+     * being aware of this, (and in fact, unable to control it).
+     *
+     * So, as a special exception, the cairo implementation takes care
+     * of all locking needed for cairo_scaled_font_t. Most of what is
+     * in the scaled font is immutable, (which is what allows for the
+     * sharing in the first place). The things that are modified and
+     * the locks protecting them are as follows:
+     *
+     * 1. The reference count (scaled_font->ref_count)
+     *
+     *    Modifications to the reference count are protected by the
+     *    _cairo_scaled_font_map_mutex. This is because the reference
+     *    count of a scaled font is intimately related with the font
+     *    map itself, (and the magic holdovers array).
+     *
+     * 2. The cache of glyphs (scaled_font->glyphs)
+     * 3. The backend private data (scaled_font->surface_backend,
+     *				    scaled_font->surface_private)
+     *
+     *    Modifications to these fields are protected with locks on
+     *    scaled_font->mutex in the generic scaled_font code.
+     */
+
+    /* must be first to be stored in a hash table */
+    cairo_hash_entry_t hash_entry;
+
+    /* useful bits for _cairo_scaled_font_nil */
+    cairo_status_t status;
+    unsigned int ref_count;
+    cairo_user_data_array_t user_data;
+
+    /* hash key members */
+    cairo_font_face_t *font_face; /* may be NULL */
+    cairo_matrix_t font_matrix;	  /* font space => user space */
+    cairo_matrix_t ctm;	          /* user space => device space */
+    cairo_font_options_t options;
+
+    /* "live" scaled_font members */
+    cairo_matrix_t scale;	  /* font space => device space */
+    cairo_font_extents_t extents; /* user space */
+
+    /* The mutex protects modification to all subsequent fields. */
+    cairo_mutex_t mutex;
+
+    cairo_cache_t *glyphs;	  /* glyph index -> cairo_scaled_glyph_t */
+
+    /*
+     * One surface backend may store data in each glyph.
+     * Whichever surface manages to store its pointer here
+     * first gets to store data in each glyph
+     */
+    const cairo_surface_backend_t *surface_backend;
+    void *surface_private;
+
+    /* font backend managing this scaled font */
+    const cairo_scaled_font_backend_t *backend;
+};
+
+#endif /* CAIRO_SCALED_FONT_PRIVATE_H */
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 48d93e4..41f3ddb 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -37,6 +37,7 @@
  */
 
 #include "cairoint.h"
+#include "cairo-scaled-font-private.h"
 #include "cairo-scaled-font-test.h"
 
 static cairo_bool_t
diff --git a/src/cairoint.h b/src/cairoint.h
index 49949e5..7fbbe04 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -497,71 +497,7 @@ typedef struct _cairo_scaled_glyph {
 #define _cairo_scaled_glyph_index(g) ((g)->cache_entry.hash)
 #define _cairo_scaled_glyph_set_index(g,i)  ((g)->cache_entry.hash = (i))
 
-struct _cairo_scaled_font {
-    /* For most cairo objects, the rule for multiple threads is that
-     * the user is responsible for any locking if the same object is
-     * manipulated from multiple threads simultaneously.
-     *
-     * However, with the caching that cairo does for scaled fonts, a
-     * user can easily end up with the same cairo_scaled_font object
-     * being manipulated from multiple threads without the user ever
-     * being aware of this, (and in fact, unable to control it).
-     *
-     * So, as a special exception, the cairo implementation takes care
-     * of all locking needed for cairo_scaled_font_t. Most of what is
-     * in the scaled font is immutable, (which is what allows for the
-     * sharing in the first place). The things that are modified and
-     * the locks protecting them are as follows:
-     *
-     * 1. The reference count (scaled_font->ref_count)
-     *
-     *    Modifications to the reference count are protected by the
-     *    _cairo_scaled_font_map_mutex. This is because the reference
-     *    count of a scaled font is intimately related with the font
-     *    map itself, (and the magic holdovers array).
-     *
-     * 2. The cache of glyphs (scaled_font->glyphs)
-     * 3. The backend private data (scaled_font->surface_backend,
-     *				    scaled_font->surface_private)
-     *
-     *    Modifications to these fields are protected with locks on
-     *    scaled_font->mutex in the generic scaled_font code.
-     */
-
-    /* must be first to be stored in a hash table */
-    cairo_hash_entry_t hash_entry;
-
-    /* useful bits for _cairo_scaled_font_nil */
-    cairo_status_t status;
-    unsigned int ref_count;
-    cairo_user_data_array_t user_data;
-
-    /* hash key members */
-    cairo_font_face_t *font_face; /* may be NULL */
-    cairo_matrix_t font_matrix;	  /* font space => user space */
-    cairo_matrix_t ctm;	          /* user space => device space */
-    cairo_font_options_t options;
-
-    /* "live" scaled_font members */
-    cairo_matrix_t scale;	  /* font space => device space */
-    cairo_font_extents_t extents; /* user space */
-
-    /* The mutex protects modification to all subsequent fields. */
-    cairo_mutex_t mutex;
-
-    cairo_cache_t *glyphs;	  /* glyph index -> cairo_scaled_glyph_t */
-
-    /*
-     * One surface backend may store data in each glyph.
-     * Whichever surface manages to store its pointer here
-     * first gets to store data in each glyph
-     */
-    const cairo_surface_backend_t *surface_backend;
-    void *surface_private;
-
-    /* font backend managing this scaled font */
-    const cairo_scaled_font_backend_t *backend;
-};
+#include "cairo-scaled-font-private.h"
 
 struct _cairo_font_face {
     /* hash_entry must be first */
diff-tree 91f1056caf46d71c99eb044afbc943b92fb5550c (from d2bb5f30079badf1029fa71faab9d6781092a271)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:18:30 2007 -0400

    Move cairo_cache_t to cairo-types-private.h

diff --git a/src/cairo-cache-private.h b/src/cairo-cache-private.h
index 566dbe2..7ab14e2 100644
--- a/src/cairo-cache-private.h
+++ b/src/cairo-cache-private.h
@@ -39,7 +39,7 @@
 #ifndef CAIRO_CACHE_PRIVATE_H
 #define CAIRO_CACHE_PRIVATE_H
 
-typedef struct _cairo_cache cairo_cache_t;
+#include "cairo-types-private.h"
 
 /**
  * cairo_cache_entry_t:
diff --git a/src/cairo-cache.c b/src/cairo-cache.c
index fa1f003..18c3d8c 100644
--- a/src/cairo-cache.c
+++ b/src/cairo-cache.c
@@ -38,17 +38,6 @@
 
 #include "cairoint.h"
 
-struct _cairo_cache {
-    cairo_hash_table_t *hash_table;
-
-    cairo_destroy_func_t entry_destroy;
-
-    unsigned long max_size;
-    unsigned long size;
-
-    int freeze_count;
-};
-
 static void
 _cairo_cache_remove (cairo_cache_t	 *cache,
 		     cairo_cache_entry_t *entry);
diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h
index 617b841..b3593df 100644
--- a/src/cairo-hash-private.h
+++ b/src/cairo-hash-private.h
@@ -39,13 +39,13 @@
 #ifndef CAIRO_HASH_PRIVATE_H
 #define CAIRO_HASH_PRIVATE_H
 
+#include "cairo-types-private.h"
+
 /* XXX: I'd like this file to be self-contained in terms of
  * includeability, but that's not really possible with the current
  * monolithic cairoint.h. So, for now, just include cairoint.h instead
  * if you want to include this file. */
 
-typedef struct _cairo_hash_table cairo_hash_table_t;
-
 /**
  * cairo_hash_entry_t:
  *
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 7f51ec1..0300182 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -57,6 +57,20 @@ struct _cairo_font_options {
     cairo_hint_metrics_t hint_metrics;
 };
 
+typedef struct _cairo_hash_table cairo_hash_table_t;
+
+typedef struct _cairo_cache {
+    cairo_hash_table_t *hash_table;
+
+    cairo_destroy_func_t entry_destroy;
+
+    unsigned long max_size;
+    unsigned long size;
+
+    int freeze_count;
+} cairo_cache_t;
+
+
 typedef struct _cairo_surface_backend cairo_surface_backend_t;
 typedef struct _cairo_clip cairo_clip_t;
 typedef struct _cairo_output_stream cairo_output_stream_t;
diff-tree d2bb5f30079badf1029fa71faab9d6781092a271 (from ea1b7c2d8a55d694d575c0bb711e60f70a33ff77)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:08:26 2007 -0400

    [svg] Get rid of _cairo_svg_test_force_fallbacks
    in favor of cairo_boilerplate_svg_surface_force_fallbacks.

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 1528409..08f8bb2 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -55,6 +55,7 @@ endif
 
 if CAIRO_HAS_SVG_SURFACE
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg.c
+libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg.h
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg-private.h
 endif
 
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index cc344c9..b85a95e 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -25,9 +25,12 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-svg.h"
 #include "cairo-boilerplate-svg-private.h"
 
 #include <cairo-svg.h>
+#include <cairo-svg-surface-private.h>
+#include <cairo-paginated-surface-private.h>
 
 cairo_user_data_key_t	svg_closure_key;
 
@@ -127,3 +130,19 @@ _cairo_boilerplate_svg_cleanup (void *cl
     free (ptc->filename);
     free (ptc);
 }
+
+cairo_status_t
+cairo_boilerplate_svg_surface_force_fallbacks (cairo_surface_t *abstract_surface)
+{
+    cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
+    cairo_svg_surface_t *surface;
+
+    if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PDF)
+	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+    surface = (cairo_svg_surface_t*) paginated->target;
+
+    surface->force_fallbacks = TRUE;
+
+    return CAIRO_STATUS_SUCCESS;
+}
diff --git a/boilerplate/cairo-boilerplate-svg.h b/boilerplate/cairo-boilerplate-svg.h
new file mode 100644
index 0000000..1229916
--- /dev/null
+++ b/boilerplate/cairo-boilerplate-svg.h
@@ -0,0 +1,33 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Behdad Esfahbod <behdad at behdad.org>
+ */
+
+#ifndef _CAIRO_BOILERPLATE_SVG_H_
+#define _CAIRO_BOILERPLATE_SVG_H_
+
+cairo_status_t
+cairo_boilerplate_svg_surface_force_fallbacks (cairo_surface_t *surface);
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index b7bfaf5..9a8e51f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,7 @@ endif
 if CAIRO_HAS_PDF_SURFACE
 libcairo_pdf_headers = cairo-pdf.h
 libcairo_pdf_sources = cairo-pdf-surface.c cairo-pdf-surface-private.h \
-		       cairo-deflate-stream.c cairo-pdf-test.h
+		       cairo-deflate-stream.c
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-pdf.pc
 endif
@@ -34,7 +34,7 @@ endif
 
 if CAIRO_HAS_SVG_SURFACE
 libcairo_svg_headers = cairo-svg.h
-libcairo_svg_sources = cairo-svg-surface.c cairo-svg-surface-private.h cairo-svg-test.h
+libcairo_svg_sources = cairo-svg-surface.c cairo-svg-surface-private.h
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-svg.pc
 endif
diff --git a/src/cairo-svg-surface-private.h b/src/cairo-svg-surface-private.h
index 5699350..c2b2206 100644
--- a/src/cairo-svg-surface-private.h
+++ b/src/cairo-svg-surface-private.h
@@ -66,6 +66,8 @@ typedef struct cairo_svg_surface {
     unsigned int base_clip;
 
     cairo_paginated_mode_t paginated_mode;
+
+    cairo_bool_t force_fallbacks;
 } cairo_svg_surface_t;
 
 #endif /* CAIRO_SVG_SURFACE_PRIVATE_H */
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 3c7157c..e1230c3 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -41,7 +41,6 @@
 #include "cairoint.h"
 #include "cairo-svg.h"
 #include "cairo-svg-surface-private.h"
-#include "cairo-svg-test.h"
 #include "cairo-path-fixed-private.h"
 #include "cairo-meta-surface-private.h"
 #include "cairo-paginated-private.h"
@@ -376,6 +375,7 @@ _cairo_svg_surface_create_for_document (
     }
 
     surface->paginated_mode = CAIRO_PAGINATED_MODE_ANALYZE;
+    surface->force_fallbacks = FALSE;
     surface->content = content;
 
     return _cairo_paginated_surface_create (&surface->base,
@@ -704,24 +704,6 @@ _cairo_svg_document_emit_font_subsets (c
 
 static cairo_bool_t cairo_svg_force_fallbacks = FALSE;
 
-/**
- * _cairo_svg_test_force_fallbacks
- *
- * Force the SVG surface backend to use image fallbacks for every
- * operation.
- *
- * <note>
- * This function is <emphasis>only</emphasis> intended for internal
- * testing use within the cairo distribution. It is not installed in
- * any public header file.
- * </note>
- **/
-void
-_cairo_svg_test_force_fallbacks (void)
-{
-    cairo_svg_force_fallbacks = TRUE;
-}
-
 static cairo_int_status_t
 _cairo_svg_surface_operation_supported (cairo_svg_surface_t *surface,
 		      cairo_operator_t op,
diff --git a/src/cairo-svg-test.h b/src/cairo-svg-test.h
deleted file mode 100644
index 396d459..0000000
--- a/src/cairo-svg-test.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2006 Red Hat, Inc.
- *
- * 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 University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_SVG_TEST_H
-#define CAIRO_SVG_TEST_H
-
-#include <cairo.h>
-
-#if CAIRO_HAS_SVG_SURFACE
-
-#include <cairo-svg.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public void
-_cairo_svg_test_force_fallbacks (void);
-
-CAIRO_END_DECLS
-
-#endif /* CAIRO_HAS_SVG_SURFACE */
-#endif /* CAIRO_SVG_TEST_H */
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index a5359e6..37fd591 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -33,7 +33,7 @@
 #include <cairo-boilerplate-ps.h>
 
 #include <cairo-svg.h>
-#include <cairo-svg-test.h>
+#include <cairo-boilerplate-svg.h>
 
 #include "cairo-test.h"
 
@@ -113,8 +113,8 @@ main (void)
 	case SVG:
 	    surface = cairo_svg_surface_create (backend_filename[backend],
 						SIZE, SIZE);
+	    cairo_boilerplate_svg_surface_force_fallbacks (surface);
 	    cairo_svg_surface_restrict_to_version (surface, CAIRO_SVG_VERSION_1_2);
-	    _cairo_svg_test_force_fallbacks ();
 	    break;
 	}
 
diff-tree ea1b7c2d8a55d694d575c0bb711e60f70a33ff77 (from 7e0ae8bd43dfd8b052d021601912b46956b2921e)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 03:04:03 2007 -0400

    [paginated] Include cairo-surface-private.h

diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index e489026..b406cac 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -38,6 +38,8 @@
 
 #include "cairo.h"
 
+#include "cairo-surface-private.h"
+
 typedef struct _cairo_paginated_surface {
     cairo_surface_t base;
 
diff-tree 7e0ae8bd43dfd8b052d021601912b46956b2921e (from 3885fff3e6215023e801dd2c72fc39560a4e22fd)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 02:57:55 2007 -0400

    [svg] Move cairo_svg_surface_t to cairo-svg-surface-private.h

diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 291ac2e..0e7a764 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -30,6 +30,7 @@
 
 #include <cairo-ps.h>
 #include <cairo-ps-surface-private.h>
+#include <cairo-paginated-surface-private.h>
 
 cairo_user_data_key_t	ps_closure_key;
 
@@ -142,11 +143,14 @@ _cairo_boilerplate_ps_cleanup (void *clo
 cairo_status_t
 cairo_boilerplate_ps_surface_force_fallbacks (cairo_surface_t *abstract_surface)
 {
-    cairo_ps_surface_t *surface = (cairo_ps_surface_t*) abstract_surface;
+    cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
+    cairo_ps_surface_t *surface;
 
     if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PS)
 	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
 
+    surface = (cairo_ps_surface_t*) paginated->target;
+
     surface->force_fallbacks = TRUE;
 
     return CAIRO_STATUS_SUCCESS;
diff --git a/src/Makefile.am b/src/Makefile.am
index d3ab669..b7bfaf5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,7 @@ endif
 
 if CAIRO_HAS_SVG_SURFACE
 libcairo_svg_headers = cairo-svg.h
-libcairo_svg_sources = cairo-svg-surface.c cairo-svg-test.h
+libcairo_svg_sources = cairo-svg-surface.c cairo-svg-surface-private.h cairo-svg-test.h
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-svg.pc
 endif
diff --git a/src/cairo-svg-surface-private.h b/src/cairo-svg-surface-private.h
new file mode 100644
index 0000000..5699350
--- /dev/null
+++ b/src/cairo-svg-surface-private.h
@@ -0,0 +1,71 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2004 Red Hat, Inc
+ * Copyright © 2005-2006 Emmanuel Pacaud <emmanuel.pacaud at free.fr>
+ * Copyright © 2006 Red Hat, Inc
+ *
+ * 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 University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Kristian Høgsberg <krh at redhat.com>
+ * 	Emmanuel Pacaud <emmanuel.pacaud at univ-poitiers.fr>
+ *	Carl Worth <cworth at cworth.org>
+ */
+
+#ifndef CAIRO_SVG_SURFACE_PRIVATE_H
+#define CAIRO_SVG_SURFACE_PRIVATE_H
+
+#include "cairo-svg.h"
+
+#include "cairo-surface-private.h"
+
+typedef struct cairo_svg_document cairo_svg_document_t;
+
+typedef struct cairo_svg_surface {
+    cairo_surface_t base;
+
+    cairo_content_t content;
+
+    unsigned int id;
+
+    double width;
+    double height;
+
+    cairo_svg_document_t *document;
+
+    cairo_output_stream_t *xml_node;
+    cairo_array_t	   page_set;
+
+    unsigned int clip_level;
+    unsigned int base_clip;
+
+    cairo_paginated_mode_t paginated_mode;
+} cairo_svg_surface_t;
+
+#endif /* CAIRO_SVG_SURFACE_PRIVATE_H */
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 24a990c..3c7157c 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -40,6 +40,7 @@
 
 #include "cairoint.h"
 #include "cairo-svg.h"
+#include "cairo-svg-surface-private.h"
 #include "cairo-svg-test.h"
 #include "cairo-path-fixed-private.h"
 #include "cairo-meta-surface-private.h"
@@ -47,8 +48,6 @@
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-output-stream-private.h"
 
-typedef struct cairo_svg_document cairo_svg_document_t;
-typedef struct cairo_svg_surface cairo_svg_surface_t;
 typedef struct cairo_svg_page cairo_svg_page_t;
 
 static const int invalid_pattern_id = -1;
@@ -115,27 +114,6 @@ struct cairo_svg_document {
     cairo_scaled_font_subsets_t *font_subsets;
 };
 
-struct cairo_svg_surface {
-    cairo_surface_t base;
-
-    cairo_content_t content;
-
-    unsigned int id;
-
-    double width;
-    double height;
-
-    cairo_svg_document_t *document;
-
-    cairo_output_stream_t *xml_node;
-    cairo_array_t	   page_set;
-
-    unsigned int clip_level;
-    unsigned int base_clip;
-
-    cairo_paginated_mode_t paginated_mode;
-};
-
 typedef struct {
     unsigned int id;
     cairo_meta_surface_t *meta;
diff-tree 3885fff3e6215023e801dd2c72fc39560a4e22fd (from 57dc972d6e5fe715a83cbcaad9c6cc3d38bf8129)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 03:33:58 2007 -0400

    [ps] Get rid of _cairo_ps_test_force_fallbacks
    
    in favor of cairo_boilerplate_ps_surface_force_fallbacks.

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 8092c1b..1528409 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -44,6 +44,7 @@ endif
 
 if CAIRO_HAS_PS_SURFACE
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps.c
+libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps.h
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps-private.h
 endif
 
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 676d3e8..291ac2e 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -25,9 +25,11 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-ps.h"
 #include "cairo-boilerplate-ps-private.h"
 
 #include <cairo-ps.h>
+#include <cairo-ps-surface-private.h>
 
 cairo_user_data_key_t	ps_closure_key;
 
@@ -136,3 +138,16 @@ _cairo_boilerplate_ps_cleanup (void *clo
     free (ptc->filename);
     free (ptc);
 }
+
+cairo_status_t
+cairo_boilerplate_ps_surface_force_fallbacks (cairo_surface_t *abstract_surface)
+{
+    cairo_ps_surface_t *surface = (cairo_ps_surface_t*) abstract_surface;
+
+    if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PS)
+	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+    surface->force_fallbacks = TRUE;
+
+    return CAIRO_STATUS_SUCCESS;
+}
diff --git a/boilerplate/cairo-boilerplate-ps.h b/boilerplate/cairo-boilerplate-ps.h
new file mode 100644
index 0000000..5cc5c18
--- /dev/null
+++ b/boilerplate/cairo-boilerplate-ps.h
@@ -0,0 +1,33 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Behdad Esfahbod <behdad at behdad.org>
+ */
+
+#ifndef _CAIRO_BOILERPLATE_PS_H_
+#define _CAIRO_BOILERPLATE_PS_H_
+
+cairo_status_t
+cairo_boilerplate_ps_surface_force_fallbacks (cairo_surface_t *surface);
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 48fdb07..d3ab669 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,7 @@ backend_pkgconfigs =
 
 if CAIRO_HAS_PS_SURFACE
 libcairo_ps_headers = cairo-ps.h
-libcairo_ps_sources = cairo-ps-surface.c cairo-pdf-surface-private.h cairo-ps-test.h
+libcairo_ps_sources = cairo-ps-surface.c cairo-pdf-surface-private.h
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-ps.pc
 endif
diff --git a/src/cairo-ps-surface-private.h b/src/cairo-ps-surface-private.h
index 27d1779..2499b99 100644
--- a/src/cairo-ps-surface-private.h
+++ b/src/cairo-ps-surface-private.h
@@ -66,6 +66,8 @@ typedef struct cairo_ps_surface {
 
     cairo_paginated_mode_t paginated_mode;
 
+    cairo_bool_t force_fallbacks;
+
     cairo_scaled_font_subsets_t *font_subsets;
 
     cairo_array_t dsc_header_comments;
@@ -73,7 +75,6 @@ typedef struct cairo_ps_surface {
     cairo_array_t dsc_page_setup_comments;
 
     cairo_array_t *dsc_comment_target;
-
 } cairo_ps_surface_t;
 
 #endif /* CAIRO_PS_SURFACE_PRIVATE_H */
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f1e2cc8..87566d2 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -40,7 +40,6 @@
 #include "cairoint.h"
 #include "cairo-ps.h"
 #include "cairo-ps-surface-private.h"
-#include "cairo-ps-test.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-paginated-private.h"
 #include "cairo-meta-surface-private.h"
@@ -790,6 +789,7 @@ _cairo_ps_surface_create_for_stream_inte
     surface->max_width = width;
     surface->max_height = height;
     surface->paginated_mode = CAIRO_PAGINATED_MODE_ANALYZE;
+    surface->force_fallbacks = FALSE;
 
     surface->num_pages = 0;
 
@@ -1352,32 +1352,12 @@ pattern_supported (const cairo_pattern_t
     return FALSE;
 }
 
-static cairo_bool_t cairo_ps_force_fallbacks = FALSE;
-
-/**
- * _cairo_ps_test_force_fallbacks
- *
- * Force the PS surface backend to use image fallbacks for every
- * operation.
- *
- * <note>
- * This function is <emphasis>only</emphasis> intended for internal
- * testing use within the cairo distribution. It is not installed in
- * any public header file.
- * </note>
- **/
-void
-_cairo_ps_test_force_fallbacks (void)
-{
-    cairo_ps_force_fallbacks = TRUE;
-}
-
 static cairo_int_status_t
 _cairo_ps_surface_operation_supported (cairo_ps_surface_t *surface,
 		      cairo_operator_t op,
 		      const cairo_pattern_t *pattern)
 {
-    if (cairo_ps_force_fallbacks)
+    if (surface->force_fallbacks)
 	return FALSE;
 
     if (! pattern_supported (pattern))
diff --git a/src/cairo-ps-test.h b/src/cairo-ps-test.h
deleted file mode 100644
index 5d49ece..0000000
--- a/src/cairo-ps-test.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2006 Red Hat, Inc.
- *
- * 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 University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_PS_TEST_H
-#define CAIRO_PS_TEST_H
-
-#include <cairo.h>
-
-#if CAIRO_HAS_PS_SURFACE
-
-#include <cairo-ps.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public void
-_cairo_ps_test_force_fallbacks (void);
-
-CAIRO_END_DECLS
-
-#endif /* CAIRO_HAS_PS_SURFACE */
-#endif /* CAIRO_PS_TEST_H */
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index e5a3d00..a5359e6 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -30,7 +30,7 @@
 #include <cairo-boilerplate-pdf.h>
 
 #include <cairo-ps.h>
-#include <cairo-ps-test.h>
+#include <cairo-boilerplate-ps.h>
 
 #include <cairo-svg.h>
 #include <cairo-svg-test.h>
@@ -108,7 +108,7 @@ main (void)
 	case PS:
 	    surface = cairo_ps_surface_create (backend_filename[backend],
 					       SIZE, SIZE);
-	    _cairo_ps_test_force_fallbacks ();
+	    cairo_boilerplate_ps_surface_force_fallbacks (surface);
 	    break;
 	case SVG:
 	    surface = cairo_svg_surface_create (backend_filename[backend],
diff-tree 57dc972d6e5fe715a83cbcaad9c6cc3d38bf8129 (from 3e69fbca6233e9f568935dbb69bf14bc34812d77)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 03:02:48 2007 -0400

    [ps] Move cairo_ps_surface_t to cairo-ps-surface-private.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 2af4e55..48fdb07 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,7 @@ backend_pkgconfigs =
 
 if CAIRO_HAS_PS_SURFACE
 libcairo_ps_headers = cairo-ps.h
-libcairo_ps_sources = cairo-ps-surface.c cairo-ps-test.h
+libcairo_ps_sources = cairo-ps-surface.c cairo-pdf-surface-private.h cairo-ps-test.h
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-ps.pc
 endif
diff --git a/src/cairo-ps-surface-private.h b/src/cairo-ps-surface-private.h
new file mode 100644
index 0000000..27d1779
--- /dev/null
+++ b/src/cairo-ps-surface-private.h
@@ -0,0 +1,79 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2003 University of Southern California
+ * Copyright © 2005 Red Hat, Inc
+ *
+ * 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 University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ *	Kristian Høgsberg <krh at redhat.com>
+ *	Keith Packard <keithp at keithp.com>
+ */
+
+#ifndef CAIRO_PS_SURFACE_PRIVATE_H
+#define CAIRO_PS_SURFACE_PRIVATE_H
+
+#include "cairo-ps.h"
+
+#include "cairo-surface-private.h"
+
+typedef struct cairo_ps_surface {
+    cairo_surface_t base;
+
+    /* Here final_stream corresponds to the stream/file passed to
+     * cairo_ps_surface_create surface is built. Meanwhile stream is a
+     * temporary stream in which the file output is built, (so that
+     * the header can be built and inserted into the target stream
+     * before the contents of the temporary stream are copied). */
+    cairo_output_stream_t *final_stream;
+
+    FILE *tmpfile;
+    cairo_output_stream_t *stream;
+
+    double width;
+    double height;
+    double max_width;
+    double max_height;
+
+    int num_pages;
+
+    cairo_paginated_mode_t paginated_mode;
+
+    cairo_scaled_font_subsets_t *font_subsets;
+
+    cairo_array_t dsc_header_comments;
+    cairo_array_t dsc_setup_comments;
+    cairo_array_t dsc_page_setup_comments;
+
+    cairo_array_t *dsc_comment_target;
+
+} cairo_ps_surface_t;
+
+#endif /* CAIRO_PS_SURFACE_PRIVATE_H */
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index c97ea28..f1e2cc8 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -39,6 +39,7 @@
 
 #include "cairoint.h"
 #include "cairo-ps.h"
+#include "cairo-ps-surface-private.h"
 #include "cairo-ps-test.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-paginated-private.h"
@@ -52,38 +53,6 @@
 static const cairo_surface_backend_t cairo_ps_surface_backend;
 static const cairo_paginated_surface_backend_t cairo_ps_surface_paginated_backend;
 
-typedef struct cairo_ps_surface {
-    cairo_surface_t base;
-
-    /* Here final_stream corresponds to the stream/file passed to
-     * cairo_ps_surface_create surface is built. Meanwhile stream is a
-     * temporary stream in which the file output is built, (so that
-     * the header can be built and inserted into the target stream
-     * before the contents of the temporary stream are copied). */
-    cairo_output_stream_t *final_stream;
-
-    FILE *tmpfile;
-    cairo_output_stream_t *stream;
-
-    double width;
-    double height;
-    double max_width;
-    double max_height;
-
-    int num_pages;
-
-    cairo_paginated_mode_t paginated_mode;
-
-    cairo_scaled_font_subsets_t *font_subsets;
-
-    cairo_array_t dsc_header_comments;
-    cairo_array_t dsc_setup_comments;
-    cairo_array_t dsc_page_setup_comments;
-
-    cairo_array_t *dsc_comment_target;
-
-} cairo_ps_surface_t;
-
 /* A word wrap stream can be used as a filter to do word wrapping on
  * top of an existing output stream. The word wrapping is quite
  * simple, using isspace to determine characters that separate
diff-tree 3e69fbca6233e9f568935dbb69bf14bc34812d77 (from 29247e5010632f0453367b64a38c865076605681)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 03:00:21 2007 -0400

    [pdf] Fix header file header!

diff --git a/src/cairo-pdf-surface-private.h b/src/cairo-pdf-surface-private.h
index 337d430..1fcf774 100644
--- a/src/cairo-pdf-surface-private.h
+++ b/src/cairo-pdf-surface-private.h
@@ -1,6 +1,7 @@
-/* Cairo - a vector graphics library with display and print output
+/* cairo - a vector graphics library with display and print output
  *
- * Copyright © 2005 Red Hat, Inc.
+ * Copyright © 2004 Red Hat, Inc
+ * Copyright © 2006 Red Hat, Inc
  *
  * This library is free software; you can redistribute it and/or
  * modify it either under the terms of the GNU Lesser General Public
@@ -27,7 +28,12 @@
  *
  * The Original Code is the cairo graphics library.
  *
- * The Initial Developer of the Original Code is Red Hat, Inc.
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Kristian Høgsberg <krh at redhat.com>
+ *	Carl Worth <cworth at cworth.org>
  */
 
 #ifndef CAIRO_PDF_SURFACE_PRIVATE_H
diff-tree 29247e5010632f0453367b64a38c865076605681 (from 20ce190e71f838dea598cbd5267f047b75945cee)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:57:12 2007 -0400

    [ps/pdf/svg] Fix minor coding style issue

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 4727d09..073191e 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2658,7 +2658,7 @@ _pattern_supported (cairo_pattern_t *pat
 }
 
 static cairo_int_status_t
-__cairo_pdf_surface_operation_supported (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_operation_supported (cairo_pdf_surface_t *surface,
 		      cairo_operator_t op,
 		      cairo_pattern_t *pattern)
 {
@@ -2681,7 +2681,7 @@ _cairo_pdf_surface_analyze_operation (ca
 		    cairo_operator_t op,
 		    cairo_pattern_t *pattern)
 {
-    if (__cairo_pdf_surface_operation_supported (surface, op, pattern))
+    if (_cairo_pdf_surface_operation_supported (surface, op, pattern))
 	return CAIRO_STATUS_SUCCESS;
     else
 	return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -2705,7 +2705,7 @@ _cairo_pdf_surface_paint (void			*abstra
      * possible only because there is nothing between the fallback
      * images and the paper, nor is anything painted above. */
     /*
-    assert (__cairo_pdf_surface_operation_supported (op, source));
+    assert (_cairo_pdf_surface_operation_supported (op, source));
     */
 
     status = _cairo_pdf_surface_emit_pattern (surface, source);
@@ -2819,7 +2819,7 @@ _cairo_pdf_surface_stroke (void			*abstr
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_pdf_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_pdf_surface_operation_supported (surface, op, source));
+    assert (_cairo_pdf_surface_operation_supported (surface, op, source));
 
     status = _cairo_pdf_surface_emit_pattern (surface, source);
     if (status)
@@ -2868,7 +2868,7 @@ _cairo_pdf_surface_fill (void			*abstrac
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_pdf_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_pdf_surface_operation_supported (surface, op, source));
+    assert (_cairo_pdf_surface_operation_supported (surface, op, source));
 
     status = _cairo_pdf_surface_emit_pattern (surface, source);
     if (status)
@@ -2925,7 +2925,7 @@ _cairo_pdf_surface_show_glyphs (void			*
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_pdf_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_pdf_surface_operation_supported (surface, op, source));
+    assert (_cairo_pdf_surface_operation_supported (surface, op, source));
 
     status = _cairo_pdf_surface_emit_pattern (surface, source);
     if (status)
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 9573f49..c97ea28 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1971,7 +1971,7 @@ _cairo_ps_surface_paint (void			*abstrac
      * possible only because there is nothing between the fallback
      * images and the paper, nor is anything painted above. */
     /*
-    assert (__cairo_ps_surface_operation_supported (op, source));
+    assert (_cairo_ps_surface_operation_supported (op, source));
     */
 
     _cairo_output_stream_printf (stream,
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 23714b4..24a990c 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -745,7 +745,7 @@ _cairo_svg_test_force_fallbacks (void)
 }
 
 static cairo_int_status_t
-__cairo_svg_surface_operation_supported (cairo_svg_surface_t *surface,
+_cairo_svg_surface_operation_supported (cairo_svg_surface_t *surface,
 		      cairo_operator_t op,
 		      const cairo_pattern_t *pattern)
 {
@@ -766,7 +766,7 @@ _cairo_svg_surface_analyze_operation (ca
 		    cairo_operator_t op,
 		    const cairo_pattern_t *pattern)
 {
-    if (__cairo_svg_surface_operation_supported (surface, op, pattern))
+    if (_cairo_svg_surface_operation_supported (surface, op, pattern))
 	return CAIRO_STATUS_SUCCESS;
     else
 	return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1659,7 +1659,7 @@ _cairo_svg_surface_fill (void			*abstrac
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_svg_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_svg_surface_operation_supported (surface, op, source));
+    assert (_cairo_svg_surface_operation_supported (surface, op, source));
 
     _cairo_output_stream_printf (surface->xml_node,
  				 "<path style=\"stroke: none; "
@@ -1747,7 +1747,7 @@ _cairo_svg_surface_paint (void		    *abs
      * possible only because there is nothing between the fallback
      * images and the paper, nor is anything painted above. */
     /*
-    assert (__cairo_svg_surface_operation_supported (surface, op, source));
+    assert (_cairo_svg_surface_operation_supported (surface, op, source));
     */
 
     /* Emulation of clear and source operators, when no clipping region
@@ -1802,7 +1802,7 @@ _cairo_svg_surface_mask (void		    *abst
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_svg_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_svg_surface_operation_supported (surface, op, source));
+    assert (_cairo_svg_surface_operation_supported (surface, op, source));
 
     _cairo_svg_surface_emit_alpha_filter (document);
 
@@ -1852,7 +1852,7 @@ _cairo_svg_surface_stroke (void			*abstr
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_svg_surface_analyze_operation (surface, op, source);
 
-    assert (__cairo_svg_surface_operation_supported (surface, op, source));
+    assert (_cairo_svg_surface_operation_supported (surface, op, source));
 
     switch (stroke_style->line_cap) {
     case CAIRO_LINE_CAP_BUTT:
@@ -1940,7 +1940,7 @@ _cairo_svg_surface_show_glyphs (void			*
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_svg_surface_analyze_operation (surface, op, pattern);
 
-    assert (__cairo_svg_surface_operation_supported (surface, op, pattern));
+    assert (_cairo_svg_surface_operation_supported (surface, op, pattern));
 
     if (num_glyphs <= 0)
 	return CAIRO_STATUS_SUCCESS;
diff-tree 20ce190e71f838dea598cbd5267f047b75945cee (from 03477064fa639ab1c735467d1889bde7c99313c4)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 02:50:53 2007 -0400

    [pdf] Get rid of _cairo_pdf_test_force_fallbacks
    in favor of cairo_boilerplate_pdf_surface_force_fallbacks.

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index cccec91..8092c1b 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -38,6 +38,7 @@ endif
 
 if CAIRO_HAS_PDF_SURFACE
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf.c
+libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf.h
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf-private.h
 endif
 
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index 13f9ef8..e0a610e 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -25,9 +25,12 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-pdf.h"
 #include "cairo-boilerplate-pdf-private.h"
 
 #include <cairo-pdf.h>
+#include <cairo-pdf-surface-private.h>
+#include <cairo-paginated-surface-private.h>
 
 cairo_user_data_key_t pdf_closure_key;
 
@@ -132,3 +135,19 @@ _cairo_boilerplate_pdf_cleanup (void *cl
     free (ptc->filename);
     free (ptc);
 }
+
+cairo_status_t
+cairo_boilerplate_pdf_surface_force_fallbacks (cairo_surface_t *abstract_surface)
+{
+    cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
+    cairo_pdf_surface_t *surface;
+
+    if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PDF)
+	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+    surface = (cairo_pdf_surface_t*) paginated->target;
+
+    surface->force_fallbacks = TRUE;
+
+    return CAIRO_STATUS_SUCCESS;
+}
diff --git a/src/cairo-pdf-surface-private.h b/src/cairo-pdf-surface-private.h
index 2d35a11..337d430 100644
--- a/src/cairo-pdf-surface-private.h
+++ b/src/cairo-pdf-surface-private.h
@@ -78,6 +78,8 @@ struct _cairo_pdf_surface {
     cairo_bool_t has_clip;
 
     cairo_paginated_mode_t paginated_mode;
+
+    cairo_bool_t force_fallbacks;
 };
 
 #endif /* CAIRO_PDF_SURFACE_PRIVATE_H */
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 8899bf2..4727d09 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -38,7 +38,6 @@
 
 #include "cairoint.h"
 #include "cairo-pdf.h"
-#include "cairo-pdf-test.h"
 #include "cairo-pdf-surface-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-paginated-private.h"
@@ -255,6 +254,8 @@ _cairo_pdf_surface_create_for_stream_int
 
     surface->paginated_mode = CAIRO_PAGINATED_MODE_ANALYZE;
 
+    surface->force_fallbacks = FALSE;
+
     /* Document header */
     _cairo_output_stream_printf (surface->output,
 				 "%%PDF-1.4\r\n");
@@ -2656,32 +2657,12 @@ _pattern_supported (cairo_pattern_t *pat
     return FALSE;
 }
 
-static cairo_bool_t cairo_pdf_force_fallbacks = FALSE;
-
-/**
- * _cairo_pdf_test_force_fallbacks
- *
- * Force the PDF surface backend to use image fallbacks for every
- * operation.
- *
- * <note>
- * This function is <emphasis>only</emphasis> intended for internal
- * testing use within the cairo distribution. It is not installed in
- * any public header file.
- * </note>
- **/
-void
-_cairo_pdf_test_force_fallbacks (void)
-{
-    cairo_pdf_force_fallbacks = TRUE;
-}
-
 static cairo_int_status_t
 __cairo_pdf_surface_operation_supported (cairo_pdf_surface_t *surface,
 		      cairo_operator_t op,
 		      cairo_pattern_t *pattern)
 {
-    if (cairo_pdf_force_fallbacks)
+    if (surface->force_fallbacks)
 	return FALSE;
 
     if (! _pattern_supported (pattern))
diff --git a/src/cairo-pdf-test.h b/src/cairo-pdf-test.h
deleted file mode 100644
index 3d14c9d..0000000
--- a/src/cairo-pdf-test.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2006 Red Hat, Inc.
- *
- * 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 University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_PDF_TEST_H
-#define CAIRO_PDF_TEST_H
-
-#include <cairo.h>
-
-#if CAIRO_HAS_PDF_SURFACE
-
-#include <cairo-pdf.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public void
-_cairo_pdf_test_force_fallbacks (void);
-
-CAIRO_END_DECLS
-
-#endif /* CAIRO_HAS_PDF_SURFACE */
-#endif /* CAIRO_PDF_TEST_H */
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index b8d7e04..e5a3d00 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -27,7 +27,7 @@
 #include <cairo.h>
 
 #include <cairo-pdf.h>
-#include <cairo-pdf-test.h>
+#include <cairo-boilerplate-pdf.h>
 
 #include <cairo-ps.h>
 #include <cairo-ps-test.h>
@@ -103,7 +103,7 @@ main (void)
 	case PDF:
 	    surface = cairo_pdf_surface_create (backend_filename[backend],
 						SIZE, SIZE);
-	    _cairo_pdf_test_force_fallbacks ();
+	    cairo_boilerplate_pdf_surface_force_fallbacks (surface);
 	    break;
 	case PS:
 	    surface = cairo_ps_surface_create (backend_filename[backend],
diff-tree 03477064fa639ab1c735467d1889bde7c99313c4 (from 21a7de61c26faaaa1ce96cddab6d777dbb37d0bb)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Apr 21 02:25:51 2007 -0400

    [paginated] Move cairo_paginated_surface_t to cairo-paginated-surface-private.h
    The old cairo-paginated-surface-private.h is cairo-paginated-private.h now.

diff --git a/src/Makefile.am b/src/Makefile.am
index 683a28f..2af4e55 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -225,6 +225,7 @@ libcairo_la_SOURCES =				\
 	cairo-wideint-private.h			\
 	cairo-meta-surface.c			\
 	cairo-meta-surface-private.h		\
+	cairo-paginated-private.h		\
 	cairo-paginated-surface.c		\
 	cairo-paginated-surface-private.h	\
 	cairo-analysis-surface.c		\
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index a89636e..26a373f 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -35,7 +35,7 @@
 #include "cairoint.h"
 
 #include "cairo-analysis-surface-private.h"
-#include "cairo-paginated-surface-private.h"
+#include "cairo-paginated-private.h"
 
 typedef struct {
     cairo_surface_t base;
diff --git a/src/cairo-paginated-private.h b/src/cairo-paginated-private.h
new file mode 100644
index 0000000..42d100b
--- /dev/null
+++ b/src/cairo-paginated-private.h
@@ -0,0 +1,136 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc
+ *
+ * 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 Red Hat, Inc.
+ *
+ * Contributor(s):
+ *	Carl Worth <cworth at cworth.org>
+ */
+
+#ifndef CAIRO_PAGINATED_H
+#define CAIRO_PAGINATED_H
+
+#include "cairoint.h"
+
+struct _cairo_paginated_surface_backend {
+    /* Optional. Will be called once for each page.
+     *
+     * NOTE: With respect to the order of drawing operations as seen
+     * by the target, this call will occur before any drawing
+     * operations for the relevant page. However, with respect to the
+     * function calls as made by the user, this call will be *after*
+     * any drawing operations for the page, (that is, it will occur
+     * during the user's call to cairo_show_page or cairo_copy_page).
+     */
+    cairo_warn cairo_int_status_t
+    (*start_page)		(void			*surface);
+
+    /* Required. Will be called twice for each page, once with an
+     * argument of CAIRO_PAGINATED_MODE_ANALYZE and once with
+     * CAIRO_PAGINATED_MODE_RENDER. See more details in the
+     * documentation for _cairo_paginated_surface_create below.
+     */
+    void
+    (*set_paginated_mode)	(void			*surface,
+				 cairo_paginated_mode_t	 mode);
+};
+
+/* A cairo_paginated_surface provides a very convenient wrapper that
+ * is well-suited for doing the analysis common to most surfaces that
+ * have paginated output, (that is, things directed at printers, or
+ * for saving content in files such as PostScript or PDF files).
+ *
+ * To use the paginated surface, you'll first need to create your
+ * 'real' surface using _cairo_surface_init and the standard
+ * cairo_surface_backend_t. Then you also call
+ * _cairo_paginated_surface_create which takes its own, much simpler,
+ * cairo_paginated_surface_backend. You are free to return the result
+ * of _cairo_paginated_surface_create from your public
+ * cairo_<foo>_surface_create. The paginated backend will be careful
+ * to not let the user see that they really got a "wrapped"
+ * surface. See test-paginated-surface.c for a fairly minimal example
+ * of a paginated-using surface. That should be a reasonable example
+ * to follow.
+ *
+ * What the paginated surface does is first save all drawing
+ * operations for a page into a meta-surface. Then when the user calls
+ * cairo_show_page, the paginated surface performs the following
+ * sequence of operations (using the backend functions passed to
+ * cairo_paginated_surface_create):
+ *
+ * 1. Calls start_page (if non NULL). At this point, it is appropriate
+ *    for the target to emit any page-specific header information into
+ *    its output.
+ *
+ * 2. Calls set_paginated_mode with an argument of CAIRO_PAGINATED_MODE_ANALYZE
+ *
+ * 3. Replays the meta-surface to the target surface, (with an
+ *    analysis surface inserted between which watches the return value
+ *    from each operation). This analysis stage is used to decide which
+ *    operations will require fallbacks.
+ *
+ * 4. Calls set_paginated_mode with an argument of CAIRO_PAGINATED_MODE_RENDER
+ *
+ * 5. Replays a subset of the meta-surface operations to the target surface
+ *
+ * 6. Replays the remaining operations to an image surface, sets an
+ *    appropriate clip on the target, then paints the resulting image
+ *    surface to the target.
+ *
+ * So, the target will see drawing operations during two separate
+ * stages, (ANALYZE and RENDER). During the ANALYZE phase the target
+ * should not actually perform any rendering, (for example, if
+ * performing output to a file, no output should be generated during
+ * this stage). Instead the drawing functions simply need to return
+ * CAIRO_STATUS_SUCCESS or CAIRO_INT_STATUS_UNSUPPORTED to indicate
+ * whether rendering would be supported. And it should do this as
+ * quickly as possible.
+ *
+ * NOTE: The paginated surface layer assumes that the target surface
+ * is "blank" by default at the beginning of each page, without any
+ * need for an explicit erasea operation, (as opposed to an image
+ * surface, for example, which might have uninitialized content
+ * originally). As such, it optimizes away CLEAR operations that
+ * happen at the beginning of each page---the target surface will not
+ * even see these operations.
+ */
+cairo_private cairo_surface_t *
+_cairo_paginated_surface_create (cairo_surface_t				*target,
+				 cairo_content_t				 content,
+				 int						 width,
+				 int						 height,
+				 const cairo_paginated_surface_backend_t	*backend);
+
+cairo_private cairo_surface_t *
+_cairo_paginated_surface_get_target (cairo_surface_t *surface);
+
+cairo_private cairo_bool_t
+_cairo_surface_is_paginated (cairo_surface_t *surface);
+
+#endif /* CAIRO_PAGINATED_H */
diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index 518e7f4..e489026 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -36,101 +36,35 @@
 #ifndef CAIRO_PAGINATED_SURFACE_H
 #define CAIRO_PAGINATED_SURFACE_H
 
-#include "cairoint.h"
+#include "cairo.h"
 
-typedef struct _cairo_paginated_surface_backend {
-    /* Optional. Will be called once for each page.
-     *
-     * NOTE: With respect to the order of drawing operations as seen
-     * by the target, this call will occur before any drawing
-     * operations for the relevant page. However, with respect to the
-     * function calls as made by the user, this call will be *after*
-     * any drawing operations for the page, (that is, it will occur
-     * during the user's call to cairo_show_page or cairo_copy_page).
-     */
-    cairo_warn cairo_int_status_t
-    (*start_page)		(void			*surface);
-
-    /* Required. Will be called twice for each page, once with an
-     * argument of CAIRO_PAGINATED_MODE_ANALYZE and once with
-     * CAIRO_PAGINATED_MODE_RENDER. See more details in the
-     * documentation for _cairo_paginated_surface_create below.
-     */
-    void
-    (*set_paginated_mode)	(void			*surface,
-				 cairo_paginated_mode_t	 mode);
-} cairo_paginated_surface_backend_t;
-
-/* A cairo_paginated_surface provides a very convenient wrapper that
- * is well-suited for doing the analysis common to most surfaces that
- * have paginated output, (that is, things directed at printers, or
- * for saving content in files such as PostScript or PDF files).
- *
- * To use the paginated surface, you'll first need to create your
- * 'real' surface using _cairo_surface_init and the standard
- * cairo_surface_backend_t. Then you also call
- * _cairo_paginated_surface_create which takes its own, much simpler,
- * cairo_paginated_surface_backend. You are free to return the result
- * of _cairo_paginated_surface_create from your public
- * cairo_<foo>_surface_create. The paginated backend will be careful
- * to not let the user see that they really got a "wrapped"
- * surface. See test-paginated-surface.c for a fairly minimal example
- * of a paginated-using surface. That should be a reasonable example
- * to follow.
- *
- * What the paginated surface does is first save all drawing
- * operations for a page into a meta-surface. Then when the user calls
- * cairo_show_page, the paginated surface performs the following
- * sequence of operations (using the backend functions passed to
- * cairo_paginated_surface_create):
- *
- * 1. Calls start_page (if non NULL). At this point, it is appropriate
- *    for the target to emit any page-specific header information into
- *    its output.
- *
- * 2. Calls set_paginated_mode with an argument of CAIRO_PAGINATED_MODE_ANALYZE
- *
- * 3. Replays the meta-surface to the target surface, (with an
- *    analysis surface inserted between which watches the return value
- *    from each operation). This analysis stage is used to decide which
- *    operations will require fallbacks.
- *
- * 4. Calls set_paginated_mode with an argument of CAIRO_PAGINATED_MODE_RENDER
- *
- * 5. Replays a subset of the meta-surface operations to the target surface
- *
- * 6. Replays the remaining operations to an image surface, sets an
- *    appropriate clip on the target, then paints the resulting image
- *    surface to the target.
- *
- * So, the target will see drawing operations during two separate
- * stages, (ANALYZE and RENDER). During the ANALYZE phase the target
- * should not actually perform any rendering, (for example, if
- * performing output to a file, no output should be generated during
- * this stage). Instead the drawing functions simply need to return
- * CAIRO_STATUS_SUCCESS or CAIRO_INT_STATUS_UNSUPPORTED to indicate
- * whether rendering would be supported. And it should do this as
- * quickly as possible.
- *
- * NOTE: The paginated surface layer assumes that the target surface
- * is "blank" by default at the beginning of each page, without any
- * need for an explicit erasea operation, (as opposed to an image
- * surface, for example, which might have uninitialized content
- * originally). As such, it optimizes away CLEAR operations that
- * happen at the beginning of each page---the target surface will not
- * even see these operations.
- */
-cairo_private cairo_surface_t *
-_cairo_paginated_surface_create (cairo_surface_t				*target,
-				 cairo_content_t				 content,
-				 int						 width,
-				 int						 height,
-				 const cairo_paginated_surface_backend_t	*backend);
+typedef struct _cairo_paginated_surface {
+    cairo_surface_t base;
 
-cairo_private cairo_surface_t *
-_cairo_paginated_surface_get_target (cairo_surface_t *surface);
+    /* The target surface to hold the final result. */
+    cairo_surface_t *target;
 
-cairo_private cairo_bool_t
-_cairo_surface_is_paginated (cairo_surface_t *surface);
+    cairo_content_t content;
+
+    /* XXX: These shouldn't actually exist. We inherit this ugliness
+     * from _cairo_meta_surface_create. The width/height parameters
+     * from that function also should not exist. The fix that will
+     * allow us to remove all of these is to fix acquire_source_image
+     * to pass an interest rectangle. */
+    int width;
+    int height;
+
+    /* Paginated-surface specific functions for the target */
+    const cairo_paginated_surface_backend_t *backend;
+
+    /* A cairo_meta_surface to record all operations. To be replayed
+     * against target, and also against image surface as necessary for
+     * fallbacks. */
+    cairo_surface_t *meta;
+
+    int page_num;
+    cairo_bool_t page_is_blank;
+
+} cairo_paginated_surface_t;
 
 #endif /* CAIRO_PAGINATED_SURFACE_H */
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index f788dc2..c9584b6 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -36,45 +36,17 @@
 
 /* The paginated surface layer exists to provide as much code sharing
  * as possible for the various paginated surface backends in cairo
- * (PostScript, PDF, etc.). See cairo-paginated-surface-private.h for
+ * (PostScript, PDF, etc.). See cairo-paginated-private.h for
  * more details on how it works and how to use it.
  */
 
 #include "cairoint.h"
 
+#include "cairo-paginated-private.h"
 #include "cairo-paginated-surface-private.h"
 #include "cairo-meta-surface-private.h"
 #include "cairo-analysis-surface-private.h"
 
-typedef struct _cairo_paginated_surface {
-    cairo_surface_t base;
-
-    /* The target surface to hold the final result. */
-    cairo_surface_t *target;
-
-    cairo_content_t content;
-
-    /* XXX: These shouldn't actually exist. We inherit this ugliness
-     * from _cairo_meta_surface_create. The width/height parameters
-     * from that function also should not exist. The fix that will
-     * allow us to remove all of these is to fix acquire_source_image
-     * to pass an interest rectangle. */
-    int width;
-    int height;
-
-    /* Paginated-surface specific functions for the target */
-    const cairo_paginated_surface_backend_t *backend;
-
-    /* A cairo_meta_surface to record all operations. To be replayed
-     * against target, and also against image surface as necessary for
-     * fallbacks. */
-    cairo_surface_t *meta;
-
-    int page_num;
-    cairo_bool_t page_is_blank;
-
-} cairo_paginated_surface_t;
-
 const cairo_private cairo_surface_backend_t cairo_paginated_surface_backend;
 
 static cairo_int_status_t
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 5c03304..8899bf2 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -41,7 +41,7 @@
 #include "cairo-pdf-test.h"
 #include "cairo-pdf-surface-private.h"
 #include "cairo-scaled-font-subsets-private.h"
-#include "cairo-paginated-surface-private.h"
+#include "cairo-paginated-private.h"
 #include "cairo-path-fixed-private.h"
 #include "cairo-output-stream-private.h"
 
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 520c404..9573f49 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -41,7 +41,7 @@
 #include "cairo-ps.h"
 #include "cairo-ps-test.h"
 #include "cairo-scaled-font-subsets-private.h"
-#include "cairo-paginated-surface-private.h"
+#include "cairo-paginated-private.h"
 #include "cairo-meta-surface-private.h"
 #include "cairo-output-stream-private.h"
 
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index a582de3..23714b4 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -43,7 +43,7 @@
 #include "cairo-svg-test.h"
 #include "cairo-path-fixed-private.h"
 #include "cairo-meta-surface-private.h"
-#include "cairo-paginated-surface-private.h"
+#include "cairo-paginated-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-output-stream-private.h"
 
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index bb6de79..7f51ec1 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -61,6 +61,7 @@ typedef struct _cairo_surface_backend ca
 typedef struct _cairo_clip cairo_clip_t;
 typedef struct _cairo_output_stream cairo_output_stream_t;
 typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
+typedef struct _cairo_paginated_surface_backend cairo_paginated_surface_backend_t;
 
 
 typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index 543422f..53e97eb 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -49,7 +49,7 @@
 
 #include "test-paginated-surface.h"
 
-#include "cairo-paginated-surface-private.h"
+#include "cairo-paginated-private.h"
 
 typedef struct _test_paginated_surface {
     cairo_surface_t base;
diff-tree 21a7de61c26faaaa1ce96cddab6d777dbb37d0bb (from 68e2158aaeacefcff8e6df11c25bb61ab0e89606)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:52:53 2007 -0400

    [boilerplate] Add cairo-boilerplate-xlib.h to Makefile.am

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index b541af3..cccec91 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -73,6 +73,7 @@ endif
 
 if CAIRO_HAS_XLIB_XRENDER_SURFACE
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.c
+libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.h
 libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib-private.h
 endif
 
diff-tree 68e2158aaeacefcff8e6df11c25bb61ab0e89606 (from 183c6af4f1730861a604a912a0609e315da65ecc)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:37:15 2007 -0400

    [pdf] Move cairo_pdf_surface_t to cairo-pdf-surface-private.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 83e0bca..683a28f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,8 @@ endif
 
 if CAIRO_HAS_PDF_SURFACE
 libcairo_pdf_headers = cairo-pdf.h
-libcairo_pdf_sources = cairo-pdf-surface.c cairo-deflate-stream.c cairo-pdf-test.h
+libcairo_pdf_sources = cairo-pdf-surface.c cairo-pdf-surface-private.h \
+		       cairo-deflate-stream.c cairo-pdf-test.h
 libcairo_font_subset_sources =	$(font_subset_sources)
 backend_pkgconfigs += cairo-pdf.pc
 endif
diff --git a/src/cairo-output-stream-private.h b/src/cairo-output-stream-private.h
index 26c18cb..0600431 100644
--- a/src/cairo-output-stream-private.h
+++ b/src/cairo-output-stream-private.h
@@ -37,7 +37,7 @@
 #ifndef CAIRO_OUTPUT_STREAM_PRIVATE_H
 #define CAIRO_OUTPUT_STREAM_PRIVATE_H
 
-typedef struct _cairo_output_stream cairo_output_stream_t;
+#include "cairo-types-private.h"
 
 typedef cairo_status_t (*cairo_output_stream_write_func_t) (cairo_output_stream_t *output_stream,
 							    const unsigned char   *data,
diff --git a/src/cairo-pdf-surface-private.h b/src/cairo-pdf-surface-private.h
new file mode 100644
index 0000000..2d35a11
--- /dev/null
+++ b/src/cairo-pdf-surface-private.h
@@ -0,0 +1,83 @@
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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 Red Hat, Inc.
+ */
+
+#ifndef CAIRO_PDF_SURFACE_PRIVATE_H
+#define CAIRO_PDF_SURFACE_PRIVATE_H
+
+#include "cairo-pdf.h"
+
+#include "cairo-surface-private.h"
+
+typedef struct _cairo_pdf_resource {
+    unsigned int id;
+} cairo_pdf_resource_t;
+
+typedef struct _cairo_pdf_surface cairo_pdf_surface_t;
+
+struct _cairo_pdf_surface {
+    cairo_surface_t base;
+
+    /* Prefer the name "output" here to avoid confusion over the
+     * structure within a PDF document known as a "stream". */
+    cairo_output_stream_t *output;
+
+    double width;
+    double height;
+
+    cairo_array_t objects;
+    cairo_array_t pages;
+    cairo_array_t patterns;
+    cairo_array_t xobjects;
+    cairo_array_t streams;
+    cairo_array_t alphas;
+
+    cairo_scaled_font_subsets_t *font_subsets;
+    cairo_array_t fonts;
+
+    cairo_pdf_resource_t next_available_resource;
+    cairo_pdf_resource_t pages_resource;
+
+    struct {
+	cairo_bool_t active;
+	cairo_pdf_resource_t self;
+	cairo_pdf_resource_t length;
+	long start_offset;
+        cairo_bool_t compressed;
+        cairo_output_stream_t *old_output;
+    } current_stream;
+
+    cairo_bool_t has_clip;
+
+    cairo_paginated_mode_t paginated_mode;
+};
+
+#endif /* CAIRO_PDF_SURFACE_PRIVATE_H */
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index f4e6f90..5c03304 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -39,6 +39,7 @@
 #include "cairoint.h"
 #include "cairo-pdf.h"
 #include "cairo-pdf-test.h"
+#include "cairo-pdf-surface-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-paginated-surface-private.h"
 #include "cairo-path-fixed-private.h"
@@ -91,53 +92,12 @@ typedef struct _cairo_pdf_object {
     long offset;
 } cairo_pdf_object_t;
 
-typedef struct _cairo_pdf_resource {
-    unsigned int id;
-} cairo_pdf_resource_t;
-
 typedef struct _cairo_pdf_font {
     unsigned int font_id;
     unsigned int subset_id;
     cairo_pdf_resource_t subset_resource;
 } cairo_pdf_font_t;
 
-typedef struct _cairo_pdf_surface {
-    cairo_surface_t base;
-
-    /* Prefer the name "output" here to avoid confusion over the
-     * structure within a PDF document known as a "stream". */
-    cairo_output_stream_t *output;
-
-    double width;
-    double height;
-
-    cairo_array_t objects;
-    cairo_array_t pages;
-    cairo_array_t patterns;
-    cairo_array_t xobjects;
-    cairo_array_t streams;
-    cairo_array_t alphas;
-
-    cairo_scaled_font_subsets_t *font_subsets;
-    cairo_array_t fonts;
-
-    cairo_pdf_resource_t next_available_resource;
-    cairo_pdf_resource_t pages_resource;
-
-    struct {
-	cairo_bool_t active;
-	cairo_pdf_resource_t self;
-	cairo_pdf_resource_t length;
-	long start_offset;
-        cairo_bool_t compressed;
-        cairo_output_stream_t *old_output;
-    } current_stream;
-
-    cairo_bool_t has_clip;
-
-    cairo_paginated_mode_t paginated_mode;
-} cairo_pdf_surface_t;
-
 static cairo_pdf_resource_t
 _cairo_pdf_surface_new_object (cairo_pdf_surface_t *surface);
 
diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h
index e4e320c..5b9467a 100644
--- a/src/cairo-scaled-font-subsets-private.h
+++ b/src/cairo-scaled-font-subsets-private.h
@@ -39,8 +39,6 @@
 
 #include "cairoint.h"
 
-typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
-
 typedef struct _cairo_scaled_font_subsets_glyph {
     unsigned int font_id;
     unsigned int subset_id;
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index ce68c8d..bb6de79 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -59,6 +59,9 @@ struct _cairo_font_options {
 
 typedef struct _cairo_surface_backend cairo_surface_backend_t;
 typedef struct _cairo_clip cairo_clip_t;
+typedef struct _cairo_output_stream cairo_output_stream_t;
+typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t;
+
 
 typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
 
diff-tree 183c6af4f1730861a604a912a0609e315da65ecc (from cd72167ede50b44aa3559ee63b95e12e4b51d80f)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:30:46 2007 -0400

    [paginated] Move cairo_paginated_mode_t to cairo-types-private.h
    
    as it is used in surface structs for PS/PDF/SVG and we will need
    it.

diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index 1e07f59..518e7f4 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -38,11 +38,6 @@
 
 #include "cairoint.h"
 
-typedef enum {
-    CAIRO_PAGINATED_MODE_ANALYZE,	/* analyze page regions */
-    CAIRO_PAGINATED_MODE_RENDER		/* render page contents */
-} cairo_paginated_mode_t;
-
 typedef struct _cairo_paginated_surface_backend {
     /* Optional. Will be called once for each page.
      *
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 93b6fb6..ce68c8d 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -62,4 +62,9 @@ typedef struct _cairo_clip cairo_clip_t;
 
 typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
 
+typedef enum {
+    CAIRO_PAGINATED_MODE_ANALYZE,	/* analyze page regions */
+    CAIRO_PAGINATED_MODE_RENDER		/* render page contents */
+} cairo_paginated_mode_t;
+
 #endif /* CAIRO_TYPES_PRIVATE_H */
diff-tree cd72167ede50b44aa3559ee63b95e12e4b51d80f (from 908418cb4d43e387d06698a43626ac9a663d6c2a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:27:19 2007 -0400

    [xlib] Get rid of _cairo_xlib_test_disable_render
    
    in favor of cairo_boilerplate_xlib_surface_disable_render.

diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index 302035d..615fc98 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -25,9 +25,11 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-xlib.h"
 #include "cairo-boilerplate-xlib-private.h"
 
 #include <cairo-xlib-xrender.h>
+#include <cairo-xlib-surface-private.h>
 
 typedef struct _xlib_target_closure
 {
@@ -194,3 +196,16 @@ _cairo_boilerplate_xlib_cleanup (void *c
     XCloseDisplay (xtc->dpy);
     free (xtc);
 }
+
+cairo_status_t
+cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface)
+{
+    cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface;
+
+    if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB)
+	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+    surface->render_major = surface->render_minor = -1;
+
+    return CAIRO_STATUS_SUCCESS;
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index eb8edbd..83e0bca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,7 +47,7 @@ endif
 if CAIRO_HAS_XLIB_SURFACE
 libcairo_xlib_headers = cairo-xlib.h cairo-xlib-xrender.h
 libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-surface-private.h \
-			cairo-xlib-screen.c cairo-xlib-private.h cairo-xlib-test.h
+			cairo-xlib-screen.c cairo-xlib-private.h
 backend_pkgconfigs += cairo-xlib.pc
 endif
 
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 4f0ae6d..8d9d107 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -39,7 +39,6 @@
 #include "cairoint.h"
 #include "cairo-xlib.h"
 #include "cairo-xlib-xrender.h"
-#include "cairo-xlib-test.h"
 #include "cairo-xlib-private.h"
 #include "cairo-xlib-surface-private.h"
 #include "cairo-clip-private.h"
@@ -109,25 +108,6 @@ static const XTransform identity = { {
 #define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
 #define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
 
-static cairo_bool_t cairo_xlib_render_disabled = FALSE;
-
-/**
- * _cairo_xlib_test_disable_render:
- *
- * Disables the use of the RENDER extension.
- *
- * <note>
- * This function is <emphasis>only</emphasis> intended for internal
- * testing use within the cairo distribution. It is not installed in
- * any public header file.
- * </note>
- **/
-void
-_cairo_xlib_test_disable_render (void)
-{
-    cairo_xlib_render_disabled = TRUE;
-}
-
 static int
 _CAIRO_FORMAT_DEPTH (cairo_format_t format)
 {
@@ -1848,8 +1828,7 @@ _cairo_xlib_surface_create_internal (Dis
 	;
     }
 
-    if (cairo_xlib_render_disabled ||
-	! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) {
+    if (! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) {
 	surface->render_major = -1;
 	surface->render_minor = -1;
     }
diff --git a/src/cairo-xlib-test.h b/src/cairo-xlib-test.h
deleted file mode 100644
index ec167c1..0000000
--- a/src/cairo-xlib-test.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2005 Red Hat, Inc.
- *
- * 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 University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_XLIB_TEST_H
-#define CAIRO_XLIB_TEST_H
-
-#include <cairo.h>
-
-#if CAIRO_HAS_XLIB_SURFACE
-
-#include <cairo-xlib.h>
-
-CAIRO_BEGIN_DECLS
-
-cairo_public void
-_cairo_xlib_test_disable_render (void);
-
-CAIRO_END_DECLS
-
-#endif /* CAIRO_HAS_XLIB_SURFACE */
-#endif /* CAIRO_XLIB_H */
diff --git a/test/xlib-surface.c b/test/xlib-surface.c
index 3b6d1b5..a1578cd 100644
--- a/test/xlib-surface.c
+++ b/test/xlib-surface.c
@@ -30,7 +30,8 @@
 #include "cairo-xlib.h"
 #include "cairo-xlib-xrender.h"
 #include "cairo-test.h"
-#include "cairo-xlib-test.h"
+
+#include "cairo-boilerplate-xlib.h"
 
 #include "buffer-diff.h"
 
@@ -123,6 +124,9 @@ do_test (Display        *dpy,
 					 DefaultVisual (dpy, screen),
 					 SIZE, SIZE);
 
+    if (!use_render)
+	cairo_boilerplate_xlib_surface_disable_render (surface);
+
     if (set_size) {
 	cairo_xlib_surface_set_size (surface, SIZE, SIZE);
 
@@ -257,8 +261,6 @@ main (void)
 		    result = status;
 	    }
 
-    _cairo_xlib_test_disable_render ();
-
     for (set_size = 0; set_size <= 1; set_size++)
 	for (use_pixmap = 0; use_pixmap <= 1; use_pixmap++)
 	    for (offscreen = 0; offscreen <= 1; offscreen++) {
diff-tree 908418cb4d43e387d06698a43626ac9a663d6c2a (from 8ae02fa470eace1b449c09b6cd0f86cc09b81ec2)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 02:25:55 2007 -0400

    [cairo-surface] Move cairo_surface_t struct in cairo-surface-private.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 2c19b83..eb8edbd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -213,7 +213,9 @@ libcairo_la_SOURCES =				\
 	cairo-surface.c				\
 	cairo-surface-fallback.c		\
 	cairo-surface-fallback-private.h	\
+	cairo-surface-private.h			\
 	cairo-traps.c				\
+	cairo-types-private.h			\
 	cairo-pattern.c				\
 	cairo-unicode.c				\
 	cairo-output-stream.c			\
diff --git a/src/cairo-surface-private.h b/src/cairo-surface-private.h
new file mode 100644
index 0000000..6193cf8
--- /dev/null
+++ b/src/cairo-surface-private.h
@@ -0,0 +1,96 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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 University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ */
+
+#ifndef CAIRO_SURFACE_PRIVATE_H
+#define CAIRO_SURFACE_PRIVATE_H
+
+#include "cairo.h"
+
+#include "cairo-types-private.h"
+
+struct _cairo_surface {
+    const cairo_surface_backend_t *backend;
+
+    /* We allow surfaces to override the backend->type by shoving something
+     * else into surface->type. This is for "wrapper" surfaces that want to
+     * hide their internal type from the user-level API. */
+    cairo_surface_type_t type;
+
+    cairo_content_t content;
+
+    unsigned int ref_count;
+    cairo_status_t status;
+    cairo_bool_t finished;
+    cairo_user_data_array_t user_data;
+
+    cairo_matrix_t device_transform;
+    cairo_matrix_t device_transform_inverse;
+
+    double x_fallback_resolution;
+    double y_fallback_resolution;
+
+    cairo_clip_t *clip;
+
+    /*
+     * Each time a clip region is modified, it gets the next value in this
+     * sequence.  This means that clip regions for this surface are uniquely
+     * identified and updates to the clip can be readily identified
+     */
+    unsigned int next_clip_serial;
+    /*
+     * The serial number of the current clip.  This is set when
+     * the surface clipping is set.  The gstate can then cheaply
+     * check whether the surface clipping is already correct before
+     * performing a rendering operation.
+     *
+     * The special value '0' is reserved for the unclipped case.
+     */
+    unsigned int current_clip_serial;
+
+    /* A "snapshot" surface is immutable. See _cairo_surface_snapshot. */
+    cairo_bool_t is_snapshot;
+
+    /*
+     * Surface font options, falling back to backend's default options,
+     * and set using _cairo_surface_set_font_options(), and propagated by
+     * cairo_surface_create_similar().
+     */
+    cairo_bool_t has_font_options;
+    cairo_font_options_t font_options;
+};
+
+#endif /* CAIRO_SURFACE_PRIVATE_H */
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
new file mode 100644
index 0000000..93b6fb6
--- /dev/null
+++ b/src/cairo-types-private.h
@@ -0,0 +1,65 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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 University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ */
+
+#ifndef CAIRO_TYPES_PRIVATE_H
+#define CAIRO_TYPES_PRIVATE_H
+
+typedef struct _cairo_array cairo_array_t;
+struct _cairo_array {
+    unsigned int size;
+    unsigned int num_elements;
+    unsigned int element_size;
+    char **elements;
+
+    cairo_bool_t is_snapshot;
+};
+
+typedef cairo_array_t cairo_user_data_array_t;
+
+struct _cairo_font_options {
+    cairo_antialias_t antialias;
+    cairo_subpixel_order_t subpixel_order;
+    cairo_hint_style_t hint_style;
+    cairo_hint_metrics_t hint_metrics;
+};
+
+typedef struct _cairo_surface_backend cairo_surface_backend_t;
+typedef struct _cairo_clip cairo_clip_t;
+
+typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
+
+#endif /* CAIRO_TYPES_PRIVATE_H */
diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h
index e715343..1fd47fa 100644
--- a/src/cairo-xlib-private.h
+++ b/src/cairo-xlib-private.h
@@ -36,7 +36,6 @@
 #include "cairoint.h"
 #include "cairo-xlib.h"
 
-typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
 typedef struct _cairo_xlib_hook cairo_xlib_hook_t;
 
 struct _cairo_xlib_hook {
diff --git a/src/cairo-xlib-surface-private.h b/src/cairo-xlib-surface-private.h
index 7038d85..15724d3 100644
--- a/src/cairo-xlib-surface-private.h
+++ b/src/cairo-xlib-surface-private.h
@@ -35,6 +35,8 @@
 
 #include "cairo-xlib.h"
 
+#include "cairo-surface-private.h"
+
 typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
 
 struct _cairo_xlib_surface {
diff --git a/src/cairoint.h b/src/cairoint.h
index 549cc51..49949e5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -244,6 +244,7 @@ be32_to_cpu(uint32_t v)
 
 #endif
 
+#include "cairo-types-private.h"
 #include "cairo-hash-private.h"
 #include "cairo-cache-private.h"
 
@@ -348,7 +349,6 @@ typedef enum _cairo_clip_mode {
     CAIRO_CLIP_MODE_MASK
 } cairo_clip_mode_t;
 typedef struct _cairo_clip_path cairo_clip_path_t;
-typedef struct _cairo_clip cairo_clip_t;
 
 typedef struct _cairo_edge {
     cairo_line_t edge;
@@ -400,8 +400,6 @@ typedef struct _cairo_pen {
 typedef struct _cairo_color cairo_color_t;
 typedef struct _cairo_image_surface cairo_image_surface_t;
 
-typedef struct _cairo_surface_backend cairo_surface_backend_t;
-
 cairo_private void
 _cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_int16_t *rectangle);
 
@@ -410,16 +408,6 @@ _cairo_rectangle_intersect (cairo_rectan
 
 /* cairo_array.c structures and functions */
 
-typedef struct _cairo_array cairo_array_t;
-struct _cairo_array {
-    unsigned int size;
-    unsigned int num_elements;
-    unsigned int element_size;
-    char **elements;
-
-    cairo_bool_t is_snapshot;
-};
-
 cairo_private void
 _cairo_array_init (cairo_array_t *array, int element_size);
 
@@ -461,8 +449,6 @@ _cairo_array_num_elements (cairo_array_t
 cairo_private int
 _cairo_array_size (cairo_array_t *array);
 
-typedef cairo_array_t cairo_user_data_array_t;
-
 cairo_private void
 _cairo_user_data_array_init (cairo_user_data_array_t *array);
 
@@ -496,13 +482,6 @@ typedef struct _cairo_unscaled_font {
     const cairo_unscaled_font_backend_t *backend;
 } cairo_unscaled_font_t;
 
-struct _cairo_font_options {
-    cairo_antialias_t antialias;
-    cairo_subpixel_order_t subpixel_order;
-    cairo_hint_style_t hint_style;
-    cairo_hint_metrics_t hint_metrics;
-};
-
 typedef struct _cairo_scaled_glyph {
     cairo_cache_entry_t	    cache_entry;	/* hash is glyph index */
     cairo_scaled_font_t	    *scaled_font;	/* font the glyph lives in */
@@ -993,56 +972,7 @@ typedef struct _cairo_format_masks {
     unsigned long blue_mask;
 } cairo_format_masks_t;
 
-struct _cairo_surface {
-    const cairo_surface_backend_t *backend;
-
-    /* We allow surfaces to override the backend->type by shoving something
-     * else into surface->type. This is for "wrapper" surfaces that want to
-     * hide their internal type from the user-level API. */
-    cairo_surface_type_t type;
-
-    cairo_content_t content;
-
-    unsigned int ref_count;
-    cairo_status_t status;
-    cairo_bool_t finished;
-    cairo_user_data_array_t user_data;
-
-    cairo_matrix_t device_transform;
-    cairo_matrix_t device_transform_inverse;
-
-    double x_fallback_resolution;
-    double y_fallback_resolution;
-
-    cairo_clip_t *clip;
-
-    /*
-     * Each time a clip region is modified, it gets the next value in this
-     * sequence.  This means that clip regions for this surface are uniquely
-     * identified and updates to the clip can be readily identified
-     */
-    unsigned int next_clip_serial;
-    /*
-     * The serial number of the current clip.  This is set when
-     * the surface clipping is set.  The gstate can then cheaply
-     * check whether the surface clipping is already correct before
-     * performing a rendering operation.
-     *
-     * The special value '0' is reserved for the unclipped case.
-     */
-    unsigned int current_clip_serial;
-
-    /* A "snapshot" surface is immutable. See _cairo_surface_snapshot. */
-    cairo_bool_t is_snapshot;
-
-    /*
-     * Surface font options, falling back to backend's default options,
-     * and set using _cairo_surface_set_font_options(), and propagated by
-     * cairo_surface_create_similar().
-     */
-    cairo_bool_t has_font_options;
-    cairo_font_options_t font_options;
-};
+#include "cairo-surface-private.h"
 
 struct _cairo_image_surface {
     cairo_surface_t base;
diff-tree 8ae02fa470eace1b449c09b6cd0f86cc09b81ec2 (from 1345552ac24099900acdb968f905d6e75cc20593)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 01:54:35 2007 -0400

    [boilerplate] Minor indentation fix

diff --git a/boilerplate/cairo-boilerplate-xlib-private.h b/boilerplate/cairo-boilerplate-xlib-private.h
index 9757827..80826d5 100644
--- a/boilerplate/cairo-boilerplate-xlib-private.h
+++ b/boilerplate/cairo-boilerplate-xlib-private.h
@@ -28,12 +28,12 @@
 #define _CAIRO_BOILERPLATE_XLIB_PRIVATE_H_
 
 cairo_surface_t *
-_cairo_boilerplate_xlib_create_surface (const char		*name,
-					cairo_content_t	 content,
-					int			 width,
-					int			 height,
-					cairo_boilerplate_mode_t  mode,
-					void			**closure);
+_cairo_boilerplate_xlib_create_surface (const char		  *name,
+					cairo_content_t		   content,
+					int			   width,
+					int			   height,
+					cairo_boilerplate_mode_t   mode,
+					void			 **closure);
 
 void
 _cairo_boilerplate_xlib_cleanup (void *closure);
diff-tree 1345552ac24099900acdb968f905d6e75cc20593 (from 735be3f09d1d150909305ff3232fda42efcb87bd)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Apr 20 01:46:23 2007 -0400

    [xlib] Move cairo_xlib_surface_t definition into cairo-xlib-surface-private.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 3cf6b2b..2c19b83 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,7 +46,8 @@ endif
 
 if CAIRO_HAS_XLIB_SURFACE
 libcairo_xlib_headers = cairo-xlib.h cairo-xlib-xrender.h
-libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-screen.c cairo-xlib-private.h cairo-xlib-test.h
+libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-surface-private.h \
+			cairo-xlib-screen.c cairo-xlib-private.h cairo-xlib-test.h
 backend_pkgconfigs += cairo-xlib.pc
 endif
 
diff --git a/src/cairo-xlib-surface-private.h b/src/cairo-xlib-surface-private.h
new file mode 100644
index 0000000..7038d85
--- /dev/null
+++ b/src/cairo-xlib-surface-private.h
@@ -0,0 +1,91 @@
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * 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 Red Hat, Inc.
+ */
+
+#ifndef CAIRO_XLIB_SURFACE_PRIVATE_H
+#define CAIRO_XLIB_SURFACE_PRIVATE_H
+
+#include "cairo-xlib.h"
+
+typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
+
+struct _cairo_xlib_surface {
+    cairo_surface_t base;
+
+    Display *dpy;
+    cairo_xlib_screen_info_t *screen_info;
+
+    GC gc;
+    Drawable drawable;
+    Screen *screen;
+    cairo_bool_t owns_pixmap;
+    Visual *visual;
+
+    int use_pixmap;
+
+    int render_major;
+    int render_minor;
+
+    /* TRUE if the server has a bug with repeating pictures
+     *
+     *  https://bugs.freedesktop.org/show_bug.cgi?id=3566
+     *
+     * We can't test for this because it depends on whether the
+     * picture is in video memory or not.
+     *
+     * We also use this variable as a guard against a second
+     * independent bug with transformed repeating pictures:
+     *
+     * http://lists.freedesktop.org/archives/cairo/2004-September/001839.html
+     *
+     * Both are fixed in xorg >= 6.9 and hopefully in > 6.8.2, so
+     * we can reuse the test for now.
+     */
+    cairo_bool_t buggy_repeat;
+
+    int width;
+    int height;
+    int depth;
+
+    Picture dst_picture, src_picture;
+
+    cairo_bool_t have_clip_rects;
+    XRectangle embedded_clip_rects[4];
+    XRectangle *clip_rects;
+    int num_clip_rects;
+
+    XRenderPictFormat *xrender_format;
+    cairo_filter_t filter;
+    int repeat;
+    XTransform xtransform;
+};
+
+#endif /* CAIRO_XLIB_SURFACE_PRIVATE_H */
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 4d53bdb..4f0ae6d 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -41,6 +41,7 @@
 #include "cairo-xlib-xrender.h"
 #include "cairo-xlib-test.h"
 #include "cairo-xlib-private.h"
+#include "cairo-xlib-surface-private.h"
 #include "cairo-clip-private.h"
 #include <X11/extensions/Xrender.h>
 #include <X11/extensions/renderproto.h>
@@ -49,8 +50,6 @@
 typedef int (*cairo_xlib_error_func_t) (Display     *display,
 					XErrorEvent *event);
 
-typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
-
 static cairo_status_t
 _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
 
@@ -82,57 +81,6 @@ _cairo_xlib_surface_show_glyphs (void   
 
 #define CAIRO_ASSUME_PIXMAP	20
 
-struct _cairo_xlib_surface {
-    cairo_surface_t base;
-
-    Display *dpy;
-    cairo_xlib_screen_info_t *screen_info;
-
-    GC gc;
-    Drawable drawable;
-    Screen *screen;
-    cairo_bool_t owns_pixmap;
-    Visual *visual;
-
-    int use_pixmap;
-
-    int render_major;
-    int render_minor;
-
-    /* TRUE if the server has a bug with repeating pictures
-     *
-     *  https://bugs.freedesktop.org/show_bug.cgi?id=3566
-     *
-     * We can't test for this because it depends on whether the
-     * picture is in video memory or not.
-     *
-     * We also use this variable as a guard against a second
-     * independent bug with transformed repeating pictures:
-     *
-     * http://lists.freedesktop.org/archives/cairo/2004-September/001839.html
-     *
-     * Both are fixed in xorg >= 6.9 and hopefully in > 6.8.2, so
-     * we can reuse the test for now.
-     */
-    cairo_bool_t buggy_repeat;
-
-    int width;
-    int height;
-    int depth;
-
-    Picture dst_picture, src_picture;
-
-    cairo_bool_t have_clip_rects;
-    XRectangle embedded_clip_rects[4];
-    XRectangle *clip_rects;
-    int num_clip_rects;
-
-    XRenderPictFormat *xrender_format;
-    cairo_filter_t filter;
-    int repeat;
-    XTransform xtransform;
-};
-
 static const XTransform identity = { {
     { 1 << 16, 0x00000, 0x00000 },
     { 0x00000, 1 << 16, 0x00000 },


More information about the cairo-commit mailing list