diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2007-04-21 03:08:26 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2007-04-21 03:08:26 -0400 |
commit | d2bb5f30079badf1029fa71faab9d6781092a271 (patch) | |
tree | 39ccf5553854e9d69eae4fc10d9c9024f183bdee | |
parent | ea1b7c2d8a55d694d575c0bb711e60f70a33ff77 (diff) |
[svg] Get rid of _cairo_svg_test_force_fallbacks
in favor of cairo_boilerplate_svg_surface_force_fallbacks.
-rw-r--r-- | boilerplate/Makefile.am | 1 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-svg.c | 19 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-svg.h | 33 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/cairo-svg-surface-private.h | 2 | ||||
-rw-r--r-- | src/cairo-svg-surface.c | 20 | ||||
-rw-r--r-- | src/cairo-svg-test.h | 54 | ||||
-rw-r--r-- | test/fallback-resolution.c | 4 |
8 files changed, 60 insertions, 77 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am index 1528409a..08f8bb2b 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 cc344c93..b85a95e8 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 *closure) 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 00000000..12299168 --- /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@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 b7bfaf56..9a8e51f7 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 5699350a..c2b2206b 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 3c7157c2..e1230c3b 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 (cairo_svg_document_t *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 (cairo_svg_document_t *document) 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 396d4597..00000000 --- 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@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 a5359e6f..37fd5919 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; } |