Commit graph

2706 commits

Author SHA1 Message Date
Chris Wilson
f9a80c06b4 [cairo-path-stroke] Convert degenerate splines into lines.
This fixes a discrepancy in the stoker between splines and lines,
whereby the stroker failed to add a dash for a zero length spline.
2008-01-16 23:28:27 +00:00
Carl Worth
d2a02d4f5c Remove check-has-hidden-symbols.i on 'make distclean'
Without this, 'make distcheck' fails so releases don't happen.
2008-01-16 10:36:01 -08:00
Carl Worth
cb1ddc4e47 Replace -I($builddir) with -I. to avoid breaking non-srcdir builds.
This variable was expanding to an empty string, so the next -I flag
was getting completely swallowed. Let's avoid being clever and just
use . which is what we want in the expansion anyway.
2008-01-16 10:15:34 -08:00
Chris Wilson
1bccbd88c3 [cairo-pdf-surface] Review error propagation from output stream.
Ensure that errors encountered whilst processing the output stream are
propagated back to the surface (and the user).
2008-01-16 17:02:52 +00:00
Chris Wilson
20151fc534 [cairo-ps-surface] Review error propagation during surface creation.
Track the error during surface creation so that it can be returned to
the user via _cairo_surface_create_in_error().
2008-01-16 17:01:03 +00:00
Chris Wilson
3daa63693c [cairo-svg-surface] Review error propagation during surface creation.
Track the error during surface creation so that it can be returned to
the user via _cairo_surface_create_in_error().
2008-01-16 16:52:51 +00:00
Chris Wilson
7111b18c27 [cairo-surface] Introduce _cairo_surface_create_in_error().
Unexport all the static error surfaces and use a function to select
the appropriate error surface for the status.
2008-01-16 16:51:32 +00:00
Chris Wilson
5cbc45488e [cairo-output-stream] Introduce _cairo_output_stream_create_in_error()
Use a utility function to wrap an incoming error status into a new
error stream. As a side-effect, all error streams must be destroyed as
in the general case the caller can not distinguish between a static
error object and one allocated to hold an unusual error status.
2008-01-16 16:40:01 +00:00
Chris Wilson
2c10c7559d [Makefile.am] Add -I$(builddir) for .c.i target
Updated the CPP command so that it can find <cairo-features.h> in the
local build directory.
2008-01-16 16:37:38 +00:00
Vladimir Vukicevic
57c2b75c22 [quartz] Store the CGFontRef and reuse it for rendering
Previously the CGFontRef was recreated each time in show_glyphs; this
caused the font to get re-embedded in any PDF files that were being
generated through Quartz.
2008-01-15 14:27:14 -08:00
Chris Wilson
968eaf3c44 [cairo-xlib] Fixup --disable-xlib-xrender
Fixup the headers and boilerplate to compile and run correctly when
configured with --disable-xlib-xrender.
2008-01-15 13:08:53 +00:00
Behdad Esfahbod
22d7f311f7 [scaled-font] Upgrade glyph mask as needed in case of mixed-format glyphs
In ecb895803b Carl made fallback show_glyphs
always use a A8 mask in case of mixed-format glyphs.  That's suboptimal if
there are ARGB32 glyphs.  Using masks smartly we can implement the desired
behavior.  Done now.
2008-01-14 16:14:02 -05:00
Chris Wilson
8d6249b2c1 [cairo-scaled-font] Add missing matrix guard to cairo_scaled_font_create().
cairo_scaled_font_create() did not check the user supplied ctm was valid,
triggering an assertion later when computing the scale factors.
2008-01-13 11:40:53 +00:00
Chris Wilson
3f59ef9548 [cairo-matrix] Tidy usage of HAVE_ISFINITE.
Use a macro to switch between isfinite() and its fallback in order to
avoid using an #ifdef from within a function.
2008-01-13 11:21:39 +00:00
Chris Wilson
5e32dcf863 [cairo-gstate] Check that the matrix remains invertible.
Ensure that the ctm remains invertible after multiplying the user
supplied matrices. Although the arguments are checked so that they are
valid per se, we double check that the result after multiplication is
still a valid invertible matrix. This should catch pathological cases
where the user concatenates a long series of matrix operations, which
either exceed our numerical limits or become degenerate through rounding
errors.
2008-01-13 11:14:20 +00:00
Chris Wilson
2f600affaa [cairo-gstate] Add isfinite guards to the transformation ops.
If we have isfinite() available use it to check that the user supplied
arguments are valid.
2008-01-13 11:02:55 +00:00
Chris Wilson
3fed79d1c2 [cairo-paginated-surface] Set error on surface for operations done its behalf.
Ensure that the error is propagated to the target surface if we fail
whilst performing an operation on its behalf, for example set the size
of the paginated surface.
2008-01-13 10:28:11 +00:00
Chris Wilson
481b88dd6b [cairo-pattern] Add an ASSERT_NOT_REACHED
On the default case for an unknown pattern type, add an assert that the
code is never reached, and just in case upgrade the error to a fatal
PATTERN_TYPE_MISMATCH.
2008-01-12 20:44:02 +00:00
Chris Wilson
6cc75cfe5b [cairo] Harden the text API against NULL strings.
Handle NULL strings in cairo_show_(text|glyph),
cairo_(text|glyph)_(extents|path) without crashing.
2008-01-12 10:30:15 +00:00
Chris Wilson
ae1e044e32 [cairo-matrix] Use isfinite() to check matrix determinant.
The current NaN check is insufficient as it classifies inf as a valid
determinant. We can improve the test by using isfinite() - but only
when it is available. We use the feature test macros as being the
simplest way of determining the presence of isfinite() as it may be
implemented as a macro, making checking for its usability troublesome
during configure.
2008-01-12 00:40:59 +00:00
Kouhei Sutou
3610841910 Fix typo in comment. 2008-01-11 14:40:06 -08:00
Chris Wilson
0b91240692 [check-plt.sh] Ensure that $MAKE is defined.
Copy the check from check-def.sh now that $MAKE is also used in
check-plt.sh
2008-01-11 21:58:09 +00:00
Chris Wilson
92c744978f [Makefile.am] Tweak the flags passed to CPP.
Adjust the flags passed to $(CPP) to match those used in the
surrounding targets (splint and sparse), which should improve their
reliability.
2008-01-11 21:58:09 +00:00
Behdad Esfahbod
36f5d69a11 [src/Makefile.am] Tweak includes a bit 2008-01-11 16:48:55 -05:00
Chris Wilson
ed113ef422 [check] Move the hidden symbol check into check-{def,plt}.sh
Behdad, once again the arbiter of good taste, objected to the use of
the dotfile within the Makefile, and suggested that one calls $MAKE to
pre-process the source file from within the check scripts.

