mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-03 20:40:26 +01:00
Remove XML surface
According to the Debian code search tool, nothing uses it as part of the Cairo public API, and it has been disabled for a long time with nobody complaining about it.
This commit is contained in:
parent
338eca4342
commit
2bef8669bc
9 changed files with 1 additions and 1643 deletions
10
meson.build
10
meson.build
|
|
@ -595,15 +595,6 @@ if zlib_dep.found()
|
|||
conf.set('CAIRO_HAS_INTERPRETER', 1)
|
||||
endif
|
||||
|
||||
if zlib_dep.found() and png_dep.found() and get_option('xml').enabled()
|
||||
feature_conf.set('CAIRO_HAS_XML_SURFACE', 1)
|
||||
built_features += [{
|
||||
'name': 'cairo-xml',
|
||||
'description': 'XML surface backend',
|
||||
'deps': [zlib_dep],
|
||||
}]
|
||||
endif
|
||||
|
||||
bfd_dep = cc.find_library('bfd', has_headers: ['bfd.h'], required: get_option('symbol-lookup'))
|
||||
if bfd_dep.found() and \
|
||||
cc.has_function('bfd_openr', dependencies: [bfd_dep]) and \
|
||||
|
|
@ -839,7 +830,6 @@ summary({
|
|||
'Observer': true,
|
||||
'Mime': true,
|
||||
'Tee': feature_conf.get('CAIRO_HAS_TEE_SURFACE', 0) == 1,
|
||||
'XML': feature_conf.get('CAIRO_HAS_XML_SURFACE', 0) == 1,
|
||||
'Xlib': feature_conf.get('CAIRO_HAS_XLIB_SURFACE', 0) == 1,
|
||||
'Xlib Xrender': feature_conf.get('CAIRO_HAS_XLIB_XRENDER_SURFACE', 0) == 1,
|
||||
'Quartz': feature_conf.get('CAIRO_HAS_QUARTZ_SURFACE', 0) == 1,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ option('tee', type : 'feature', value : 'disabled')
|
|||
option('xcb', type : 'feature', value : 'auto')
|
||||
option('xlib', type : 'feature', value : 'auto')
|
||||
option('xlib-xcb', type : 'feature', value : 'disabled')
|
||||
option('xml', type : 'feature', value : 'disabled')
|
||||
option('zlib', type : 'feature', value : 'auto') # script, ps, pdf, xml surfaces
|
||||
|
||||
# Tests
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,67 +0,0 @@
|
|||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2009 Chris Wilson
|
||||
*
|
||||
* 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, 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 Chris Wilson
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Wilson <chris@chris-wilson.co.uk>
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_XML_H
|
||||
#define CAIRO_XML_H
|
||||
|
||||
#include "cairo.h"
|
||||
|
||||
#if CAIRO_HAS_XML_SURFACE
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
cairo_public cairo_device_t *
|
||||
cairo_xml_create (const char *filename);
|
||||
|
||||
cairo_public cairo_device_t *
|
||||
cairo_xml_create_for_stream (cairo_write_func_t write_func,
|
||||
void *closure);
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_xml_surface_create (cairo_device_t *xml,
|
||||
cairo_content_t content,
|
||||
double width, double height);
|
||||
|
||||
cairo_public cairo_status_t
|
||||
cairo_xml_for_recording_surface (cairo_device_t *xml,
|
||||
cairo_surface_t *surface);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#else /*CAIRO_HAS_XML_SURFACE*/
|
||||
# error Cairo was not compiled with support for the XML backend
|
||||
#endif /*CAIRO_HAS_XML_SURFACE*/
|
||||
|
||||
#endif /*CAIRO_XML_H*/
|
||||
|
|
@ -73,8 +73,7 @@
|
|||
|
||||
#if CAIRO_HAS_PDF_SURFACE || \
|
||||
CAIRO_HAS_PS_SURFACE || \
|
||||
CAIRO_HAS_SCRIPT_SURFACE || \
|
||||
CAIRO_HAS_XML_SURFACE
|
||||
CAIRO_HAS_SCRIPT_SURFACE
|
||||
#define CAIRO_HAS_DEFLATE_STREAM 1
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -195,9 +195,6 @@ cairo_feature_sources = {
|
|||
'cairo-svg': [
|
||||
'cairo-svg-surface.c',
|
||||
],
|
||||
'cairo-xml': [
|
||||
'cairo-xml-surface.c',
|
||||
],
|
||||
'cairo-tee': [
|
||||
'cairo-tee-surface.c',
|
||||
],
|
||||
|
|
@ -218,7 +215,6 @@ cairo_feature_headers = {
|
|||
'cairo-gl': ['cairo-gl.h'],
|
||||
'cairo-script': ['cairo-script.h'],
|
||||
'cairo-tee': ['cairo-tee.h'],
|
||||
'cairo-xml': ['cairo-xml.h'],
|
||||
'cairo-vg': ['cairo-vg.h'],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,14 +42,6 @@ if gtk_dep.found()
|
|||
]
|
||||
endif
|
||||
|
||||
if feature_conf.get('CAIRO_HAS_XML_SURFACE', 0) == 1
|
||||
expat_dep = dependency('expat', fallback: ['expat', 'expat_dep'])
|
||||
cairo_utils += [
|
||||
['trace-to-xml.c', {'deps': [expat_dep]}],
|
||||
['xml-to-trace.c', {'deps': [expat_dep]}],
|
||||
]
|
||||
endif
|
||||
|
||||
foreach util : cairo_utils
|
||||
exe_name = util[0].split('.')[0]
|
||||
util_deps = util.get(1, {}).get('deps', [])
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <cairo-xml.h>
|
||||
#include <cairo-script-interpreter.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static cairo_surface_t *
|
||||
_surface_create (void *_closure,
|
||||
cairo_content_t content,
|
||||
double width, double height,
|
||||
long uid)
|
||||
{
|
||||
cairo_surface_t **closure = _closure;
|
||||
cairo_surface_t *surface;
|
||||
cairo_rectangle_t extents;
|
||||
|
||||
extents.x = extents.y = 0;
|
||||
extents.width = width;
|
||||
extents.height = height;
|
||||
surface = cairo_recording_surface_create (content, &extents);
|
||||
if (*closure == NULL)
|
||||
*closure = cairo_surface_reference (surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
stdio_write (void *closure, const unsigned char *data, unsigned len)
|
||||
{
|
||||
if (fwrite (data, len, 1, closure) == 1)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
else
|
||||
return CAIRO_STATUS_WRITE_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
cairo_surface_t *surface = NULL;
|
||||
const cairo_script_interpreter_hooks_t hooks = {
|
||||
.closure = &surface,
|
||||
.surface_create = _surface_create,
|
||||
};
|
||||
cairo_script_interpreter_t *csi;
|
||||
FILE *in = stdin, *out = stdout;
|
||||
|
||||
if (argc >= 2 && strcmp (argv[1], "-"))
|
||||
in = fopen (argv[1], "r");
|
||||
if (argc >= 3 && strcmp (argv[2], "-"))
|
||||
out = fopen (argv[2], "w");
|
||||
|
||||
csi = cairo_script_interpreter_create ();
|
||||
cairo_script_interpreter_install_hooks (csi, &hooks);
|
||||
cairo_script_interpreter_feed_stream (csi, in);
|
||||
cairo_script_interpreter_finish (csi);
|
||||
cairo_script_interpreter_destroy (csi);
|
||||
|
||||
if (surface != NULL) {
|
||||
cairo_device_t *xml;
|
||||
|
||||
xml = cairo_xml_create_for_stream (stdio_write, out);
|
||||
cairo_xml_for_recording_surface (xml, surface);
|
||||
cairo_device_destroy (xml);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
if (in != stdin)
|
||||
fclose (in);
|
||||
if (out != stdout)
|
||||
fclose (out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,263 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <expat.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct trace {
|
||||
FILE *stream;
|
||||
char tail_buf[80];
|
||||
const char *tail;
|
||||
int surface_depth;
|
||||
};
|
||||
|
||||
static void
|
||||
start_element (void *closure,
|
||||
const char *element,
|
||||
const char **attr)
|
||||
{
|
||||
struct trace *trace = closure;
|
||||
|
||||
if (strcmp (element, "surface") == 0) {
|
||||
const char *content = "COLOR_ALPHA";
|
||||
const char *width = NULL;
|
||||
const char *height = NULL;
|
||||
|
||||
while (*attr) {
|
||||
if (strcmp (*attr, "content") == 0) {
|
||||
content = *++attr;
|
||||
} else if (strcmp (*attr, "width") == 0) {
|
||||
width = *++attr;
|
||||
} else if (strcmp (*attr, "height") == 0) {
|
||||
height = *++attr;
|
||||
} else {
|
||||
fprintf (stderr, "unknown surface attribute '%s'\n", *attr);
|
||||
attr++;
|
||||
}
|
||||
attr++;
|
||||
}
|
||||
|
||||
fprintf (trace->stream, "<< /content //%s", content);
|
||||
if (width != NULL && height != NULL) {
|
||||
fprintf (trace->stream,
|
||||
" /width %s /height %s",
|
||||
width, height);
|
||||
}
|
||||
if (trace->surface_depth++ == 0)
|
||||
fprintf (trace->stream, " >> surface context\n");
|
||||
else
|
||||
fprintf (trace->stream, " >> surface dup context\n");
|
||||
} else if (strcmp (element, "image") == 0) {
|
||||
const char *format = "ARGB24";
|
||||
const char *width = NULL;
|
||||
const char *height = NULL;
|
||||
|
||||
while (*attr) {
|
||||
if (strcmp (*attr, "format") == 0) {
|
||||
format = *++attr;
|
||||
} else if (strcmp (*attr, "width") == 0) {
|
||||
width = *++attr;
|
||||
} else if (strcmp (*attr, "height") == 0) {
|
||||
height = *++attr;
|
||||
} else {
|
||||
fprintf (stderr, "unknown image attribute '%s'\n", *attr);
|
||||
attr++;
|
||||
}
|
||||
attr++;
|
||||
}
|
||||
|
||||
fprintf (trace->stream,
|
||||
"<< /format //%s /width %s /height %s /mime-type (image/png) /source <{",
|
||||
format, width, height);
|
||||
assert (trace->tail == NULL);
|
||||
trace->tail = "}> >> image pattern\n";
|
||||
} else if (strcmp (element, "solid") == 0) {
|
||||
trace->tail = " rgba\n";
|
||||
} else if (strcmp (element, "linear") == 0) {
|
||||
const char *x1 = NULL;
|
||||
const char *x2 = NULL;
|
||||
const char *y1 = NULL;
|
||||
const char *y2 = NULL;
|
||||
|
||||
while (*attr) {
|
||||
if (strcmp (*attr, "x1") == 0) {
|
||||
x1 = *++attr;
|
||||
} else if (strcmp (*attr, "x2") == 0) {
|
||||
x2 = *++attr;
|
||||
} else if (strcmp (*attr, "y1") == 0) {
|
||||
y1 = *++attr;
|
||||
} else if (strcmp (*attr, "y2") == 0) {
|
||||
y2 = *++attr;
|
||||
} else {
|
||||
fprintf (stderr, "unknown linear attribute '%s'\n", *attr);
|
||||
attr++;
|
||||
}
|
||||
attr++;
|
||||
}
|
||||
|
||||
fprintf (trace->stream, "%s %s %s %s linear\n", x1, y1, x2, y2);
|
||||
} else if (strcmp (element, "radial") == 0) {
|
||||
const char *x1 = NULL;
|
||||
const char *y1 = NULL;
|
||||
const char *r1 = NULL;
|
||||
const char *y2 = NULL;
|
||||
const char *x2 = NULL;
|
||||
const char *r2 = NULL;
|
||||
|
||||
while (*attr) {
|
||||
if (strcmp (*attr, "x1") == 0) {
|
||||
x1 = *++attr;
|
||||
} else if (strcmp (*attr, "y1") == 0) {
|
||||
y1 = *++attr;
|
||||
} else if (strcmp (*attr, "r1") == 0) {
|
||||
r1 = *++attr;
|
||||
} else if (strcmp (*attr, "x2") == 0) {
|
||||
x2 = *++attr;
|
||||
} else if (strcmp (*attr, "y2") == 0) {
|
||||
y2 = *++attr;
|
||||
} else if (strcmp (*attr, "r2") == 0) {
|
||||
r2 = *++attr;
|
||||
} else {
|
||||
fprintf (stderr, "unknown radial attribute '%s'\n", *attr);
|
||||
attr++;
|
||||
}
|
||||
attr++;
|
||||
}
|
||||
|
||||
fprintf (trace->stream,
|
||||
"%s %s %s %s %s %s radial\n",
|
||||
x1, y1, r1, x2, y2, r2);
|
||||
} else if (strcmp (element, "matrix") == 0) {
|
||||
fprintf (trace->stream, "[ ");
|
||||
trace->tail = " ] set-matrix\n";
|
||||
} else if (strcmp (element, "extend") == 0) {
|
||||
trace->tail = " set-extend\n";
|
||||
} else if (strcmp (element, "filter") == 0) {
|
||||
trace->tail = " set-filter\n";
|
||||
} else if (strcmp (element, "operator") == 0) {
|
||||
trace->tail = " set-operator\n";
|
||||
} else if (strcmp (element, "tolerance") == 0) {
|
||||
trace->tail = " set-tolerance\n";
|
||||
} else if (strcmp (element, "fill-rule") == 0) {
|
||||
trace->tail = " set-fill-rule\n";
|
||||
} else if (strcmp (element, "line-cap") == 0) {
|
||||
trace->tail = " set-line-cap\n";
|
||||
} else if (strcmp (element, "line-join") == 0) {
|
||||
trace->tail = " set-line-join\n";
|
||||
} else if (strcmp (element, "line-width") == 0) {
|
||||
trace->tail = " set-line-width\n";
|
||||
} else if (strcmp (element, "miter-limit") == 0) {
|
||||
trace->tail = " set-miter-limit\n";
|
||||
} else if (strcmp (element, "antialias") == 0) {
|
||||
trace->tail = " set-antialias\n";
|
||||
} else if (strcmp (element, "color-stop") == 0) {
|
||||
trace->tail = " add-color-stop\n";
|
||||
} else if (strcmp (element, "path") == 0) {
|
||||
/* need to reset the matrix to identity before the path */
|
||||
fprintf (trace->stream, "identity set-matrix ");
|
||||
trace->tail = "\n";
|
||||
} else if (strcmp (element, "dash") == 0) {
|
||||
const char *offset = "0";
|
||||
|
||||
while (*attr) {
|
||||
if (strcmp (*attr, "offset") == 0) {
|
||||
offset = *++attr;
|
||||
}
|
||||
attr++;
|
||||
}
|
||||
|
||||
fprintf (trace->stream, "[");
|
||||
sprintf (trace->tail_buf, "] %s set-dash\n", offset);
|
||||
trace->tail = trace->tail_buf;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cdata (void *closure,
|
||||
const XML_Char *s,
|
||||
int len)
|
||||
{
|
||||
struct trace *trace = closure;
|
||||
|
||||
if (trace->tail)
|
||||
fwrite (s, len, 1, trace->stream);
|
||||
}
|
||||
|
||||
static void
|
||||
end_element (void *closure,
|
||||
const char *element)
|
||||
{
|
||||
struct trace *trace = closure;
|
||||
|
||||
if (trace->tail) {
|
||||
fprintf (trace->stream, "%s", trace->tail);
|
||||
trace->tail = NULL;
|
||||
}
|
||||
|
||||
if (strcmp (element, "paint") == 0) {
|
||||
fprintf (trace->stream, "paint\n");
|
||||
} else if (strcmp (element, "mask") == 0) {
|
||||
fprintf (trace->stream, "mask\n");
|
||||
} else if (strcmp (element, "stroke") == 0) {
|
||||
fprintf (trace->stream, "stroke\n");
|
||||
} else if (strcmp (element, "fill") == 0) {
|
||||
fprintf (trace->stream, "fill\n");
|
||||
} else if (strcmp (element, "glyphs") == 0) {
|
||||
fprintf (trace->stream, "show-glyphs\n");
|
||||
} else if (strcmp (element, "clip") == 0) {
|
||||
fprintf (trace->stream, "clip\n");
|
||||
} else if (strcmp (element, "source-pattern") == 0) {
|
||||
fprintf (trace->stream, "set-source\n");
|
||||
} else if (strcmp (element, "mask-pattern") == 0) {
|
||||
} else if (strcmp (element, "surface") == 0) {
|
||||
if (--trace->surface_depth == 0)
|
||||
fprintf (trace->stream, "pop\n");
|
||||
else
|
||||
fprintf (trace->stream, "pop pattern\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct trace trace;
|
||||
XML_Parser p;
|
||||
char buf[8192];
|
||||
int done = 0;
|
||||
FILE *in = stdin;
|
||||
|
||||
trace.stream = stdout;
|
||||
trace.tail = NULL;
|
||||
trace.surface_depth = 0;
|
||||
|
||||
if (argc >= 2 && strcmp (argv[1], "-"))
|
||||
in = fopen (argv[1], "r");
|
||||
if (argc >= 3 && strcmp (argv[2], "-"))
|
||||
trace.stream = fopen (argv[2], "w");
|
||||
|
||||
p = XML_ParserCreate (NULL);
|
||||
XML_SetUserData (p, &trace);
|
||||
XML_SetElementHandler (p, start_element, end_element);
|
||||
XML_SetCharacterDataHandler (p, cdata);
|
||||
do {
|
||||
int len;
|
||||
|
||||
len = fread (buf, 1, sizeof (buf), in);
|
||||
done = feof (stdin);
|
||||
|
||||
if (XML_Parse (p, buf, len, done) == XML_STATUS_ERROR) {
|
||||
fprintf (stderr, "Parse error at line %ld:\n%s\n",
|
||||
XML_GetCurrentLineNumber (p),
|
||||
XML_ErrorString (XML_GetErrorCode (p)));
|
||||
exit (-1);
|
||||
}
|
||||
} while (! done);
|
||||
XML_ParserFree (p);
|
||||
|
||||
if (in != stdin)
|
||||
fclose (in);
|
||||
if (trace.stream != stdout)
|
||||
fclose (trace.stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue