Commit graph

287 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Chris Wilson
62d64e12aa [cairo-pdf-surface] Create a new path for an empty clip.
If the clip path is empty, then we need to start a new path otherwise
the clip is ineffective.
2007-11-06 15:22:07 +00:00
Adrian Johnson
8888afe9a4 PDF: Fix meta surface patterns with EXTEND_REFLECT 2007-10-22 23:05:25 +09:30
Adrian Johnson
4660561cb5 PDF: Add support for CAIRO_FORMAT_A1 images 2007-10-14 19:05:06 +09:30
Adrian Johnson
39044157da PDF: Add support for linear gradients with REPEAT and REFLECT 2007-10-14 19:04:33 +09:30
Chris Wilson
0222c02d95 [cairo-pdf-surface] Return UNSUPPORTED from _to_unicode_stream().
Distinguish the UNSUPPORTED case where the font backend does not
support conversion to unicode from other fatal errors by returning a
status value rather than using stream.id == 0 to indicate any error.
2007-10-11 15:00:59 +01:00
Chris Wilson
05702b8b6e [cairo-pdf-surface] Free the clip path on error.
If we fail to add the clip path to the current group, destroy it.
2007-10-11 15:00:22 +01:00
Chris Wilson
8fa5f638a5 [cairo-pdf-surface] Restore old_group for failed emit_meta_surface().
Ensure we restore the surface->current_group if we encounter an error
during _cairo_pdf_surface_emit_meta_surface() lest we leak the
current_group array.
2007-10-11 15:00:13 +01:00
Chris Wilson
66563eddd8 [cairo-pdf-surface] Check status return after emit_meta_pattern().
Add the missing status propagation.
2007-10-10 14:20:19 +01:00
Chris Wilson
b210bea6c1 [cairo-pdf-surface] Check for pdf_resource_t allocation failure.
Check that the resources are actually allocated or propagate the error.
2007-10-05 18:34:11 +01:00
Chris Wilson
5ac7ba9821 [cairo-pdf-surface] Destroy local resources on failed surface creation.
During _cairo_pdf_surface_create_for_stream_internal() destroy all
locally allocated resources and the output stream if we fail to create
the pdf surface or its paginated wrapper.
2007-10-05 18:34:01 +01:00
Chris Wilson
63ddfa077c [cairo-pdf-surface] Propagate error status.
Add a few missing propagations of error status.
2007-10-05 18:33:48 +01:00
Chris Wilson
6598973661 [cairo-scaled-font-subset] Propagate errors during collection.
Propagate the errors encountered whilst iterating over the scaled font
subsets ie _cairo_scaled_font_subsets_foreach_scaled() and co.
2007-10-05 15:26:30 +01:00
Chris Wilson
853b29c56f [cairo-pdf-surface] Add some missing error propagation.
Add a couple of returns where the status was being assigned but not
checked.
2007-10-04 23:39:21 +01:00
Chris Wilson
323511088d [cairo-pdf-surface] Propagate errors from close_stream.
Propagate the status return from _cairo_pdf_surface_close_stream().
2007-10-04 23:23:44 +01:00
Chris Wilson
0e3f5caf9f [cairo-pdf-surface] Propagate errors during pattern selection.
Propagate error from _cairo_pdf_surface_select_pattern ().
2007-10-04 23:18:33 +01:00
Chris Wilson
7940e39c18 [cairo-pdf-surface] Propagate errors from opening/closing groups.
Propagate the any error encountered during _cairo_pdf_surface_open_group
and friends.
2007-10-04 23:15:21 +01:00
Chris Wilson
717dcd1a2c [cairo-pdf-surface] Propagate resource allocation failure.
Propagate failure of _cairo_pdf_surface_new_object().
2007-10-04 21:17:31 +01:00
Chris Wilson
bed8239f03 [cairo-error] Clean up all the warnings and missing _cairo_error() calls.
Every time we assign or return a hard-coded error status wrap that value
with a call to _cairo_error(). So the idiom becomes:
    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
or
    return _cairo_error (CAIRO_STATUS_INVALID_DASH);

This ensures that a breakpoint placed on _cairo_error() will trigger
immediately cairo detects the error.
2007-10-04 13:31:44 +01:00
Chris Wilson
8ad56b308a [malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-10-04 00:42:30 +01:00
Adrian Johnson
a462717766 PDF: Fix bug in font resources 2007-10-03 19:55:05 +09:30
Adrian Johnson
54d5dccffa PDF: Compress pattern and group streams 2007-09-26 22:21:26 +09:30
Adrian Johnson
a0a51977f4 PDF: Fix bug in font resources when same font is in multiple groups 2007-09-26 22:21:07 +09:30
Adrian Johnson
be327a7b49 PDF: Compress the content stream
The content stream compression that was previously implemented was
inadvertently bypassed when the new stream handling for meta surface
patterns was implemented.
2007-09-25 23:04:03 +09:30
Adrian Johnson
99fd9449c2 PDF: Remove duplication from the resource dictionary
The same font identifer was being added the resources every time it
was referenced.
2007-09-25 21:57:46 +09:30
Adrian Johnson
12b2ab630c PDF: Add support for CAIRO_FORMAT_A8 images 2007-09-20 22:51:39 +09:30
Adrian Johnson
14786385b4 Change paginated surface size when PS/PDF _set_size() called
The finer-grained fallbacks would not work correctly if the page
was set to a larger size.

Add _cairo_paginated_surface_set_size() function that is called
from cairo_ps_surface_set_size() and cairo_pdf_surface_set_size().
2007-09-16 19:43:28 +09:30
Adrian Johnson
e9d85235f9 PDF: Fix copy_page() bug 2007-09-16 16:21:10 +09:30
Behdad Esfahbod
6fbe2432c6 [PDF] Fix typo in comments 2007-09-15 04:02:39 -04:00
Adrian Johnson
897350c6c5 PDF: Remove BC entry from Smask dictionary
The BC (background color) in the smask of the recently added
cairo_mask() support was causing Ghostscript to crash due to the wrong
number of BC values. The BC entry has been removed as BC default color
is already what we want.
2007-09-09 19:11:12 +09:30