Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cairo/util/cairo-script/csi-trace.c
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (41 sloc)
1.21 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cairo-script.h> | |
#include <cairo-script-interpreter.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <libgen.h> | |
static cairo_surface_t * | |
_script_surface_create (void *closure, | |
cairo_content_t content, | |
double width, double height, | |
long uid) | |
{ | |
return cairo_script_surface_create (closure, content, width, height); | |
} | |
int | |
main (int argc, char **argv) | |
{ | |
cairo_script_interpreter_t *csi; | |
cairo_script_interpreter_hooks_t hooks = { | |
.surface_create = _script_surface_create, | |
}; | |
int i; | |
char buf[4096]; | |
csi = cairo_script_interpreter_create (); | |
for (i = 1; i < argc; i++) { | |
if (strcmp (argv[i], "--version")) { | |
printf ("%s: version %s\n", argv[0], __DATE__); | |
exit (0); | |
} else if (strcmp (argv[i], "--help")) { | |
printf ("usage: %s < in > out\n", argv[0]); | |
exit (0); | |
} | |
snprintf (buf, sizeof (buf), "%s.trace", basename (argv[i])); | |
cairo_device_destroy (hooks.closure); | |
hooks.closure = cairo_script_create (buf); | |
cairo_script_interpreter_install_hooks (csi, &hooks); | |
cairo_script_interpreter_run (csi, argv[i]); | |
} | |
cairo_device_destroy (hooks.closure); | |
return cairo_script_interpreter_destroy (csi); | |
} |