Commit graph

6294 commits

Author SHA1 Message Date
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
Adrian Johnson
1685bbee1b test/README: fix typo 2008-11-02 20:12:30 +10:30
Adrian Johnson
540ac11113 type1-subset: return unsupported on FT errors
and let type1-fallback handle it. This fixes the bug reported by
Peter Weilbacher in
http://lists.cairographics.org/archives/cairo/2008-October/015569.html
2008-11-02 20:12:30 +10:30
Adrian Johnson
3707178fa4 PDF: Implement JPEG image embedding 2008-11-02 20:12:29 +10:30
Adrian Johnson
3c684347f4 Add cairo_surface_set_mime_data()
Currently only handles jpeg data.
2008-11-02 20:12:29 +10:30
Adrian Johnson
a39a4f52ac PS: meta-surface patterns with EXTEND_PAD are unsupported
We have to use fallback images for this.
2008-11-02 20:12:29 +10:30
Adrian Johnson
19ee13ca2b PS: Implement EXTEND_PAD for image patterns
Images with EXTEND_PAD are painted into a new image the size of the
operation extents. The new image is then embedded in the PS file with
the pattern matrix adjusted to ensure the image origin is in the
correct location.
2008-11-02 20:12:29 +10:30
Adrian Johnson
e639b53671 PDF: meta-surface patterns with EXTEND_PAD are unsupported
We have to use fallback images for this.
2008-11-02 20:12:29 +10:30
Adrian Johnson
6c92edd9a3 PDF: Implement EXTEND_PAD for image patterns
Images with EXTEND_PAD are painted into a new image the size of the
operation extents. The new image is then embedded in the PDF file with
the pattern matrix adjusted to ensure the image origin is in the
correct location.
2008-11-02 20:12:29 +10:30
Adrian Johnson
d146cb4056 PDF: Store the operation extents in each pattern
The extents will be used by EXTEND_PAD patterns as well as any other
pattern that can benefit from knowing the extents of the operation it
will be used with.
2008-11-02 20:12:29 +10:30
Adrian Johnson
fb7cfdd94d Make meta-surface store and replay extents of each operation
To be able to provide the extents of each operation to the backend
during the render phase the meta-surface needs to store the extents
computed by the analysis surface during the analysis phase.

The extents argument is either a pointer to the extents of the operation
stored in the meta-surface or NULL. During analysis the analysis surface
writes the extents to the meta-surface. During the render phase the extents
is made available to paginated surface backends.
2008-11-02 20:12:29 +10:30
Adrian Johnson
d682d275b9 Add an extents argument to the high level surface backend functions
Add a "cairo_rectangle_int_t *extents" argument to to the following
backend functions:
  paint
  mask,
  stroke
  fill
  show_glyphs
  show_text_glyphs

This will be used to pass the extents of each operation computed by
the analysis surface to the backend. This is required for implementing
EXTEND_PAD.
2008-11-02 20:12:22 +10:30
Adrian Johnson
ed2081d974 Specify a background color for XFAIL text
To improve readability on terminals with a white background.
2008-11-02 15:05:07 +10:30
Behdad Esfahbod
81c3009c07 [boilerplate/Makefile.win32] Only build source files, not headers 2008-10-31 16:45:58 -04:00
Behdad Esfahbod
d5f88c2802 [.gitignore] Add 2008-10-31 13:43:37 -04:00
Chris Wilson
49bd253fd3 [tessellator] Refine the math comments.
First of a simple substitution for -?-, as they are very confusing in
context with other minus signs floating around.

Carl has promised to go over these docs with me at the HackFest in order
to improve them (and verify them).
2008-10-31 16:40:49 +00:00
Chris Wilson
ab8a0bfd82 Add a COPYING file to each aux. source directory
Include a COPYING inside perf/, test/, util/ to clarify the licensing
conditions beneath the respective directories. This is because cairo
itself (libcairo.so) is LGPL-2.1/MPL-1.1 but that only relates to src/.
The auxiliary source files are under a mix of free licenses and we wish to
be clear just what license applies to each file.

In particular, cairo-trace needs to include the GPL terms and conditions.
2008-10-31 16:14:14 +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
Chris Wilson
992f74d884 [test] Use '.' as the field separator in the names
We frequently use '-' within the test name or format name and so we
encounter confusion as '-' is also used as the field separator. At times
this has caused a new test to break an old test because the new test would
match one of the old test's target specific reference images. So switch
everything over to use '.' between fields (test name, target, format,
subtest, etc.).
2008-10-31 13:50:55 +00:00
Chris Wilson
e90073f7dd [test] Build test suite into single binary.
Avoid calling libtool to link every single test case, by building just one
binary from all the sources.

