Commit graph

446 commits

Author SHA1 Message Date
Adrian Johnson
d3655e04b2 PDF: Remove radial gradient fallback
when one circle not inside the other. Pixman now follows the PDF
specification.
2010-10-15 15:26:39 +10:30
Adrian Johnson
7a17ef3176 PDF: Fix regression in EXTEND_NONE gradients
The test for opaque gradients in _cairo_pdf_surface_add_pdf_pattern()
must be identical to the test in
_cairo_pdf_surface_emit_pattern_stops() other wise the PDF file will
reference a smask that does not exist.

The _cairo_pattern_is_opaque() test is too strict for PDF as PDF can
draw EXTEND_NONE gradients with opaque color stops without requiring a
smask.
2010-10-15 15:26:39 +10:30
Adrian Johnson
b950212a2a CFF subset: add support for latin subsets 2010-10-06 22:34:57 +10:30
Adrian Johnson
7d2979e446 Don't embed cmap in TrueType fonts embedded in PostScript
it doesn't print on a LaserJet 4050
2010-10-02 20:07:34 +09:30
Adrian Johnson
af3b550bc1 PDF: Add support for latin subsets
Add support for Type 1 and TrueType latin subsets.

CFF latin subsets are not yet implemented.
2010-10-01 19:15:31 +09:30
Benjamin Otte
e79acf47a5 subsurface: Make CAIRO_SURFACE_TYPE_SUBSURFACE public 2010-08-26 12:55:39 +02:00
Chris Wilson
9b9952ab4f Convert mime data length to use unsigned long
What we want to use is size_t, but we don't want the implied POSIX
dependency. However, POSIX does say that size_t is an unsigned integer
that is no longer than a long, so it would appear safe to use an
unsigned long as a replacement. Safer at least than unsigned int.
2010-07-10 11:16:19 +01:00
Benjamin Otte
b870cc030d doc: Move tmpl/ docs to inline docs
I did this manually so I could review the docs at the same time.
If anyone finds typos or other mistakes I did, please complain to me (or
better: fix them).
2010-07-08 14:27:16 +02:00
Benjamin Otte
106357f6e2 pdf: Set error when extracting from finished surface
Caught by api-special-cases test
2010-07-05 23:07:24 +02:00
Andrea Canciani
eb7fc35115 pdf: support single stop gradients 2010-06-10 16:07:42 +02:00
Adrian Johnson
562c323ae8 cff: Use correct glyph advance when subsetting cff fonts
Previously the glyph advance in font units was used for the widths in
the PDF font dictionary. This only works for cff fonts that use a
[0.001 0 0 0.001 0 0] font matrix.
2010-05-16 20:52:31 +09:30
Adrian Johnson
edcefa87ed type1: Use correct glyph advance when subsetting type 1 fonts
Previously the glyph advance in font units was used for the widths in
the PDF font dictionary. This only works for Type 1 fonts that use a
[0.001 0 0 0.001 0 0] font matrix.

https://bugs.freedesktop.org/show_bug.cgi?id=28061
2010-05-16 20:52:31 +09:30
Chris Wilson
18b48a6ebc Make cairo_color_stop_t a unique type.
Hopefully reduce the occurrence of the confusion between the
premultiplied shorts in cairo_color_t and the non-premultiplied shorts
in cairo_color_stop_t.

The existence of the two separate types is debatable and open for
review.
2010-05-13 10:00:18 +01:00
Chris Wilson
4a181ebac4 pdf: Cleanup local reference to source on error paths. 2010-05-04 13:28:37 +01:00
Chris Wilson
5fe7c5842f pdf; Emit subsurface patterns natively.
Encode subsurface patterns into the PDF stream natively (when possible),
similar to the cairo-ps backend.
2010-04-30 10:16:24 +01:00
Chris Wilson
8ded35fd69 ps: Enable native encoding of subsurface patterns.
Carefully handle subsurfaces of a recording surface through the analysis
and paginated surfaces so that we can generate a native pattern for the
vector backends, demonstrated by the PostScript backend.

