Commit graph

7486 commits

Author SHA1 Message Date
Chris Wilson
b6d96bba8a [win32] Trust the clipping code to trim roi to our surface
The higher level code ensures that the region of interest is trimmed to
our declared surface extents, so performing the intersection again is
redundant. Furthermore with the change in the clipping code, the
fallback region is no longer clipped, especially as the clip that is
currently set upon the DC is likely to be stale and incorrect for the
fallback.

Hopefully this resolves the assertion failure reported by Damian Frank,
http://lists.cairographics.org/archives/cairo/2009-August/018015.html

CC:  Damian Frank <damian.frank@gmail.com>
2009-08-29 17:07:35 +01:00
Vladimir Vukicevic
d7faec024a Add skia backend
Originally written by Vladimir Vukicevic to investigate using Skia for
Mozilla, it provides a nice integration with a rather interesting code
base. By hooking Skia underneath Cairo it allows us to directly compare
code paths... which is interesting.

[updated by Chris Wilson]
2009-08-29 17:07:35 +01:00
Chris Wilson
af6df4af51 [configure] Choose a better name for the 'temporary' egl iterator
The problem is that it remains referenced by egl_NONPKGCONFIG_LIBS and so
must not be subsequently overwritten, so give it an egl_ prefix.
2009-08-29 17:07:35 +01:00
Chris Wilson
83c2f44dd9 [test] Update REFERENCE_IMAGES 2009-08-29 17:07:35 +01:00
Chris Wilson
f99e184144 [build] Remove -Wcast-align
Use -Wcast-align simply generates too much noise due to false-positive
reports when casting pixels to uint32_t.
2009-08-29 17:07:35 +01:00
Chris Wilson
5fdf5b311e [fallback] Reduce paint + clipmask to fill
Under simple, yet common, conditions using a bounded operator and painting
with a single complex clip we can reduce the strength of that operation to
a fill. In effect this removes the need for a temporary mask for some
backends (GL, drm, xlib).
2009-08-29 17:07:34 +01:00
Chris Wilson
425b0e35e2 Add xml surface
A very simple surface that produces a hierarchical DAG in a simple XML
format. It is intended to be used whilst debugging, for example with the
automatic regression finding tools of cairo-sphinx, and with test suites
that just want to verify that their code made a particular Cairo call.
2009-08-29 17:07:34 +01:00
Chris Wilson
6e0b3be903 Add cairo-sphinx utility for regression analysis
sphinx is an alternate version of the current cairo-test-trace. It's
purpose is to replay a live application (which may just be a replay of a
trace) against a backend and its reference. The improvement over the
original cairo-test-trace is that the reference backend may be from an
older version of cairo.
2009-08-29 17:07:34 +01:00
Chris Wilson
c980affce0 [script] Apply device offset when replaying meta surface
As we set the size of the surface to fit the ink extents of the meta
surface, we also need to ensure that the origin  of the script lies at the
origin of the ink extents.
2009-08-29 17:07:33 +01:00
Chris Wilson
eb33f842dc [meta] Missing status check
We need to check the status on the created image before use.
2009-08-29 17:07:33 +01:00
Chris Wilson
ce6a2cc5d2 [wrapper] Always copy clip
We always need to make a local copy of the clip as the backends are free
to modify it as they process the operation.
2009-08-29 17:07:33 +01:00
Chris Wilson
6ff711b630 [matrix] Improve bbox finding for translation matrix
If the matrix is a pure translation matrix than we can skip determination
of the extents and just translate the input bbox.
2009-08-29 17:07:02 +01:00
Chris Wilson
cd7b27ff5c Add 'flight-data-recorder' utility.
This is a simple variation on cairo-trace that wraps records the last 16
contexts by wrapping the target surface inside a tee surface, along with a
meta/recording surface. Then on receipt of a SIGUSR1, those last 16
contexts are played via a script-surface into /tmp/fdr.trace.

