Commit graph

4426 commits

Author SHA1 Message Date
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
Adrian Johnson
21f842f0df PDF: Remove copy_page
Now that the content stream is no longer split into multiple streams
it is not possible to implement a copy_page function that shares the
common content between pages.

Remove this function so the paginated surface will rewrite the
content from the meta surface.
2008-01-07 21:17:26 +10:30
Adrian Johnson
e2adb921f8 PDF: Put each fallback image in a separate group
Each fallback image needs to be in a separate group in the knockout
group. Otherwise transparent edges of adjacent fallback images will
composite with each other creating visible seams between the images.
2008-01-07 21:15:18 +10:30
Adrian Johnson
d6a84302a0 Fix analysis of transformed meta surfaces 2008-01-07 21:11:46 +10:30
Adrian Johnson
3c725d50db PDF: Make _SOURCE operator work inside meta surface patterns 2008-01-07 21:09:04 +10:30
Adrian Johnson
6d6b74ac4c PDF: Support _OPERATOR_SOURCE when nothing under the operation
CAIRO_OPERATOR_SOURCE operations on the PDF backend are now natively
supported when there is nothing already underneath the operation.
2008-01-07 21:08:09 +10:30
Adrian Johnson
e195cb551c Add FALLBACK mode to paginated surface
The PDF surface needs to know when the fallback images start so it can
close off the content stream and create a knockout transparency group
for the fallback images. Currently it does this by looking for
operations with CAIRO_OPERATOR_SOURCE. PDF returns unsupported for
_SOURCE during the analysis phase so _SOURCE will never appear during
native operations. However this prevents the PDF surface from
supporting _SOURCE operations that can be natively supported. For
example a _SOURCE operation with nothing painting under it can be
converted to _OVER and natively supported.

A third mode, CAIRO_PAGINATED_MODE_FALLBACK, has been added. The
paginated surface will set this mode before it paints finer-grained
fallback images.
2008-01-07 21:05:36 +10:30
Adrian Johnson
d2a5d1ace6 PDF: Remove the remaining code for splitting the content
across multiple streams. This fixes the problem reported here

http://lists.cairographics.org/archives/cairo/2007-December/012197.html
2008-01-07 21:04:06 +10:30
Adrian Johnson
099810b6c3 PDF: Perform all clipping in the content stream
Previously this was done in a separate group. Now that the PDF backend
has been re-organized to not interrupt the content stream the clipping
can be done in the same stream.
2008-01-07 20:59:22 +10:30
Adrian Johnson
83630b1c70 PDF: Emit all patterns after content stream
To fix this performance issue

http://lists.cairographics.org/archives/cairo/2007-December/012197.html

the PDF surface needs to avoid starting and stopping the content
stream every time it emits a pattern. This patch makes the PDF surface
store a list of all patterns used while the content stream is written
out then write out all the patterns after the content stream is
closed.
2008-01-07 20:55:56 +10:30
Adrian Johnson
b4e0864b96 Use _cairo_pattern_create_copy() in cairo-surface.c
Use _cairo_pattern_create_copy()/cairo_pattern_destroy() instead of
_cairo_pattern_init_copy()/_cairo_pattern_fini() so the PDF backend
can reference the patterns and destroy them later.
2008-01-07 20:42:15 +10:30
Adrian Johnson
6ead8feaf3 Add _cairo_pattern_create_copy() 2008-01-07 20:41:43 +10:30
Adrian Johnson
26c6159b1e Move the PDF drawing operators into cairo-pdf-operators.c
By defining PostScript functions the same as the PDF drawing
operators, this code can be shared by both the PDF and PS backends.
2008-01-07 20:36:32 +10:30
Adrian Johnson
a0e0aae32d PDF: Remove the Type 3 outline glyph code
This code is never used because outline glyphs that go through the
fallback path are always embedded with Type 1 fallback. The only fonts
that are embedded as Type 3 are bitmap fonts.
2008-01-07 20:34:55 +10:30
Adrian Johnson
5b3f6405d8 PDF: Fix gradient-zero-stops test failure 2008-01-06 16:15:32 +10:30
Adrian Johnson
fb7407c9c4 PS: Fix gradient-zero-stops test failure 2008-01-06 15:58:46 +10:30
Chris Wilson
f440d894e6 Check errno for appropriate error return.
After using fopen() and friends check the global errno to determine the
most  appropriate error return - especially important when running
memfault, where correct reporting of NO_MEMORY errors is required.
2008-01-05 21:25:30 +00:00
Chris Wilson
68a441e582 [cairo-analysis-surface] Return early if the traps is empty.
If the mask is empty, there is nothing to do, so return an early SUCCESS.
2008-01-05 21:23:58 +00:00
Chris Wilson
481fd3b4c8 [cairo-traps] Return zero extents if it contains no traps.
Previously, _cairo_traps_extents () returned the extents
p1={INT_MAX, INT_MAX} p2={INT_MIN, INT_MIN} for an empty traps leading
to integer overflow when computing the width using p2-p1 and causing
further overflows within libpixman. [For example this caused the
allocation of massive regions with test/mask and the PS backend.]
2008-01-05 21:23:46 +00:00
Chris Wilson
be126b6842 [cairo-analysis-surface] Check for an empty transformed bbox.
After transforming the bbox, check that it has not been projected into
an empty box.
2008-01-05 21:23:35 +00:00
Chris Wilson
d9461733af [cairo-ps-surface] Use ctime_r when available.
Use the thread-safe (and non-allocating) ctime_r() instead of ctime()
if supported by the platform.
2008-01-05 21:23:13 +00:00
Vladimir Vukicevic
552cf1dbd3 Fix cairo_surface_fallback_snapshot's use of release_source_image
&image_extra was being passed instead of image_extra to release; the
bug only manifested itself when the particular backend did something
with image_extra.
2008-01-04 16:19:14 -08:00
Keith Packard
81e029edda Add new miter-precision test. Checks miter joins at many scales.
This demonstrates an error in cairo where miter joins are replaced with
bevels at high scale factors due to a test added to eliminate wild miters
drawn when the line faces are nearly parallel.
2008-01-03 18:24:24 -08:00
Chris Wilson
b796a2f69d [cairo] Update CAIRO_STATUS_LAST_STATUS
A couple of new errors have been added without updating the LAST_STATUS
value...
2008-01-03 23:00:27 +00:00
Chris Wilson
c67d99787c [test/surface-pattern-big-scaled-down] Kill the surface leaks.
Destroy the surface and pattern after use.
2008-01-03 18:01:43 +00:00
Chris Wilson
6a7a07adf9 [test] Update distribution list of ref images.
Add missing *-ps-rgb24-ref.png images, and a couple of tests to .gitignore.
2008-01-03 17:35:06 +00:00
Chris Wilson
399f7c24e3 [cairo-pdf-surface] Continue to close streams even after error.
Do not return after encountering the first error whilst closing streams,
but continue to close any auxiliary streams before finally reporting the
error. Also during finalize check that we have closed any streams that
may have been left open after encountering an error.
2008-01-03 17:34:58 +00:00
Chris Wilson
42e77c1077 [cairo-pdf-surface] Destroy closed streams.
Destroy the streams when closing groups in order to free the associated
resources.
2008-01-03 17:34:47 +00:00
Chris Wilson
42bfe370f8 [cairo-pdf-surface] Propagate error from emit_glyph().
Propagate the error and return early rather than setting the error on
the surface and continuing.
2008-01-03 17:34:38 +00:00
Chris Wilson
2a8e80f59e [cairo-gstate] Rearrange invalid-matrix guards.
Test for an invalid matrix before use. Whilst this has no effect on the
result, an INVALID_MATRIX error will be raised on the context, placing
the guards first makes the code obviously safe and avoids manipulation
of invalid matrices.
2008-01-03 11:03:17 +00:00
Chris Wilson
e89cc8fa15 [cairo-scaled-fonts-subsets] Memleak and error reporting.
Fix leaks of strings and hash table from
_cairo_scaled_font_subset_create_glyph_names().

