Commit graph

58 commits

Author SHA1 Message Date
Andrea Canciani
bb30dae210 script: Fix compilation
Use accessors instead of directly accessing path optimization flags.

Change the conditions for outputting tolerance (was 'when
path->is_rectilinear is FALSE', now is 'whenever the path includes a
curve').

Always output tolerance for strokes, because pen depends on tolerance
(for round caps/joins and for cusps).
2010-10-30 13:37:33 +02:00
Benjamin Otte
e79acf47a5 subsurface: Make CAIRO_SURFACE_TYPE_SUBSURFACE public 2010-08-26 12:55:39 +02:00
Chris Wilson
9b9952ab4f Convert mime data length to use unsigned long
What we want to use is size_t, but we don't want the implied POSIX
dependency. However, POSIX does say that size_t is an unsigned integer
that is no longer than a long, so it would appear safe to use an
unsigned long as a replacement. Safer at least than unsigned int.
2010-07-10 11:16:19 +01:00
Chris Wilson
b8051ee985 script: Pass the buffer length back to freetype.
After querying the required size, inform the backend of the allocated
size of the buffer.
2010-06-19 18:09:27 +01:00
Andrea Canciani
baaf312e04 pattern: remove content field from solid patterns
The content field in solid patterns had ill-defined semantic (or no
semantic at all), thus it can be removed.
2010-06-10 16:07:41 +02:00
Chris Wilson
45d4c6e0b2 script: Replace the missing " " after pop
I accidentally deleted the whitespace after popping the recording
surface, thus causing the scripts to be broken.
2010-04-28 10:01:06 +01:00
Chris Wilson
ca3df75e8f script: Reconstruct subsurfaces. 2010-04-28 09:54:56 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Andrea Canciani
b7fbda276d Revert "script: Another RGB16_565 warning."
This reverts commit a9f5064933.

The change was already applied in bdf8f50ada.
2010-04-19 10:38:43 +02:00
Chris Wilson
a9f5064933 script: Another RGB16_565 warning. 2010-04-10 16:03:14 +01:00
Chris Wilson
c004800fae script: Compile without FT_FONT 2010-04-07 22:50:34 +01:00
Chris Wilson
bdf8f50ada script: Another RGB16_565 warning. 2010-04-07 22:50:21 +01:00
Chris Wilson
24fc36c10f script: Fix endian encoding of '<|' length.
Andrea found and fixed (and updated all the traces!) an endian bug where
we were encoding a 32bit length inside the compressed string stream.
However, this one inside the script backed escaped his notice.
2010-04-02 08:51:03 +01:00
Chris Wilson
7ab350378e Silence enumeration warnings following addition of RGB16_565 2010-03-30 18:31:34 +01:00
Chris Wilson
548092fe8c script: Free the surface/font bitmaps. 2010-03-23 20:08:36 +00:00
Chris Wilson
83d1bd9f37 script: Manually unlink font entries upon destruction
As the device is already finished, we can not lock it without raising an
error, so we have to open code the destruction of the font entries.
Fortunately we can make several simplifying assumptions about the
required cleanup as we know the device is also being destroyed.
2010-03-23 20:04:10 +00:00
Chris Wilson
cccf6753ab script: More acquire device fixes.
We also need to acquire the device upon finish, similar surface creation
and the pagination functions, i.e. the other times outside of the
drawing ops that must modify the shared context/device.
2010-03-23 19:45:35 +00:00
Chris Wilson
b73a33b89e script: Make the test suite run again! 2010-03-21 20:40:19 +00:00
M Joonas Pihlaja
5b7f4bb241 api: Introduce CAIRO_FORMAT_INVALID formally in the API.
We were exposing the actual value of CAIRO_FORMAT_INVALID
through API functions already, so it makes sense to just
go ahead and put it in the cairo_format_t enum.
2010-03-01 01:21:31 +02:00
Benjamin Otte
8bb06915ed image: split cairo_image_surface_coerce()
Split into a general cairo_image_surface_coerce() that coerces to one of
the 3 supported formats (ARGB32, RGB24, A8) based on content and the
more general cairo_image_surface_coerce_to_format() that coerces to a
specified format.
2010-02-23 21:03:31 +01:00
Chris Wilson
2a466ba070 script: Encode octal values correctly.
Oops, we were emitting the octal numerals in reverse order.
2010-01-22 23:01:53 +00:00
Chris Wilson
49ab86772a script: Port cairo_script_context_t to cairo_device_t
Use the unifying cairo_device_t for cairo_script_context_t and replace.
2010-01-22 23:01:50 +00:00
Chris Wilson
f617d5fc98 Add cairo_device_t
The device is a generic method for accessing the underlying interface
with the native graphics subsystem, typically the X connection or
perhaps the GL context. By exposing a cairo_device_t on a surface and
its various methods we enable finer control over interoperability with
external interactions of the device by applications. The use case in
mind is, for example, a multi-threaded gstreamer which needs to serialise
its own direct access to the device along with Cairo's across many
threads.

Secondly, the cairo_device_t is a unifying API for the mismash of
backend specific methods for controlling creation of surfaces with
explicit devices and a convenient hook for debugging and introspection.

The principal components of the API are the memory management of:

  cairo_device_reference(),
  cairo_device_finish() and
  cairo_device_destroy();

along with a pair of routines for serialising interaction:

  cairo_device_acquire() and
  cairo_device_release()

and a method to flush any outstanding accesses:

  cairo_device_flush().

The device for a particular surface may be retrieved using:

  cairo_surface_get_device().

The device returned is owned by the surface.
2010-01-22 23:01:50 +00:00
Chris Wilson
cfd204824f Constify stroke style and matrices.
As a simple step to ensure that we do not inadvertently modify (or at least
generate compiler warns if we try) user data, mark the incoming style
and matrices as constant.
2010-01-22 23:01:49 +00:00
Chris Wilson
c50c8b90c0 Move _cairo_error() to a standalone header
A pending commit will want to include some utility code from cairo and
so we need to extricate the error handling from the PLT symbol hiding.
2010-01-22 22:30:43 +00:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Benjamin Otte
6809e12161 [API] Make _cairo_meta_surface_replay() private again
Replaying a meta surface can be achieved by using it as a source for a
cairo_paint() so exporting a separate API is unnecesary and confusing.
So after consulting Chris and Carl, we decided to remove the function
again.
2009-09-30 08:58:19 +02:00
Chris Wilson
a77f1933af Use the more generic is_box when doing simple extent checks
is_rectangle() is far stricter than is_box(), and is only required for a
very limited set of operations (essentially were the rectangle must
conform to the motion as described by cairo_rectangle). For the general
case where we just want to know whether we have a single rectangular path
that covers a certain area,  is_box() is sufficient.
2009-08-29 17:18:19 +01:00
Chris Wilson
155e10e632 [script] Fix use of freed list
A typo, I missed converting the user over to the freshly sorted list,
leaving it iterating over original but checking the sorted for termination
conditions.
2009-08-29 17:07:40 +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
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
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
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