Doing so removes the ugly wart added to Makefile.am...
2008-01-11 21:21:34 +00:00
Carl Worth
bcf0c442b9 Merge branch 'master' of git.cairographics.org:/git/cairo into cairo 2008-01-11 12:30:15 -08:00
Carl Worth
ecb895803b Migrate glyph mask to A8 in case of mixed-format glyphs.
This fixes the remaining image-backend problems with bug 13479:

	Ugly Courier New font with cairo 1.4.12
	https://bugs.freedesktop.org/show_bug.cgi?id=13479

although the xlib-backend had been fixed previously.

Specifically, if an A1 glyph is first encountered, then subsequent
glyphs will still be rendered with antialiasing, (previously they
would be rendered very poorly without antialiasing).

Similarly, if the first glyph encountered has component-alpha
sub-pixel antialiasing and then an A1 or A8 glyph is encountered
then all glyphs will rendered in A8 (grayscale antialiasing).
Previously, the non-subpixel-antialiased glyphs would not appear
at all.
2008-01-11 12:28:49 -08:00
Chris Wilson
8a6a0b43dc [check] Replace compiled symbol visibility checker with shell script.
Behdad Esfahbod objected to the execution of a compiled program to check
symbol visibility as it makes cross-compilation more difficult.

Instead of executing the program, this method conditionally exports
a variable if cairo uses symbol hiding and scans the executable for
that symbol in a similar manner to check-def.sh. This has the slight
advantage of using the Makefile for performing the compilation, rather
than attempting to invoke $(CPP) from a shell script within the test
environment.
2008-01-11 20:27:23 +00:00
Chris Wilson
982f65081f [cairoint.h] Compile time check for a font backend.
Add a paranoid check that at least one font backend is available - this
should have been already caught by configure, but it should help if a new
font backend is ever added.
2008-01-11 17:25:33 +00:00
Chris Wilson
6d3ed950ea [check] Skip def/plt tests if the compiler doesn't support symbol hiding.
Compile a trivial program such that it reports whether cairo is hiding
its internal symbols and skip the tests that depend upon it.

