summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boilerplate/Makefile.am1
-rw-r--r--boilerplate/cairo-boilerplate-ps.c15
-rw-r--r--boilerplate/cairo-boilerplate-ps.h33
-rw-r--r--src/Makefile.am2
-rw-r--r--src/cairo-ps-surface-private.h3
-rw-r--r--src/cairo-ps-surface.c24
-rw-r--r--src/cairo-ps-test.h54
-rw-r--r--test/fallback-resolution.c4
8 files changed, 56 insertions, 80 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 8092c1b7..1528409a 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 676d3e86..291ac2e9 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 *closure)
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 00000000..5cc5c18f
--- /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@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 48fdb076..d3ab669a 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 27d17796..2499b992 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 f1e2cc84..87566d23 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_internal (cairo_output_stream_t *stream,
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 *pattern)
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 5d49eced..00000000
--- 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@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 e5a3d001..a5359e6f 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],