[svg] Get rid of _cairo_svg_test_force_fallbacks

in favor of cairo_boilerplate_svg_surface_force_fallbacks.
This commit is contained in:
Behdad Esfahbod 2007-04-21 03:08:26 -04:00
parent ea1b7c2d8a
commit d2bb5f3007
8 changed files with 60 additions and 77 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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 */

View file

@ -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,

View file

@ -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 */

View file

@ -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;
}