Commit graph

259 commits

Author SHA1 Message Date
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
Adrian Johnson
909e0be241 Add PDF support for cairo_mask() 2007-09-09 11:20:02 +09:30
Adrian Johnson
d24f019101 Add support for PDF meta-surface patterns 2007-09-05 22:26:16 +09:30
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
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
Adrian Johnson
3216275fd9 Fix PDF gradients bug
The PDF surface was adding extra stops at the 0.0 and 1.0 offset when
there was not already stops at these offsets. This has been replaced
with code to move the coordinates of the linear gradient line in to
the position of the first and last offset.
2007-08-29 14:58:36 -07:00
Adrian Johnson
766346aa5c PDF: Remove unused code 2007-08-28 20:35:49 +09:30
Adrian Johnson
ad43b7fe6b PDF: Clean up comments 2007-08-28 20:35:23 +09:30
Adrian Johnson
a60beb2eef Fix PDF regression with multipage documents 2007-08-28 20:34:55 +09:30
Adrian Johnson
1cdd11873b Add finer-grained fallback support to the PDF surface
The stream handling has been changed to support writing the content to
one or more group objects. Each page has a top level knockout
group. The first operation in the knockout group paints another group
containing the content. Fallback images are painted from the knockout
group. This ensures that fallback images do not composite with any
content under the image.
2007-08-27 14:21:36 -07:00
Chris Wilson
06134df0d0 [cairo-pdf-surface] Check for errors during compression.
Check status return from zlib's compress().
2007-08-16 15:29:47 +01:00
Chris Wilson
e24969a94a [cairo-pdf-surface] cairo_pattern_set_matrix guarantees invertibility.
Be consistent in asserting that the pattern matrix is inverted
successfully and remove a couple of redundant checks.
2007-08-16 15:15:54 +01:00
Adrian Johnson
8881265cca PDF: Fix regression in pdf_surface_set_size() 2007-08-10 20:10:29 +09:30
Adrian Johnson
72c1f5d802 PDF: Fix gradients regression 2007-08-05 00:50:23 +09:30
Vladimir Vukicevic
aaf94ef6c4 [fixpt] remove dependency on some pixman types
Introduce cairo_gradient_stop_t, and remove pixman dependency
for core pattern types.  Perform conversion from cairo types
to pixman types as necessary in fallback code.
2007-07-18 22:45:21 +02:00
Vladimir Vukicevic
be3516335c [fixpt] Replace cairo_rectangle_int16_t with cairo_rectangle_int_t
Mostly s/cairo_rectangle_int16_t/cairo_rectangle_int_t/,
as well as definitions to pick cairo_rectangle_int_t.
2007-07-18 22:45:21 +02:00
Søren Sandmann Pedersen
ef967be630 Merge branch 'master' of git+ssh://sandmann@git.freedesktop.org/git/cairo
Conflicts:

	pixman/src/fbcompose.c
	pixman/src/icimage.c
	pixman/src/pixmanint.h
	pixman/src/pixregionint.h
	src/cairo-clip.c
2007-07-02 08:33:29 -07:00
Vladimir Vukicevic
5c7d2d14d7 [fix] Avoid int overflow when allocating large buffers
This patch introduces three macros: _cairo_malloc_ab,
_cairo_malloc_abc, _cairo_malloc_ab_plus_c and replaces various calls
to malloc(a*b), malloc(a*b*c), and malloc(a*b+c) with them.  The macros
return NULL if int overflow would occur during the allocation.  See
CODING_STYLE for more information.
2007-06-29 09:46:08 -07:00
Søren Sandmann
12cc32b674 [pixman] Initial port to standalone pixman library. 2007-06-21 22:21:11 -07:00
Chris Wilson
e37bee3f52 [cairo-pdf-surface] emit_pattern_stops() array overrun.
_cairo_pdf_surface_emit_pattern_stops() tried to set the last element
to have an offset of exactly 1.0, but missed and set the next element
after the end of the array.
2007-05-16 16:06:26 +01:00
Chris Wilson
27de1869f5 [cairo-pdf-surface] Free allstops on error.
Ensure the locally allocated resources are freed on the error paths.
2007-05-16 16:06:26 +01:00
Chris Wilson
a8c8e17d84 [cairo-pattern] Cache surface for solid patterns
Original work by Jorn Baayen <jorn@openedhand.com>,
2715f20981

We use a small cache of size 16 for surfaces created for solid patterns.
This mainly helps with the X backends where we don't have to create a
pattern for every operation, so we save a lot on X traffic.  Xft uses a
similar cache, so cairo's text rendering traffic with the xlib backend
now completely matches that of Xft.

The cache uses an static index variable, which itself acts like a cache of
size 1, remembering the most recently used solid pattern.  So repeated
lookups for the same pattern hit immediately.  If that fails, the cache is
searched linearly, and if that fails too, a new surface is created and a
random member of the cache is evicted.

A cached surface can only be reused if it is similar to the destination.
In order to check for similar surfaces a new test is introduced for the
backends to determine that the cached surface is as would be returned by
a _create_similar() call for the destination and content.

As surfaces are in general complex encapsulation of graphics state we
only return unshared cached surfaces and reset them (to clear any error
conditions and graphics state). In practice this makes little difference
to the efficacy of the cache during various benchmarks. However, in order
to transparently share solid surfaces it would be possible to implement a
COW scheme.

Cache hit rates:    (hit same index + hit in cache) / lookups
cairo-perf:         (42346 + 28480) / 159600 = 44.38%
gtk-theme-torturer: (3023  + 3502)  / 6528   = 99.95%
gtk-perf:           (8270  + 3190)  / 21504  = 53.29%

This translates into a reduction of about 25% of the XRENDER traffic during
cairo-perf.
2007-05-04 14:29:38 +01:00
Adrian Johnson
179e339910 PDF: Change CTM to identity
Some PDF viewers forget the CTM when drawing gradient patterns
with SMasks. This patch works around these bugs by using the default
identity matrix for the CTM. All paths are transformed from
cairo to pdf coordinates before writing to the pdf file.
2007-04-27 16:13:01 -07:00
Adrian Johnson
1816d7c590 Add support for transparent gradients
This is based on the gradient patch written by Miklós Erdélyi at
http://lists.freedesktop.org/archives/cairo/2006-August/007648.html

Currently only EXTEND_NONE and EXTEND_PAD are supported. Other extend
types will go through the image fallback path.
2007-04-27 16:12:55 -07:00
Behdad Esfahbod
29247e5010 [ps/pdf/svg] Fix minor coding style issue 2007-04-21 02:51:04 -04:00
Behdad Esfahbod
20ce190e71 [pdf] Get rid of _cairo_pdf_test_force_fallbacks
in favor of cairo_boilerplate_pdf_surface_force_fallbacks.
2007-04-21 02:50:53 -04:00
Behdad Esfahbod
03477064fa [paginated] Move cairo_paginated_surface_t to cairo-paginated-surface-private.h
The old cairo-paginated-surface-private.h is cairo-paginated-private.h now.
2007-04-21 02:43:28 -04:00
Behdad Esfahbod
68e2158aae [pdf] Move cairo_pdf_surface_t to cairo-pdf-surface-private.h 2007-04-21 02:10:34 -04:00