Commit graph

26 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
bed2701e1c Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)

In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.

Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:

ppc:
Speedups
========
image-rgba         evolution-20090607-0    1026085.22 0.18% -> 672972.07 0.77%:  1.52x speedup
▌
image-rgba         evolution-20090618-0    680579.98 0.12% -> 573237.66  0.16%:  1.19x speedup
▎
image-rgba      swfdec-fill-rate-4xaa-0    460296.92 0.36% -> 407464.63  0.42%:  1.13x speedup
▏
image-rgba      swfdec-fill-rate-2xaa-0    128431.95 0.47% -> 115051.86  0.42%:  1.12x speedup
▏
Slowdowns
=========
image-rgba     firefox-periodic-table-0    56837.61 0.78% -> 66055.17    3.20%:  1.09x slowdown
▏
2009-07-23 15:32:14 +01:00
Chris Wilson
710308c64e [script] Extended blend mode support. 2009-07-14 16:31:41 +01:00
Chris Wilson
8a10ab1c04 [script] Tidy dict construction for glyphs
Replace dict with '<< ... >>' similar to surface definitions as it is
easier to read in scripts.
2009-07-04 18:46:21 +01:00
Chris Wilson
fef3649953 [script] Fix the trivial errors running the test suite
A few typos crept in breaking the script output and various refreshes of
the expected results.
2009-07-04 18:32:57 +01:00
Chris Wilson
97bd2228a6 [script] Insert spaces around '<<' and '>>'
The dictionary constructors are just ordinary tokens so need space for
delimiters.
2009-07-03 19:41:51 +01:00
Chris Wilson
6003ab77e1 Export meta-surface
The meta-surface is a vital tool to record a trace of drawing commands
in-memory. As such it is used throughout cairo.

The value of such a surface is immediately obvious and should be
applicable for many applications. The first such case is by
cairo-test-trace which wants to record the entire graph of drawing commands
that affect a surface in the event of a failure.
2009-07-03 18:26:50 +01:00
Chris Wilson
2a9903dbbf [script] Trim some excess verbage
Remove some redundant defining of surfaces and contexts and of setting
defaults. In order to reduce the number of defines, we need to operate on
the operand stack more frequently - though in practice those operations
are quite rare.
2009-07-03 16:47:42 +01:00
Chris Wilson
ce0b136a44 Query the backend to see if we can repaint the solid pattern.
If we are dithering on the Xlib backend we can not simply repaint the
surface used for a solid pattern and must recreate it from scratch.
However, for ordinary XRender usage we do not want to have to pay that
price - so query the backend to see if we can reuse the surface.
2008-12-18 12:06:45 +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
bcb2724920 [path] Mark points as const during _cairo_path_fixed_interpret()
Use const to document the read-only nature of the arguments passed to the
callbacks.
2008-12-12 11:11:49 +00:00
M Joonas Pihlaja
4a9b274eeb [cairo-spans] Add a check/create_span_renderer backend methods.
A surface will have the chance to use span rendering at cairo_fill()
time by creating a renderer for a specific combination of
pattern/dst/op before the path is scan converted.  The protocol is to
first call check_span_renderer() to see if the surface wants to render
with spans and then later call create_span_renderer() to create the
renderer for real once the extents of the path are known.

No backends have an implementation yet.
2008-12-06 14:04:36 +02:00
Chris Wilson
e6963a5bfe Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are
extremely unlikely.
2008-11-29 11:20:34 +00:00
Chris Wilson
d1801c23fa Mark if(status) as being unlikely.
The error paths should be hit very rarely during normal operation, so mark
them as being unlikely so gcc may emit better code.
2008-11-29 11:20:33 +00:00
Chris Wilson
a856371bef Add CairoScript backend.
A new meta-surface backend for serialising drawing operations to a
CairoScript file. The principal use (as currently envisaged) is to provide
a round-trip testing mechanism for CairoScript - i.e. we can generate
script files for every test in the suite and check that we can replay them
with perfect fidelity. (Obviously this does not provide complete coverage
of CairoScript's syntax, but should give reasonable coverage over the
operators.)
2008-11-13 11:36:54 +00:00