Nothing remarkable, just a lot of bookkeeping to track the wrapped
surface types and to apply the correct offsets when generating the
subsurface pattern.
2010-04-30 10:16:24 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Chris Wilson
5274b63adb ps: Don't write error status to the inert object.
Reported-by: Benjamin Otte <otte@redhat.com>
2010-04-14 19:42:20 +01:00
Chris Wilson
45d23b8a79 pdf: Don't write error status to the inert object.
Reported-by: Benjamin Otte <otte@redhat.com>
2010-04-14 19:42:16 +01:00
Chris Wilson
58540405d9 pdf: Arguments to fill_extents() were reversed. 2010-01-22 23:01:53 +00:00
Chris Wilson
3a5d71c431 pattern: An EXTEND_NONE surface is not opaque if we sample outside
Fixes test/clear-source as proposed by Benjamin Otte.
2010-01-22 23:01:51 +00:00
Chris Wilson
f617d5fc98 Add cairo_device_t
The device is a generic method for accessing the underlying interface
with the native graphics subsystem, typically the X connection or
perhaps the GL context. By exposing a cairo_device_t on a surface and
its various methods we enable finer control over interoperability with
external interactions of the device by applications. The use case in
mind is, for example, a multi-threaded gstreamer which needs to serialise
its own direct access to the device along with Cairo's across many
threads.

Secondly, the cairo_device_t is a unifying API for the mismash of
backend specific methods for controlling creation of surfaces with
explicit devices and a convenient hook for debugging and introspection.

The principal components of the API are the memory management of:

  cairo_device_reference(),
  cairo_device_finish() and
  cairo_device_destroy();

along with a pair of routines for serialising interaction:

  cairo_device_acquire() and
  cairo_device_release()

and a method to flush any outstanding accesses:

  cairo_device_flush().

The device for a particular surface may be retrieved using:

  cairo_surface_get_device().

The device returned is owned by the surface.
2010-01-22 23:01:50 +00:00
Chris Wilson
cfd204824f Constify stroke style and matrices.
As a simple step to ensure that we do not inadvertently modify (or at least
generate compiler warns if we try) user data, mark the incoming style
and matrices as constant.
2010-01-22 23:01:49 +00:00
Chris Wilson
c50c8b90c0 Move _cairo_error() to a standalone header
A pending commit will want to include some utility code from cairo and
so we need to extricate the error handling from the PLT symbol hiding.
2010-01-22 22:30:43 +00:00
Adrian Johnson
9ddf14cfd5 PDF: Don't specify colorspace in JPEG2000 image dictionary
PDF uses the colorspace specified in the JPEG2000 image.
2009-11-29 10:40:18 +10:30
Adrian Johnson
02d7e123d6 PDF: Remove extraneous \n from end of jpeg/jp2 data
PDF requires a '\n' between the end of stream data and the "endstream"
that is not included in the stream length. Ensure this is always added
in _close_stream where it is not included in the stream length.

Previously the jpeg/jp2 embedding functions were adding the '\n'. This
resulted in the '\n' becoming part of the stream data.
2009-11-27 23:11:56 +10:30
Adrian Johnson
d962d6bae2 PDF: Include Type 1 fixed-content portion in the embedded font
Some fonts may contain additional PostScript code after the
cleartomark.
2009-11-08 21:46:16 +10:30
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Chris Wilson
df357f26ff Support component-alpha.
Within our code base we carried a few hacks to utilize the component
alpha capabilities of pixman, whilst not supporting the concept for our
own masks. Thus we were setting it upon the pixman_image_t that we
passed around through code that was blissfully unaware and indeed the
component-alpha property was forgotten (e.g. upgrading glyph masks).