Mostly proof-of-concept, it seems to be causing a number of rendering
glitches whilst testing with firefox -- otherwise, it seems to works.
2009-08-29 08:08:39 +01:00
Chris Wilson
658cdc7c9a Introduce cairo_tee_surface_t
Add a new surface type that multiplies it input onto several output
surfaces. The only limitation is that it requires a master surface that is
used whenever we need to query surface options, such as font options and
extents.
2009-08-29 08:08:39 +01:00
Chris Wilson
4ae7186719 [script] Correct emission of get_target() for a popped context
If the context is no longer on the operand stack, then we need to recall
the surface via a definition.
2009-08-29 08:08:39 +01:00
Chris Wilson
8d1bf830c0 Fix errors found by clang
Shadowed variables, unused writes and some dead code.
2009-08-29 08:08:39 +01:00
Chris Wilson
d8dbce021a [script] recursive active (type3 glyphs)
The assumption that an active surface could not recurse into another
operation was invalid - due to the complexity of handling type3 glyphs.
2009-08-29 08:08:38 +01:00
Chris Wilson
eba6b5126a [build] Add options for warning about bad casts
-Wbad-function-cast in particular. Triggers quite a few warnings where we
have explicitly cast to an integer.
2009-08-29 08:08:38 +01:00
Chris Wilson
33ef32af4e [clip] Use the rectangular tessellator to extract boxes 2009-08-29 08:08:38 +01:00
Chris Wilson
ab035ab2c7 [tessellate] Rectangular special case
Add an even simpler sweep-line tessellator for rectangular trapezoids (as
produced by the rectilinear stoker and box filler).

