Commit graph

2375 commits

Author SHA1 Message Date
Chris Wilson
b4f86638cc [cairo-path] Don't raise an error when attempting to create an empty path.
Generate a real empty path structure instead of returning
_cairo_path_nil, if we have been asked to create an empty path.

(Also add a couple of missing _cairo_error()s and an appropriate test
case.)

Spotted by Fred Kiefer.
2007-10-01 17:59:57 +01:00
Adrian Johnson
042c382c09 CFF Subetting: Fix for #10849
This fixes the problem Apple Preview has with viewing PDFs with CFF
font subsets.
2007-09-29 07:55:48 +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
Chris Wilson
1469de5211 [cairo-png] Propagate error from read and write funcs.
Use the png_struct->error_ptr to propagate the error status from the
user/stdio read and write functions through the png_error() to the
cairo_surface_write_to_png*() and cairo_surface_read_from_png*()
functions. From there the error is returned back to the user either
directly or as the most appropriate error surface.

(Fixes https://bugs.freedesktop.org/show_bug.cgi?id=6909)
2007-09-25 23:45:39 +01:00
Chris Wilson
03be41151d [cairo-atomic] Rewrite reference counting using atomic ops.
Introduce an opaque cairo_reference_count_t and define operations on it
in terms of atomic ops. Update all users of reference counters to use
the new opaque type.
2007-09-25 16:29:54 +01:00
Chris Wilson
8b6c871c90 [cairo-atomic] Introduce atomic ops.
Test for the availability of the Intel __sync_* atomic primitives and
use them to define a few operations useful for reference counting -
providing a generic interface that may be targeted at more architectures
in the future. If no atomic primitives are available, use a mutex based
variant. If the contention on that mutex is too high, we can consider
using an array of mutexes using the address of the atomic variable as
the hash.
2007-09-25 16:29:54 +01:00
Chris Wilson
42de1a0a7f Move GCC attributes wrapping into a separate header.
The wrapping of GCC attributes (such as cairo_private) needs to be
visible to any header file, including those that avoid cairoint.h such
as cairo-boilerplate. To achieve this we move the pre-processor magic to
its own header file and include it as required.
2007-09-25 16:29:54 +01:00
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
Chris Wilson
4f7c5a5033 [cairo-region] Call _cairo_error() at original error site.
Before returning a fresh CAIRO_STATUS_NO_MEMORY, remember to call
cairo_error().
2007-09-23 21:35:49 +01:00
Chris Wilson
45feb13c26 [cairo-clip] Avoid a malloc(0).
Avoid a potential allocation of 0 bytes, and a potential NULL leading to an
incorrect CAIRO_STATUS_NO_MEMORY, when copying an empty clip region.
2007-09-23 21:35:25 +01:00
Adrian Johnson
77f1aa7887 Add Encapsulated PostScript support
The analysis surface will calculated the tight bounding box for each
page. A new paginated-surface backend function set_bounding_box() has
been added for passing the page bounding box to the target surface at
the end of the analysis phase.

The changes to the PS file when EPS is enabled are:
    - Add EPS header
    - Use tight bounding box instead of page size
    - Use save/restore to ensure PS interpreter is left in the same state
2007-09-23 17:43:44 +09:30
Adrian Johnson
beefbdd638 Add Encapsulated PostScript API 2007-09-23 14:23:33 +09:30
Adrian Johnson
b20e08999e Truetype Subsetting: Avoid failing when fonts are missing optional tables
Previously, the TrueType subsetting would fail if any of the "cvt",
"fpgm", or "prep" tables were missing from the source font. However
these tables are optional and not required in the subsetted font if
they do not appear in the source font.

The "name" table has been removed from the subsetted font as the
Type42 specification does not require this table.
2007-09-23 11:37:02 +09:30
Brian Ewins
8132b8b417 [type1-subset] only subset ft fonts
If atsui and ft were both enabled, the code crashed trying to subset
type-1 fonts; fixed by checking if fonts really are ft before using
them as ft fonts. This is a temporary fix until we support subsetting
across all font backends.
2007-09-23 02:52:01 +01:00
Vladimir Vukicevic
6020f67f1a Avoid divide-by-zero when trying to allocate a 0-sized array
Fix up the _cairo_malloc_* wrappers to avoid blindly dividing by zero;
any attempt to allocate a zero-sized chunk of memory will result in
NULL.
2007-09-21 11:02:42 -07:00
Adrian Johnson
12b2ab630c PDF: Add support for CAIRO_FORMAT_A8 images 2007-09-20 22:51:39 +09:30
Vladimir Vukicevic
d8b0de01d6 fix trailing whitespace 2007-09-18 09:28:30 -07:00
Vladimir Vukicevic
4fd9acc1b3 [win32] add new win32 printing surface 2007-09-18 09:28:30 -07:00
Vladimir Vukicevic
e3c16e15e3 Make NO_MUTEX really mean no mutexes 2007-09-18 09:28:30 -07:00
Vladimir Vukicevic
ffc16c4be2 [win32] Add win32 printing surface
Add win32 surface intended for use with printer DCs; GDI will be used
as much as possible, and the surface will be a paginated surface
that supports fine-grained fallback.

(Original work from Adrian Johnson; additional fixes by me.)
2007-09-18 09:28:29 -07:00
Vladimir Vukicevic
284ed91ee4 Let surfaces specify their native resolution, for fallback purposes 2007-09-18 09:28:29 -07:00
Behdad Esfahbod
79d975f84b [cairo-ft-font] Ignore FT_Load_Glyph errors other than out-of-memory
Same for FT_Render_Glyph.

When the user asks us to render a glyph that is not available in the font,
it's mostly an unavoidable kind of error for them, as in, they can't
avoid such a call.  So it's not nice to put cairo_t in an error state and
refuse any further drawying.

Many PDF files are created using buggy software and cause such glpyh-not-found
errors for CID 0 for example.

Eventually we should propagate these kind of errors up and return it from
the function call causing it, but that needs API change to add return value
to all text functions, so for now we just ignore these errors.
2007-09-17 20:55:42 -04:00
Adrian Johnson
3f4875dbe2 Analysis-surface: Use pattern extents to limit show_glyphs extents 2007-09-16 20:26:33 +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
46cb7e6952 PS: Remove initclip operator
The DSC and EPS specifications do not allow the use of initclip.
Instead each page is wrapped in a gsave/restore pair and a
"grestore gsave" is emitted when the clip path is reset.
2007-09-16 16:32:54 +09:30
Adrian Johnson
e9d85235f9 PDF: Fix copy_page() bug 2007-09-16 16:21:10 +09:30
Adrian Johnson
a5cb48fcf2 PS: Remove copy_page()
The DSC specification recommends not using the copypage operator as it
breaks page independence.
2007-09-16 16:15:10 +09:30
Ken Herron
03f7a51f47 PS output optimizations (#11442)
This patches cairo-ps-surface.c to use the aliases for moveto, lineto, curveto,
and closepath. It also uses selectfont to select fonts.
2007-09-16 15:56:16 +09:30
Behdad Esfahbod
1274147ce3 [cairo-gstate] Fix comment about font_matrix having zero translation 2007-09-15 04:03:08 -04:00
Behdad Esfahbod
6fbe2432c6 [PDF] Fix typo in comments 2007-09-15 04:02:39 -04:00
Jeff Muizelaar
dca93eb76d Fix theoretical NULL return from cairo_pop_group()
This also makes the code more consistent as group_pattern always holds a valid
pattern.
2007-09-12 23:12:59 -04:00
Jonathan Gramain
5eae45c55b [cairo-gstate] Fix order of matrices in _cairo_gstate_backend_to_user_rectangle()
The cairo_matrix_multiply(out,a,b) docs say that it is equivalent to applying
matrix a first, followed by b.  Looking at _cairo_gstate_backend_to_user() we should
apply device_transform_inverse followed by ctm_inverse.  That's what we do now.
2007-09-12 17:45:21 -04:00
Vladimir Vukicevic
9e975757a2 Export cairo_surface_{copy,show}_page
This patch adds cairo_surface_copy_page and cairo_surface_show_page
as public methods, leaving the previous cairo_show_page variants as
shorthands.  copy_page/show_page are specific to the surface, not
to the context, so they need to be surface methods.
2007-09-11 13:30:35 -07:00
Vladimir Vukicevic
7dd05b7f86 [mlk] Free boxes in copy_rectangle_list on success
Fix memory leak when copy_rectangle_list is used.
2007-09-11 11:27:47 -07: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
Adrian Johnson
909e0be241 Add PDF support for cairo_mask() 2007-09-09 11:20:02 +09:30
Chris Wilson
d62f886168 [cairo-ft-font] Early detection of a zero sized bitmap.
Under rare circumstances we may need to extract a surface that
represents a bitmap with width==0 and rows==0. Detect this case at the
start and simply return a zero-sized surface.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12284.
2007-09-07 12:40:28 +01:00
Vladimir Vukicevic
d635e01033 Add b8g8r8 formats to cairo-image-surface
Add recognition code for x8b8g8r8 and a8b8g8r8 to cairo-image-surface.
(Used as the default for 24bpp by some older VNC servers.)
2007-09-06 12:56:59 -07:00
Adrian Johnson
1e21220f0e Create meta-surface source image with same content type as the
meta-surface
2007-09-05 22:53:43 +09:30
Adrian Johnson
875e32178e Eliminate unclipped CLEAR from meta-surface playback
The optimization that avoids replaying commands prior to an unclipped
CLEAR operation now starts playback from the first command after the
CLEAR. This avoids the need to handle the unclipped CLEAR in the PDF
surface.
2007-09-05 22:51:13 +09:30
Adrian Johnson
d24f019101 Add support for PDF meta-surface patterns 2007-09-05 22:26:16 +09:30
Behdad Esfahbod
e1819a24fb [cairo-xlib-xrender-private] Remove some protocol-specific macros 2007-09-04 19:12:14 -04:00
Behdad Esfahbod
5e09126ce1 [cairo-xlib-xrender-private] Add copyright/license info for copied files 2007-09-04 18:40:54 -04:00
Behdad Esfahbod
740fed62d2 [xlib] Make it compile without Xrender available at compile time (#12210) 2007-08-31 20:52:43 -04:00
Jody Goldberg
c8ed3e1827 [PDF] The symbol 'GROUP' is already used on some win32 systems; add a prefix 2007-08-31 17:00:36 -04:00
Chris Wilson
c14cf02f61 [cairo-surface] Add a comment about why the glyph array is not const.
As penance for attempting to make the glyph array constant, add a
comment block to explain that the backends rely on being able to modify
the array.
2007-08-31 17:21:02 +01:00
Chris Wilson
e8e3bfc130 Revert "[cairo-gstate] Avoid copying untransformed glyphs."
This reverts commit 919bea6dbb.

Sadly as Behdad points out some backends do modify the glyph array and,
for example cairo-xlib-surface, hide this from the compiler with some
evil casts.
2007-08-31 16:53:21 +01:00
Chris Wilson
919bea6dbb [cairo-gstate] Avoid copying untransformed glyphs.
Skip the memory duplication of the incoming glyphs if we do not need
to transform them into the backend coordinate system.

As a consequence we need to constify the glyphs passed to the backend
functions.
2007-08-31 16:28:06 +01:00