The real issue is that without explicit support that a pattern carries
subpixel masking information, that information is lost when using that
pattern with composite. Again we can look at the example of compositing
a sub-pixel glyph mask onto a remote xlib surface for further failure.
2009-10-21 11:37:16 +01:00
Adrian Johnson
3a83bc8617 PDF: Fix regression caused by 1ae5a419
Bug 24240 acroread prints error message when printing
2009-10-02 23:28:10 +09:30
Chris Wilson
665f582954 [ps/pdf] Trim patterns to operation extents
If we have to rasterise a pattern for use by PS/PDF (for example, to
satisfy CAIRO_EXTENT_PAD) then only generate an image large enough to
cover the operation extents. We ensure tight coverage by computing the
extents afresh - we could do this lazily in the future, but we can not
rely on the bounds as computed by the analysis surface as for native
operations they may not be tight.
2009-09-01 18:24:42 +01:00
Chris Wilson
4f880deeab Compiler warnings
Add an impossible default condition to avoid a compiler warning. And tweak
the code to avoid mismatching signed/unsigned comparisons.
2009-09-01 14:24:59 +01:00
Adrian Johnson
aca1dff259 PDF: Ensure operator is selected before painting surface 2009-08-31 23:13:32 +09:30
Adrian Johnson
a402bdbd32 PDF: Flush operators before writing to the PDF stream 2009-08-31 23:13:32 +09:30
Adrian Johnson
119355b2a4 PDF: Reset alpha to 1.0 before painting a surface
Fixes a test suite regression.
2009-08-31 23:13:32 +09:30
Adrian Johnson
135912721f PDF: Avoid using patterns when filling a surface with EXTEND_NONE
The fill equivilant of the previous optimization.
2009-08-31 23:11:05 +09:30
Adrian Johnson
6512faeb94 PDF: Avoid using patterns when painting surfaces with EXTEND_NONE
This is an optimization the PS surface has been using to improve
printing speed and prevent printers from choking on large
images. Applying this optimzation to PDF prevents the same problem
occuring when the PDF is converted to PS.
2009-08-31 23:11:04 +09:30
Adrian Johnson
26d568a9ad PDF: Fix bug when when embedding surfaces 2009-08-31 23:11:04 +09:30
Chris Wilson
a77f1933af Use the more generic is_box when doing simple extent checks
is_rectangle() is far stricter than is_box(), and is only required for a
very limited set of operations (essentially were the rectangle must
conform to the motion as described by cairo_rectangle). For the general
case where we just want to know whether we have a single rectangular path
that covers a certain area,  is_box() is sufficient.
2009-08-29 17:18:19 +01:00
Chris Wilson
8d1bf830c0 Fix errors found by clang
Shadowed variables, unused writes and some dead code.
2009-08-29 08:08:39 +01:00
Chris Wilson
eba6b5126a [build] Add options for warning about bad casts
-Wbad-function-cast in particular. Triggers quite a few warnings where we
have explicitly cast to an integer.
2009-08-29 08:08:38 +01:00
Adrian Johnson
1ae5a41951 PDF: Only Type 3 fonts should include glyph 0 in /ToUnicode
4c498098 made all 8-bit fonts include glyph 0 which incorrectly
included Type 1 fallback fonts.
2009-07-28 21:34:28 +09:30
Chris Wilson
ede0f7e7df [pdf] Eliminate redundant whole-page clip.
We do not to emit a clip if it covers the whole page.
2009-07-27 10:18:20 +01:00
Adrian Johnson
4c498098c0 PDF: Fix glyph 0 in toUnicode stream when using user fonts
_cairo_pdf_surface_emit_to_unicode_stream() was reserving glyph 0 for
the .notdef glyph (as required by TrueType/CFF/Type1 fallback
fonts). However Type 3 fonts do not reserve glyph 0 for .notdef and
need glyph 0 to be included in the toUnicode stream.

http://lists.cairographics.org/archives/cairo/2009-July/017731.html
2009-07-24 21:39:23 +09:30
Chris Wilson
bed2701e1c Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)

In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.

Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:

ppc:
Speedups
========
image-rgba         evolution-20090607-0    1026085.22 0.18% -> 672972.07 0.77%:  1.52x speedup
▌
image-rgba         evolution-20090618-0    680579.98 0.12% -> 573237.66  0.16%:  1.19x speedup
▎
image-rgba      swfdec-fill-rate-4xaa-0    460296.92 0.36% -> 407464.63  0.42%:  1.13x speedup
▏
image-rgba      swfdec-fill-rate-2xaa-0    128431.95 0.47% -> 115051.86  0.42%:  1.12x speedup
▏
Slowdowns
=========
image-rgba     firefox-periodic-table-0    56837.61 0.78% -> 66055.17    3.20%:  1.09x slowdown
▏
2009-07-23 15:32:14 +01:00
Chris Wilson
333d37a60f [pdf] Silence copmiler.
Fill in missing case values to silence the compiler, and remind us should
we every add more operators in future.
2009-07-14 16:41:00 +01:00
Adrian Johnson
47af6cf280 [pdf] Add support for the extra blend modes
HSL modes support added by Benjamin Otte <otte@gnome.org>
2009-07-14 16:04:44 +02:00
Adrian Johnson
0d44416b9d PDF: Don't round pattern y location to an integer
Using cairo_surface_get_extents() to get page height does not work
when the page height is not an integer.

http://lists.cairographics.org/archives/cairo/2009-July/017570.html
2009-07-12 19:21:28 +09:30
Chris Wilson
6003ab77e1 Export meta-surface
The meta-surface is a vital tool to record a trace of drawing commands
in-memory. As such it is used throughout cairo.

The value of such a surface is immediately obvious and should be
applicable for many applications. The first such case is by
cairo-test-trace which wants to record the entire graph of drawing commands
that affect a surface in the event of a failure.
2009-07-03 18:26:50 +01:00
Chris Wilson
c506ddb586 [pdf] Restore original surface size after emitting group mask
A trivial fix to reset the original surface size after emitting the group.
The annoying aspect is that this should have been caught by the test suite.
Alas, no. A gentle reminder that simple line coverage is insufficient. :(
2009-06-27 16:57:35 +01:00