summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boilerplate/Makefile.am1
-rw-r--r--boilerplate/cairo-boilerplate-pdf.c19
-rw-r--r--src/cairo-pdf-surface-private.h2
-rw-r--r--src/cairo-pdf-surface.c25
-rw-r--r--src/cairo-pdf-test.h54
-rw-r--r--test/fallback-resolution.c4
6 files changed, 27 insertions, 78 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index cccec915..8092c1b7 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 13f9ef86..e0a610e7 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 *closure)
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 2d35a116..337d4309 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 8899bf26..4727d099 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_internal (cairo_output_stream_t *output,
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 *pattern)
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 3d14c9d2..00000000
--- 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@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 b8d7e04f..e5a3d001 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],