This binary is then given the task of choosing tests to run (based on user
selection and individual test requirement), forking each test into its own
process and accumulating the results.
2008-10-31 12:30:11 +00:00
Chris Wilson
8457972d40 [type3] Whitespace.
Tightly scope the output stream.
2008-10-31 02:25:22 +00:00
Chris Wilson
08f4d49a94 [xlib] Intialise clip_dirty.
Eeek, forgot to set the clip_dirty to 0 on construction.
2008-10-31 02:25:22 +00:00
Chris Wilson
b722d5b2b9 Merge branch '1.8' 2008-10-31 02:24:25 +00:00
Chris Wilson
710f7d30d3 [scaled-font] Fix typo that prevented meta_surface lookup.
test/text-glyph-range was crashing since we requested the meta_surface but
the glyph wrongly believed it already had the meta_surface but was
checking for a path instead.
2008-10-31 02:24:05 +00:00
Adrian Johnson
05fce5bced PS/PDF: Set image Interpolation flag
If the filter mode is anything other than DEFAILT, FAST or NEAREST set the
Interpolate flag in the image dictionary so that a smoothing filter is
applied when rasterising the vector file.

As we have no control over the implementation of the Interpolate filter
(the PS/PDF specifications leave it undefined) we need to capture the
output of poppler/GS and update our reference images. (For a couple of
tests, the filtering is irrelevant so for those we set the filter to
NEAREST.)

Note that GhostScript's Interpolate filter does not work on rotated images
(and a variety of other transformations) so several of the PS reference
images have use nearest-neighbour sampling instead of a bilinear filter.
2008-10-30 21:24:54 +00:00
Chris Wilson
2c53bdb82a [paginated] Emit fallback images using FILTER_NEAREST.
Fallback images should (in theory) be emitted at native resolution, so
disable filtering to avoid introducing potential artifacts into cairo's
ideal output.
2008-10-30 21:24:49 +00:00
Chris Wilson
f03d3f9f7f [boilerplate] Remove #if VERSION>1.9.0
Remove the obsolete #if statement.
2008-10-30 19:24:29 +00:00
Chris Wilson
ef98eb26f7 [test] Reenable device offset testing.
Restore device offset testing that was temporarily disable in the run up
to the 1.8 release.
2008-10-30 19:23:17 +00:00
Chris Wilson
4f2f46ef1b Restore the ability to choose the internal font.
Behdad wants to include the feature with 1.10, so we enable it as early as
possible in 1.9 dev cycle to generate as much feedback as possible.

The first change is to use "<cairo>" as being a name unlikely to clash
with any real font names.

This reverts commits:
  a824d284be,
  2922336855,
  e0046aaf41,
  f534bd549e.
2008-10-30 19:14:45 +00:00
Chris Wilson
52c3fc58b5 [tessellator] Simplify dequeuing by using a sentinel value.
Instead of maintaining an index and comparing it to the count, just mark
the last startstop event with NULL and stop dequeuing events upon seeing
that sentinel value. (Removes an unreadable line, and cachegrind hints
that it may be a tiny bit faster.)
2008-10-30 19:08:24 +00:00
Chris Wilson
ef9e0a5d1d [tessellator] Use a combsort for sorting the event queue.
In my experiments using cairo-perf, the inlined combsort is ~20% quicker
than the library qsort.
2008-10-30 19:08:24 +00:00
Behdad Esfahbod
b146130841 [Makefile.am.releasing] Symlink /manual and /cairo-manual.tar.gz only for releases
And not for snapshots.  Also symlink /cairo-manual-X.Y.Z.tar.gz for all
versions.
2008-10-30 14:35:51 -04:00
Chris Wilson
e3a7f522a6 [tessellator] Perform cheap checks before computing intersect.
First check if we can reject the intersection without having to perform
the full divides, based on analysing:
  t * (ady*bdx - bdy*adx) = bdy * (ax - bx) - bdx * (ay - by)
  s * (ady*bdx - bdy*adx) = ady * (ax - bx) - adx * (ay - by)
and excluding the result if by inspection we know that
(s, t) <= 0 || (s, t) => 1.