This prevents false errors, such as bug 12726, where the user is
presented with a scary make check failure.
2008-01-11 16:16:20 +00:00
Chris Wilson
be146f02e0 [Makefile.am] Update cairo.def after the set of enabled features is modified.
Bug 13342 corresponds with a rebuild of cairo after removing
--enable-glitz from the configure line. Under these circumstances,
the remaining installable headers are not modified and therefore
cairo.def is not rebuilt and still expects to find a reference to
cairo_glitz_surface_create. The solution is to rebuild cairo.def after
any modification to the 'public' headers (installable or otherwise).
2008-01-11 15:45:22 +00:00
Adrian Johnson
2574cc35b3 win32-printing: Do not clip and paint with an empty path
For non solid patterns _fill and _show_glyphs sets a clip
path then paints the pattern. Previously if the path is empty
SelectClipPath did not set clip. This was probably the cause
of bug 13657 where the entire page was black.

Fix this by not painting anything if the path is empty.
2008-01-11 22:07:26 +10:30
Adrian Johnson
7ef4caaf11 win32-printing: use fill instead of clip for non win32 fonts
Non Windows fonts are drawn by getting the outline path, setting
this is the clip path, and painting the source pattern. For
solid colors this can avoid the clip and just do a fill.
2008-01-11 22:06:51 +10:30
Adrian Johnson
ef56a6fd93 PS: Don't use language level check in EPS
As 'showpage' and 'quit' can not be used in EPS.
2008-01-11 22:05:54 +10:30
Adrian Johnson
b703199525 Type1-subset: Font name may be NULL
If the FreeType face->family_name is NULL use a CairoFont-x-y name.
2008-01-11 22:05:13 +10:30
Chris Wilson
2e5f278da1 [cairo-pattern] Free the copied pattern on error.
Free the locally allocated pattern if the copy fails.
2008-01-10 22:11:42 +00:00
Chris Wilson
db246f2fa2 [cairo-traps] Typo caught by valgrind.
==3429== Conditional jump or move depends on uninitialised value(s)
==3429==    at 0x4E3FB0F: _cairo_box_round_to_rectangle (cairo-fixed-private.h:196)
==3429==    by 0x4E34B29: _cairo_clip_intersect_to_rectangle (cairo-clip.c:162)
==3429==    by 0x4E31943: cairo_push_group_with_content (cairo.c:495)
==3429==    by 0x403044: draw (clip-zero.c:48)
==3429==    by 0x404221: cairo_test_expecting (cairo-test.c:377)
==3429==    by 0x64701C3: (below main) (libc-start.c:222)

