Commit graph

49 commits

Author SHA1 Message Date
Chris Wilson
f4019be7bd [trace] Remove a few transient pattern def/undef
It is easier on the eye to use
   '1 index set-source exch pop'
rather than
   'dup /p0 exch def p0 set-source /p0 undef'
(as patterns are expected to be temporary so we strive to avoid naming
them).
2009-07-04 13:16:42 +01:00
Chris Wilson
963664727b [trace] Compile fix for --enable-script
Silly typo as pointed out by Hans Breuer <hans@breuer.org>.
2009-06-28 10:49:37 +01:00
M Joonas Pihlaja
1b6dbcbbeb [trace] Compile without fontconfig.
Use CAIRO_HAS_FC_FONT to decide whether to export
cairo_ft_font_face_create_for_pattern() or not.
2009-06-19 19:01:14 +03:00
Chris Wilson
84e587bbfa [trace] Prevent a child process from writing to the same file
After opening a specific file or fd for ourselves, reset the
CAIRO_TRACE_FD to point to an invalid fd in order to prevent any child
processes (who inherit our environment) from attempting to trace cairo
calls. If we allow them to continue, then the two traces will intermix
and be unreplayable.
2009-06-19 14:41:39 +01:00
Chris Wilson
030ef4ca00 [trace] Change the threshold at which pixel data is immediately copied
Embed the pixels for images less than 32*32 as this catches most icons
which are frequently uploaded, but is still an unlikely size for a
destination image surface.
2009-06-19 11:56:14 +01:00
Chris Wilson
e5727e20f5 Expose _cairo_null_surface_create() via a test surface
Using a null surface is a convenient method to measure the overhead of the
performance testing framework, so export it although as a test-surface so
that it will only be available in development builds and not pollute
distributed libraries.
2009-06-15 12:03:37 +01:00
Chris Wilson
c52eed6680 [trace] Handle wrapping python
python lazily loads libcairo.so and so it is not available via RTLD_NEXT,
and we need to dlopen cairo ourselves. Similarly the linker is not able to
resolve any naked function references and so we need to ensure that all of
our own calls into the library are wrapped with DLCALL.
2009-06-13 15:42:43 +01:00
Chris Wilson
015df191ba [trace] Prevent overflowing the operand stack when recreating objects
Objects like cairo_scaled_font_t may return a reference to a previously
defined scaled-font instead of creating a new token each time. This caused
cairo-trace to overflow its operand stack by pushing a new instance of the
old token every time. Modify the tracer such that a font token can only
appear once on the stack -- for font-faces we remove the old operand and
for scaled-fonts we simply pop, chosen to reflect expected usage.
2009-06-08 17:40:16 +01:00
Chris Wilson
a76e09ea65 [trace] Missing newlines in error messages. 2009-05-25 22:14:56 +01:00
Chris Wilson
9099c7e730 [trace] Disable mark dirty tracing.
Applications like firefox have a very conservative approach and mark
surfaces dirty before every render. As we record the image data every
time, firefox traces can grow very large with redundant data - so allow
the user to disable mark dirty tracing.
2009-03-04 09:26:17 +00:00
Chris Wilson
6b5d2bf1a7 [trace] Comment out the redundant wrapping of FT_Open_Face()
Remove the left-over debugging spew, but leave a comment to hopefully
clarify the situation with wrapping FT_Open_Face().
2009-01-29 10:10:40 +00:00
Carl Worth
faa004033c cairo-trace: Print name of trace file.
It's just a lot easier to use cairo-trace if it tells you
what file it just created.
2009-01-29 10:10:40 +00:00
Chris Wilson
a023104400 [trace] Adopt _cairo_dtostr
In order to have locale-independent output of decimal values, we need to
manually transform such numbers into strings. As this is a solved problem
for cairo, we adopt _cairo_output_stream_printf() and in particular the
_cairo_dtostr() routine for our own printf processing.
2009-01-02 10:36:52 +00:00
Chris Wilson
ecb8dce27c [script] Recreate surface content.
Use the content recorded in the trace, defaulting to COLOR_ALPHA, to
determine the replayed surface type.
2009-01-02 09:53:24 +00:00
Chris Wilson
d21529b9ef [trace] Correct escaped characters in string literal.
Laziness caused the control character to be used instead of its
replacement in the escaped string!
2009-01-02 09:53:24 +00:00
Chris Wilson
ca39c4bf7f [trace] Correct a couple of typos.
A couple of minor typos in the escaped characters strings.
2009-01-02 09:53:24 +00:00
Chris Wilson
1f2fec7388 [trace] Fix OBO in emit_glyphs()
The largest index that will fit within 8 bits is 255 not 256!
2009-01-02 09:53:23 +00:00
Chris Wilson
7ebe9e6837 [trace] Minor tidy.
Improve scoping of variables.
2009-01-02 09:53:22 +00:00
Chris Wilson
9b46d13b6c [trace] Runtime version check.
Check that the application is using cairo >= 1.9 before attempting to
query the mime-data.
2008-12-18 10:40:13 +00:00
Chris Wilson
565b3d6ad6 [script] Switch to hyphens.
Using hyphen in the operators is easier to read than underscores.
2008-12-12 12:00:43 +00:00
Chris Wilson
e184bf0d35 Fix compilation with --enable-png=no
Adrian Johnson spotted that the build was broken if the PNG functions were
disabled. Fix.
2008-12-12 10:20:47 +00:00
Chris Wilson
0d5e533b6c [trace] Correctly push font-face onto the operand stack.
We tried to push a reference to an undefined font-face, now we just copy
from the operand stack.
2008-11-19 17:11:50 +00:00
Chris Wilson
b426346b48 [trace] Construct matrices directly
Avoid building a temporary array by constructing the matrix directly.
2008-11-19 17:11:49 +00:00
Chris Wilson
c41b99268d Conditionally include byteswap.h
Fixup compilation by copying the checks from cairo-wideint-private.h to
conditionally include byteswap.h and provide fallback implementations.
2008-11-19 11:59:21 +00:00
Chris Wilson
91c17d3332 [trace] Simple unbounded cache for symbol lookups.
Reparsing the dwarf info for every lookup is very slow, so cache the
symbol lookups. This initial implementation is unbounded in the simple
belief that the actual number of unique lookups during a program's
lifetime should be fairly small. (Extending to a bounded MRU list is left
as an exercise for the reader.)
2008-11-19 11:59:20 +00:00
Chris Wilson
5f0aa27445 [trace] Add caller line info.
Use lookup_symbol() on the return address to identify the caller and emit
useful debug info to the trace.
2008-11-13 11:36:42 +00:00
Chris Wilson
4cd6b0c0b9 [trace] Check for an undefined pattern and use index instead. 2008-11-13 11:36:41 +00:00
Chris Wilson
76f249a493 [trace] Detect and report broken traces.
We cannot trace the cairo-script-interpreter as that uses Cairo's private
symbols.
2008-11-13 11:36:40 +00:00
Chris Wilson
01e2021b2b [trace] Trace mark-dirty
Capture the image data on mark dirty and record in the trace.
2008-11-13 11:36:39 +00:00
Chris Wilson
8f3d0b55f5 [trace] Add unstable warning.
Add warning that CairoScript is unfinished and I may radically alter the
format/syntax/language before release.
2008-11-13 11:36:32 +00:00
Chris Wilson
5badcf6e37 [trace] Use a string literal for the type.
In order that the string is interned and so is only allocated the once.
2008-11-08 11:18:26 +00:00
Chris Wilson
1d0faefbc8 [trace] Record the XID as a number
Don't waste string constants (which get interned) for a simple number!
2008-11-08 11:18:26 +00:00
Chris Wilson
899a159b13 [trace] Remove stray /source
An accidental /source was pushing pushed onto the operand stack and never
used.
2008-11-08 11:18:25 +00:00
Chris Wilson
2554d17598 [surface] Pass a separate closure for the mime-type destroy notifier.
A limitation of the current API was that the destroy notifier was called
on the mime-data block. This prevents the user from passing in a pointer
to a managed block, for example a mime-data block belonging to a
ref-counted object. We can overcome this by allowing the user to specify
the closure to be used with the destroy notifier.
2008-11-07 19:30:33 +00:00
Chris Wilson
ec559822cf [trace] Use the mime-type image representation
When emitting image data, first check to see if we have a pre-compressed
alternate representation.
2008-11-05 18:13:10 +00:00
Chris Wilson
2261590875 [trace] Trim a few bytes from glyph arrays
Remove some redundant whitespace from the glyph arrays to improve
readability and shrink the output file size.
2008-11-05 15:13:02 +00:00
Chris Wilson
d1b8186fd7 [trace] Correct emission of set_font_face and set_source
set_font_face was not consuming it's operand but blithely placing an
undefined font_face onto the operand stack, whereas set_source was
performing invalid exchanges on the stack.
2008-11-05 08:36:09 +00:00
Chris Wilson
4a4b10271a [trace] Capture foreign drawables.
If we attempt to use a surface as a source before we write to it, record
the surface contents.
2008-11-05 08:36:02 +00:00
Chris Wilson
432fe1ec27 [trace] Mark filter mode as immediate.
Be consistent and use "//" for the filter mode to indicate a constant.
2008-11-05 08:36:01 +00:00
Chris Wilson
068d465bb3 [trace] Fix emission of cairo_scaled_font_create()
In the case where the font face was no longer on the operand stack, the
font face would not have been passed to cairo_scaled_font_create().
2008-11-04 14:57:21 +00:00
Chris Wilson
a3d56c60e8 [trace] Use a common directory by default.
If called directly (e.g. via /etc/ld.so.preload) put the output trace into
a central directory, and not the pwd.
2008-11-04 14:22:08 +00:00
Chris Wilson
5ba95b7e12 [trace] Convert [1 0 0 1 0 0] to identity
Simplify the trace/replay by replacing the identity array with the
identity operator.
2008-11-04 10:43:02 +00:00
Chris Wilson
34586860ef [trace] Big-endian compile fixes.
A few typos.
2008-11-03 12:11:14 +00:00
Chris Wilson
ca83df55a6 [trace] Wrap test surfaces.
Wrap the test surfaces to avoid crashes whilst tracing the test suite.
2008-11-03 11:46:31 +00:00
Chris Wilson
8fc3d0ffeb [mime-data] Allow embedding of arbitrary mime-types.
Use the surface user-data array allow to store an arbitrary set of
alternate image representations keyed by an interned string (which
ensures that it has a unique key in the user-visible namespace).

Update the API to mirror that of cairo_surface_set_user_data() [i.e.
return a status indicator] and switch internal users of the mime-data to
the public functions.
2008-11-03 11:24:12 +00:00
Chris Wilson
04e3bb932e [trace] Emit set_mime_data().
Wrap the new cairo_surface_set_mime_data() function.
2008-11-03 11:24:07 +00:00
Chris Wilson
350fa7b98e [trace] Fix boundary terminations
Don't increment the terminator!
2008-11-03 09:36:53 +00:00
Chris Wilson
f3cbc5cf45 [trace] Use utf8 len in show_text_glyphs().
Honour the parameter specifying the length of the utf8 string when
emitting show_text_glyphs.
2008-11-03 09:36:39 +00:00
Chris Wilson
c554f18d78 [util] Add cairo-trace.
This tool can be used to trace all the cairo function calls made by an
applications.  This is useful for either extracting a test case triggering
a bug from an application, or simply to get a general idea of how an
application is using cairo.

After make install, cairo-trace program arguments, will print out all the
cairo calls to the terminal and also capture theme in ./program.$pid.trace

The format of the output is CairoScript, watch this space for more
cairo-script tools!
2008-10-31 15:37:58 +00:00