Doing so virtually eliminates all division and speeds up the strokes (when
performing self-intersection elimination using the tessellator) perf cases
by about 5%.
2008-10-30 18:25:45 +00:00
Chris Wilson
553fde4bb3 [tessellator] Simplify special cases of edges to compare.
Use our prior knowledge of the inputs and trivial conditions to simplify
the edge equations and in many common conditions, such as vertical edges
and common points, reduce the operations down to a just returning the
non-degenerate 32 bit value.  This adds an overhead of a few conditionals,
but on the fast paths we actually generate fewer branches and many fewer
arithmetic operations such that it improves performance of the fill
performance tests by around 10%.
2008-10-30 18:03:59 +00:00
Chris Wilson
cc109df2a7 [test] Update .gitignore
Add a couple of new programs to gitignore.
2008-10-30 17:52:15 +00:00
Chris Wilson
7d546bba21 [xlib] Eliminate shadowed variable.
Cleanup a minor -Wshadow warning.
2008-10-30 17:52:15 +00:00
Chris Wilson
e3388b8180 [cff-subset] Eliminate shadowed variable.
Cleanup a minor -Wshadow warning.
2008-10-30 17:52:15 +00:00
Chris Wilson
3e18114aff [user-font] Eliminate shadowed variable
Cleanup a minor -Wshadow warning.
2008-10-30 17:52:15 +00:00
Chris Wilson
d073537e82 [scaled-font] Eliminate shadowed variable.
Cleanup a minor -Wshadow warning.
2008-10-30 17:52:14 +00:00
Chris Wilson
6429e3f394 [xlib] Only set Picture clip as necessary.
Only set ClipRectangles on a new Picture, avoiding redundant calls to
clear the non-existent ClipMask otherwise.
2008-10-30 17:52:14 +00:00
Chris Wilson
cd45258c5b [xlib] Only clear the GC clip mask as necessary.
Avoid redundant calls to XSetClipMask() for clean GCs.
2008-10-30 17:52:14 +00:00
Chris Wilson
d384f86499 [xlib] Propagate real status from get_screen_info().
Return the real error from _cairo_xlib_screen_info_get() in order to avoid
having to create a fake NO_MEMORY error.
2008-10-30 17:52:14 +00:00
Chris Wilson
e25b106e9c [xlib] Propagate real status from get_display()
Avoid throwing away the error and inventing a new NO_MEMORY error for
_cairo_xlib_display_get().
2008-10-30 17:52:14 +00:00
Chris Wilson
2555f83b11 [xlib] Avoid repeated calls to XRenderQueryVersion
Use the value determined during display initialisation in order to avoid
redundant XRenderQueryFormats requests.
2008-10-30 17:52:13 +00:00
Chris Wilson
0d0c6a199c [matrix] Optimise invert for simple scaling|translation matrices.
The matrix is quite often just a simple scale and translate (or even
identity!). For this class of matrix, we can skip the full adjoint
rearrangement and determinant calculation and just compute the inverse
directly.
2008-10-30 17:52:13 +00:00
Chris Wilson
74876b00cd [xlib] Exploit compaction of XRenderFillRectangle()
libXrender amalgamates sequences of XRenderFillRectangle() into a single
XRenderFillRectangles request (when permissible). Since it is common for a
cairo application to draw rectangles individually in order to exploit fast
paths within cairo [rectilinear fills], it is a reasonably common pattern.
2008-10-30 17:52:13 +00:00
Chris Wilson
64726ccfb9 [traps] Whitespace.
Fixup whitespace in line with CODING_STYLE and rest of file.
2008-10-30 17:52:13 +00:00
Chris Wilson
d5543005e7 [surface] Only copy font options if the target surface has them.
No need to copy font options if the similar surface is from the same
backend and no special options have been applied by the user. Doing so
breaks lazy initialisation of backend specific options.
2008-10-30 17:52:13 +00:00
Chris Wilson
a002375810 [xlib] Defer querying of font options until first use
Constructing the font options cause the initialisation of Xlc and invoke
several round-trips to the X server, significantly delaying the creation
of the first surface. By deferring that operation until the first use of
fonts then we avoid that overhead for very simple applications (like the
test suite) and should improve start-up latency for larger application.
2008-10-30 17:52:13 +00:00
Chris Wilson
6706590d4e [pattern] Reduce likelihood of range overflow with large downscaling.
Exploit the auxiliary offset vector in the attributes to reduce
likelihood of range overflow in the translation components when converting
the pattern matrix to fixed-point pixman_matrix_t.

An example of this is bug 9148
  Bug 9148 - invalid rendering when painting large scaled-down surfaces
  (https://bugs.freedesktop.org/show_bug.cgi?id=9148)
but the issue is perhaps even more likely with high resolution fallback
images.
2008-10-30 17:52:12 +00:00