Whilst we are in the vicinity, review the error handling.
2008-01-03 11:03:17 +00:00
Chris Wilson
51f37995c9 Remove cairo_private from *.c files.
The cairo_private markup is only required in the headers, so cleanup the
couple of remaining occurrences in the source files.
2008-01-03 11:03:17 +00:00
Chris Wilson
48fd65cdb5 [cairo-svg-surface] Propagate the original error status.
Return the error status from the paginated surface instead of
hard-coding a bare CAIRO_STATUS_NO_MEMORY.
2008-01-03 11:03:17 +00:00
Chris Wilson
ba392488cb [cairo-ps-surface] Wrap error site with _cairo_error().
Wrap the original allocation error site with _cairo_error().
2008-01-03 11:03:17 +00:00
Chris Wilson
4442acc966 [cairo-atsui-font] Minor _cairo_error() tidy.
Inline the use of _cairo_error() for slightly improved readability.
2008-01-03 11:03:17 +00:00
Chris Wilson
2a0267639a [cairo-ps-surface] Wrap error site with _cairo_error().
Markup the original error site for CAIRO_STATUS_TEMP_FILE_ERROR with
_cairo_error().
2008-01-03 11:03:17 +00:00
Chris Wilson
cc5bd47255 [cairo-svg-surface] Wrap a couple of error sites with _cairo_error().
Wrap a couple of bare CAIRO_STATUS_NO_MEMORY with a call to
_cairo_error().
2008-01-03 11:03:17 +00:00
Chris Wilson
daf77ed3cb [cairo-type1-subset] Remove the unused return value.
Nobody actually used the index returned by
cairo_type1_font_subset_use_glyph(), so remove it.
2008-01-03 11:03:17 +00:00
Chris Wilson
fd8bf67853 [cairo-truetype-subset] Propagate error from failing to allocate padding.
Before filling the padding, check that we have successfully allocated
the buffer - otherwise propagate the failure.
2008-01-03 11:03:17 +00:00
Claudio Ciccani
ad0a2524ff [cairo-directfb] Optimize blend functions in fill_rectangles(), too. 2008-01-02 15:09:58 +01:00
Adrian Johnson
060f384310 Fix PS/PDF meta surface patterns
This was failing with more than one level of push/pop group.  The
problem was that the meta surface replay in PS/PDF emit_meta_surface
was replaying all the meta surface commands insteads of only the
natively supported commands. The analysis surface has also been
changed to replay meta surface patterns back to the one analysis
surface instead of creating a separate analysis surface for each
pattern. The analysis surface now transforms bounding boxes with the
meta surface pattern matrix so that fallback regions are correctly
tracked.
2007-12-29 00:26:11 +10:30
Adrian Johnson
4fa46e3caa Implement a win32 tmpfile() function
Bug report and proposed patch at:
http://lists.cairographics.org/archives/cairo/2007-December/012529.html

On Windows the tmpfile() function creates the file in the root
directory. This will fail if the user does not have write access to the
root directory.

Implement _cairo_win32_tmpfile() that is #defined as tmpfile() on
Windows. This function uses GetTempPath() and GetTempFileName() to
create the temporary file. CreateFile() is used to open the file so
the DELETE_ON_CLOSE flag can be set.
2007-12-29 00:25:34 +10:30
Adrian Johnson
dcacad9323 PS: Use _TEMP_FILE_ERROR for temp file errors 2007-12-29 00:13:24 +10:30