This is so simple it even outperforms pixman's region validation code for the
purposes of path-to-region conversion.
2009-08-29 08:08:38 +01:00
Chris Wilson
d7b0c3b784 [script] Track scaled-font
Instead of emitting the (font-face, matrix and options) elements when
setting up the desired font on the matrix, simply restore the scaled-font.
2009-08-29 08:08:38 +01:00
Chris Wilson
7306305cc8 [script] Emit surface content
Include the desired content with the creation info.
2009-08-29 08:08:37 +01:00
Chris Wilson
052211b072 [script] Garbage collect contexts on context switch
Previously the contexts were permanently associated with the surface and
only destroyed along with the final reference to the surface. This meant
that we kept a large number of unwanted contexts in memory. Most
applications only have a few contexts active at any time, so remove
inactive contexts from the operand stack every time we perform an
operation on a different context.
2009-08-29 08:08:37 +01:00
Chris Wilson
8f8b91d904 [script] Wrap snapshot.
Use the snapshot of our target surface if available.
2009-08-29 08:08:37 +01:00
Chris Wilson
fee647c985 [script] Read from a FILE stream
For ease of implementing the interpreter inside a pipeline, add a method
to execute a FILE *.
2009-08-29 08:08:37 +01:00
Chris Wilson
a9d997fecd [script] Introduce cairo_script_context_t
cairo_script_context_t is an encapsulation object for interfacing with the
output - multiple surfaces can share the same context, meaning that they
write to the same destination file/stream.
2009-08-29 08:08:36 +01:00
Chris Wilson
28887ac272 [trace] Fix emission of similar (track operands) 2009-08-29 08:08:36 +01:00
Chris Wilson
dbd9438f5d [stroke] Only mark traps as having intersection if non-empty.
We were hitting an assertion attempting to eliminate intersections inside
the rectilinear tessellator for empty strokes. We can avoid this
assertion, by only marking the traps as having potential intersections iff
it is non-empty.
2009-08-29 08:08:36 +01:00
Chris Wilson
60d73da9f2 [clip] Cache intermediate clip masks.
As we now superimpose a per-operation clip, this defeats the current
top-level caching mechanism. Instead we need to cache the mask for
each path. This still seems quite wasteful, and an avenue would be to
avoid caching if the path is rectilinear and reduce the number of
required composite operations. (However, first find test case...)
2009-08-29 08:08:36 +01:00
Chris Wilson
50c7d637f3 [trace] Emit an 'index' for an undefined surface
Larry Ewing hit a bug in cairo-trace whereby it tried to create a similar
surface referencing an undefined object. This fix checks whether the
object has yet to be defined, and if not issues an index in order to copy
the appropriate operand from the stack.
2009-08-29 08:08:36 +01:00
Chris Wilson
3a483c2896 [gstate] Convert simple mask() into a paint()
As using mask() prevents various optimisations in the backends (for
example the use of geometric clips) and for some may trigger fallbacks,
perform the simplifications usually done (too late) by the pattern layer
in the generic gstate layer. This allows us on the odd occasion to
transform a mask() into a paint() but perhaps more importantly removes the
need for identical transformations in each backend.
2009-08-29 08:08:35 +01:00
Chris Wilson
e2c31183e9 [script] Handle zero-length strings
Not sure where the zero length string is coming from, but we should
nevertheless handle it.
2009-08-29 08:08:35 +01:00
Chris Wilson
4c215162d2 [script] Off-by-one in allocation of string length.
We need pass in the real number of bytes in the string, excluding the NUL
terminator which is already accounted for.
2009-08-29 08:08:35 +01:00
Chris Wilson
55eddb7ef4 [script] A little utility to convert a trace into a trace
Replay the trace using the interpreter onto a script surface - useful for
checking idempotency.
2009-08-29 08:08:35 +01:00
Chris Wilson
4f129863df [script] Store the current stroke matrix
We can skip re-emitting stroke parameters if the values are unchanged and
the scaling matrix is unaltered.
2009-08-29 08:08:35 +01:00
Chris Wilson
858211f394 [script] Suppress resetting stroke-style elements after matrix switch
If the user is just using the default values, there is no point re-emitting
them.
2009-08-29 08:08:35 +01:00
Chris Wilson
b6db3053dc [script] Hide the implicit CLEAR for similar surfaces
Do emit the clear that is performed by the surface layer on similar
surfaces.
2009-08-29 08:08:34 +01:00
Chris Wilson
005b195f06 [pattern] Ignore matrix/filter/extend when comparing solids
Solid patterns do not use their matrices, filter or extend properties so
ignore them for the purposes of comparing and hashing.
2009-08-29 08:08:34 +01:00
Chris Wilson
bb919584c0 [script] Use a compact representation for horizontal offsets between glyphs
Kerning is quite frequent, that is to apply a horizontal but no vertical
offset to a glyph. For instance by discarding the vertical coordinate
where it remains the same and only encoding the horizontal offset we
reduce the file size by ~12.5% when tracing poppler.
2009-08-29 08:08:34 +01:00
Chris Wilson
cbee97f0e3 [script] Preserve '{}' whilst translating 2009-08-29 08:08:34 +01:00
Chris Wilson
24b2320002 [script] Fix list handling during font destruction
Use cairo_list to unhook the font correctly during the fini callback.
2009-08-29 08:08:34 +01:00
Chris Wilson
4032438625 [path] Eliminate redundant line-to before a close
As the close implicitly issues a line-to to the initial point, remove an
identical line-to if present.
2009-08-29 08:08:34 +01:00
Chris Wilson
111f2be71b [path] Discard redundant line-to
Eliminate repeated line-to to the current point.
2009-08-29 08:08:33 +01:00
Chris Wilson
a2d5f59e21 [debug] Path printer 2009-08-29 08:08:33 +01:00
Chris Wilson
4bf96bad96 [fill] Use trivial rectilinear_to_traps
Avoid a small amount of unnecessary overhead by performing a simple
conversion of the path to traps when it consists solely of simple boxes.
2009-08-29 08:08:33 +01:00
Chris Wilson
30e5fa0ce0 [polygon] Return status from path ops
This tidies the common case which was to call, for example,
_cairo_polygon_line_to(); _cairo_polygon_status();
2009-08-29 08:08:33 +01:00
Chris Wilson
3fcac1ef21 [slope] Inline _cairo_slope_init()
Move the definition to a separate header file and allow callers to inline
the simple function.
2009-08-29 08:08:33 +01:00
Chris Wilson
a1e0c4b309 [clip] Combine directly onto target
Where it is unlikely that we will reuse the temporary clip surface,
combine the clip directly with the mask.
2009-08-29 08:08:33 +01:00
Chris Wilson
3f12d9ec5d [clip] Use geometric clipping for unaligned clips
For the simple cases where the clip is an unaligned box (or boxes), apply
the clip directly to the geometry and avoid having to use an intermediate
clip-mask.
2009-08-29 08:08:33 +01:00
Chris Wilson
2457c4bede traps-as-spans
Add an interface to spans that accepts trapezoids. This allows backends
that have an efficient span-line interface but lack efficient handling
of boxes (partly due to the current poor compositor interface) to
redirect composite_trapezoids() to composite_polygon() and the
span-renderer.
2009-08-29 08:08:32 +01:00