summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-06-10 09:14:47 -0700
committerCarl Worth <cworth@cworth.org>2006-06-10 09:14:47 -0700
commit6ca30e108f32862948fa332b31f60fa79b566d77 (patch)
treebcd1c6da50dd681cc9f2066cb992afb656ed26de
parent100b30d1c09cb7fe73414c4d3466032a8c99b088 (diff)
Add cairo_{ps,svg}_test_force_fallbacks so tests can force fallbacks.
-rw-r--r--src/cairo-ps-surface.c24
-rw-r--r--src/cairo-ps-test.h54
-rw-r--r--src/cairo-svg-surface.c24
-rw-r--r--src/cairo-svg-test.h54
4 files changed, 156 insertions, 0 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 4e019e1b..a621670e 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-test.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-paginated-surface-private.h"
#include "cairo-meta-surface-private.h"
@@ -1033,11 +1034,34 @@ 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
operation_supported (cairo_ps_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern)
{
+ if (cairo_ps_force_fallbacks)
+ return FALSE;
+
if (! pattern_supported (pattern))
return FALSE;
diff --git a/src/cairo-ps-test.h b/src/cairo-ps-test.h
new file mode 100644
index 00000000..724ca461
--- /dev/null
+++ b/src/cairo-ps-test.h
@@ -0,0 +1,54 @@
+/* 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
+
+void
+cairo_ps_test_force_fallbacks (void);
+
+CAIRO_END_DECLS
+
+#endif /* CAIRO_HAS_PS_SURFACE */
+#endif /* CAIRO_PS_TEST_H */
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 73d119b2..c1bcd96c 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-test.h"
#include "cairo-path-fixed-private.h"
#include "cairo-ft-private.h"
#include "cairo-meta-surface-private.h"
@@ -615,6 +616,26 @@ _cairo_svg_document_emit_font_subsets (cairo_svg_document_t *document)
document->font_subsets = NULL;
}
+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
_operation_supported (cairo_svg_surface_t *surface,
cairo_operator_t op,
@@ -622,6 +643,9 @@ _operation_supported (cairo_svg_surface_t *surface,
{
cairo_svg_document_t *document = surface->document;
+ if (cairo_svg_force_fallbacks)
+ return FALSE;
+
if (document->svg_version < CAIRO_SVG_VERSION_1_2)
if (op != CAIRO_OPERATOR_OVER)
return FALSE;
diff --git a/src/cairo-svg-test.h b/src/cairo-svg-test.h
new file mode 100644
index 00000000..c8ed063b
--- /dev/null
+++ b/src/cairo-svg-test.h
@@ -0,0 +1,54 @@
+/* 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_SVG_TEST_H
+#define CAIRO_SVG_TEST_H
+
+#include <cairo.h>
+
+#if CAIRO_HAS_SVG_SURFACE
+
+#include <cairo-svg.h>
+
+CAIRO_BEGIN_DECLS
+
+void
+cairo_svg_test_force_fallbacks (void);
+
+CAIRO_END_DECLS
+
+#endif /* CAIRO_HAS_SVG_SURFACE */
+#endif /* CAIRO_SVG_TEST_H */