Caused by setting extents->p2.y to zero twice.
2008-01-10 21:32:47 +00:00
Chris Wilson
409e91b576 [cairo-pdf-surface] Review error handling.
Ensure all errors are propagated back to the caller with locally
allocated resources destroy as required.
2008-01-10 17:11:04 +00:00
Chris Wilson
6134600988 [cairo-pdf-surface] Skip emitting the font subset if not among resources.
Do not emit the font_subset if we did not successfully add it to the list
of font resources - can only happen after an error
2008-01-10 17:10:52 +00:00
Chris Wilson
02b0743458 [cairo-pattern] Rearrange CAIRO_MUTEX_INITIALIZE.
test/pattern-get-type exposes a bug whereby we try to acquire the
_cairo_pattern_solid_pattern_cache_lock before initializing the
mutexes. To fix this move the CAIRO_MUTEX_INITIALIZE() from the
depths of _cairo_pattern_init() and perform it at the public entry
points.
2008-01-10 17:10:30 +00:00
Chris Wilson
909c57ce15 [cairo-pdf-operators] Be consistent in error checks.
Consistently check the output status at the end of each function -
helps with early error detection and even improves test code coverage!
2008-01-10 14:22:38 +00:00
Chris Wilson
4ffb0a80b3 [cairo-paginated-surface] Call the abstract cairo_surface_show_page ().
Use the generic surface layer cairo_surface_show_page() instead of
directly calling cairo_paginated_surface_show_page(), as the higher
level performs more error checking.
2008-01-10 14:22:28 +00:00
Chris Wilson
f4e7e7d6b4 [cairo-path-bounds] _cairo_path_fixed_bounds() should never fail.
_cairo_path_fixed_bounds() should never fail so change return type
to void and update caller.
2008-01-10 13:14:28 +00:00
Chris Wilson
5fad969317 [cairo-ft-font] Destroy unscaled font ref on error.
Destroy the local reference taken to the unscaled font if we encounter
an error whilst creating the derived scaled font.
2008-01-10 13:11:09 +00:00
Chris Wilson
3b1411167c [headers] Brute force fixup of including cairoint.h from boilerplate.
More the majority of the typedefs from cairoint.h to
cairo-types-private.h and fixup cairo-pdf-operators-private.h to
avoid including cairoint.h.

A better approach would seem to be to rationalise cairoint.h so that it
only provides the symbol aliasing, moving the types and functions to
more appropriate private headers. However, this fixes the immediate
problem of running make check!
2008-01-10 12:57:36 +00:00
Adrian Johnson
40142d4bf4 Set the PS level to to minimum required
A problem with the previous commit for checking the PS level is that
with the default PS level of 3 it prevents PS files from printing on
Level 2 printers even if no Level 3 operators are used.

As the PS header is created after the page content has been generated,
it is easy to check the PS Level actually required and set this in the
header and PS level check code.
2008-01-10 02:57:30 +10:30
Adrian Johnson
9bccc96846 Add PS Level check to PS output
http://bugzilla.mozilla.org/show_bug.cgi?id=406376

reported problems with cairo PostScipt output printing black boxes
instead of images. This was found to caused by printing Level 3
PostScript to a Level 2 printer.

Add some PostScript code to to the cairo PS prolog to check the
language level of the printer. If the printer can not print the job, a
message stating the required language level is printed and the job is
aborted.
2008-01-10 02:34:02 +10:30
Adrian Johnson
f20a1a40c3 Fix MSVC 2008 compiler warnings - bug 13698 2008-01-09 01:20:34 +10:30
Adrian Johnson
47bebc8f1d Fix win32-font problems with Type 1 fonts
This should fix the problems reported in

http://lists.cairographics.org/archives/cairo/2007-November/012172.html

The problem is that GetCharacterPlacement() used in
_win32_scaled_font_text_to_glyphs returns utf16 instead of glyph
indices when Type 1 fonts are used.

This has been fixed by using GetGlyphIndices instead of
GetCharacterPlacement if the font is a Type 1.

_win32_scaled_font_map_glyphs_to_unicode has been fixed work with Type 1
glyph indices. It now uses GetFontUnicodeRanges and GetGlyphIndices
to do the reverse lookup.
2008-01-09 01:18:44 +10:30
Adrian Johnson
25f24e79f8 PDF: Update the PDF page structure comment 2008-01-07 21:19:35 +10:30