mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-26 10:10:44 +02:00
Add cairo_{ps,svg}_test_force_fallbacks so tests can force fallbacks.
This commit is contained in:
parent
100b30d1c0
commit
6ca30e108f
4 changed files with 156 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
54
src/cairo-ps-test.h
Normal file
54
src/cairo-ps-test.h
Normal file
|
|
@ -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 */
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
54
src/cairo-svg-test.h
Normal file
54
src/cairo-svg-test.h
Normal file
|
|
@ -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 */
|
||||
Loading…
Add table
Reference in a new issue