Commit graph

9846 commits

Author SHA1 Message Date
Andrea Canciani
4314a86aa7 arc: Avoid infinite loop
Adding/subtracting 2 * M_PI to a huge floating point number doesn't
change it (because of rounding) and for smaller numbers it still
requires a lot of cycles before the angle is in the desired range.

The same computation can be performed using fmod, which should provide
more accurate results and only requires O(1) time.
2010-12-09 17:33:12 +01:00
Andrea Canciani
028797a729 test: Handle crashed tests
Crashed tests are reported as "CRASH!" in cairo-test-suite.log
2010-12-09 17:33:12 +01:00
Adrian Johnson
d3accefd3b PDF: Output a stencil mask for cairo_mask() with solid source and A1 mask
In https://bugs.launchpad.net/ubuntu/+source/libcairo/+bug/680628 a
65K PDF printed to PDF using poppler-cairo turns into an 8MB PDF.  The
original PDF contains a very large number of stencil mask images (an
A1 image used as a mask for the current color). The PDF surface was
not optimized for this particular case. It was drawing a solid color
in a group and then using an smask with the image in another group.

Fix this by checking for source = solid and mask = A1 image and
emitting a stencil mask image.
2010-12-05 00:29:52 +10:30
Andrea Canciani
f832ff7f22 test: Fix ref images
The corners of the boxes in these ref images were not correct.
2010-12-02 10:28:46 +01:00
Andrea Canciani
ff35af3fd7 image: Fix compositing of unaligned boxes
The input of _fill_unaligned_boxes is (supposed to be) composed only
of disjoint rectangles, that can safely be passed to the rectilinear
span converter, but this function artificially introduces intersecting
rectangles when drawing non-aligned boxes.

Using non-intersecting rectangles is easy and makes the code correct.

Fixes rectilinear-grid.

Reviewed-by: Uli Schlachter <psychon@znc.in>
2010-12-02 10:28:37 +01:00
Andrea Canciani
7b29f1d5d8 test: Add rectilinear-grid
The rectilinear scan converter assumes disjoint rects as input, but
cairo-image passes intersecting rectangles to it.

This test shows that image and any backends passing through it for the
rasterization (fallbacks, vector backends whose renderer is
cairo-based) fail in compute the corners of intersecting rectangles
correctly.
2010-12-02 10:28:08 +01:00
Adrian Johnson
6732dbf299 CFF Subsetting: Subset subroutines
Go through each Charstring looking for the local and global
subroutines called. To avoid modifying the Charstrings [1], the unused
subroutines are reduced to a single byte return op [2] leaving the
remaining subroutines in their original array index position.

Results of testing with some CFF fonts with a 26 glyph [a-z] subset:

Font                       Subset size: Before   After
-------------------------------------------------------
LinBiolinum_Re-0.6.4.otf                48,423    8,295
LinBiolinum_It-0.5.1.otf                88,942   11,501
LinBiolinum_Sl-0.4.9.otf                89,231   11,505
LinLibertine_Re-4.7.5.otf               51,125    8,654
LinLibetine_It-4.2.6.otf                59,333    9,632
Inconsolata.otf                         13,826    8,407

[1] Further reductions could be obtained by stripping out unused
subroutines and renumbering the remaining subroutines but is more
complicated due to the encoding used for subroutine numbers that is
both variable length and a function of the size of the subroutine
array.

[2] Poppler and Fontforge do not seem to like zero length unused
subroutines.
2010-11-30 22:00:38 +10:30
Andrea Canciani
4e60a164d4 test: Fix ref images
The corners of the boxes in these ref images were not correct.
2010-11-28 19:26:35 +01:00
Andrea Canciani
8d7486a6ea image: Fix _pixel_to_solid
An A1 image with full alpha should be opaque black, not opaque white.

Use specialized solid black image instead of the generic constructor
for an A8 image with full alpha (it is likely to be cached).
2010-11-28 18:37:16 +01:00
Andrea Canciani
72b0a44a1f image: Fix compositing of unaligned boxes
The input of _fill_unaligned_boxes is (supposed to be) composed only
of disjoint rectangles, that can safely be passed to the rectilinear
span converter, but this function artificially introduces intersecting
rectangles when drawing non-aligned boxes.

Using non-intersecting rectangles is easy and makes the code correct.

Fixes rectilinear-grid.

Reviewed-by: Uli Schlachter <psychon@znc.in>
2010-11-28 18:35:16 +01:00
Andrea Canciani
1038973083 test: Add rectilinear-grid
The rectilinear scan converter assumes disjoint rects as input, but
cairo-image passes intersecting rectangles to it.

This test shows that image and any backends passing through it for the
rasterization (fallbacks, vector backends whose renderer is
cairo-based) fail in compute the corners of intersecting rectangles
correctly.
2010-11-28 15:42:08 +01:00
Andrea Canciani
cfafa3924b array: Fix comment
The comment was talking about using 0 as index, but was using
"num_elements" instead.
2010-11-28 09:33:14 +01:00
Adrian Johnson
f238da5291 CFF subset: fix bug with euro glyph in fallback fonts 2010-11-28 11:45:00 +10:30
Adrian Johnson
7feefc75f6 CFF subset: fix subsetting of Euro glyph
https://bugs.freedesktop.org/show_bug.cgi?id=31878
2010-11-28 03:46:10 +10:30
Adrian Johnson
f85af7fe8d Change fallback resolution test to use resolutions in multiples of 72
With integer aligned clipping the test output has no seams.
2010-11-28 03:39:05 +10:30
Adrian Johnson
126108a6ac Boilerplate: Set fallback resolution using force_fallbacks function
cairo_set_fallback_resolution() does not work when testing rgb24 surfaces
2010-11-28 03:38:42 +10:30
Adrian Johnson
59661f8af4 Fix fallback-resolution test
The recording surface source image painted onto fallback images always
had the resolution 72ppi instead of the fallback resolution of the
target surface. Fix this by passing adding a new
acquire_source_image_transformed backend function for the recording
surface to use and passing the target device transform through to the
recording surface when the image is acquired.

Based on Carl Worth's experimental acquired_source_image_transformed
branch.

https://bugs.freedesktop.org/show_bug.cgi?id=24692
2010-11-28 03:38:29 +10:30
Andrea Canciani
063a3894d7 pdf: Silence compiler warnings
The compiler complains about a const pointer being free'd and memcpy'd
to:

cairo-pdf-surface.c: In function ‘_cairo_pdf_surface_add_source_surface’:
cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__builtin___memcpy_chk’ discards qualifiers from pointer target type
cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__inline_memcpy_chk’ discards qualifiers from pointer target type
cairo-pdf-surface.c: In function ‘_cairo_pdf_source_surface_entry_pluck’:
cairo-pdf-surface.c:1666: warning: passing argument 1 of ‘free’ discards qualifiers from pointer target type
2010-11-26 13:49:46 +01:00
Andrea Canciani
1ab6496578 array: Silence warnings
493aaf0f15 made all cairo_array
functions use unsigned int for indexes and sizes.

This commit fixes the compiler warnings about those values being
compared to signed int's.
2010-11-26 13:14:37 +01:00
Adrian Johnson
9ec51baa77 PDF: Add missing clipper_reset
(cherry picked from commit 2ae2be36d4)
2010-11-26 22:00:11 +10:30
Adrian Johnson
47b81b9fea Truetype subset: add missing unicode ranges to cmap
A couple of unicode ranges were missing from the cmap generated for latin fonts.

https://bugs.freedesktop.org/show_bug.cgi?id=31878
2010-11-26 21:54:39 +10:30
Adrian Johnson
2ae2be36d4 PDF: Add missing clipper_reset 2010-11-26 21:54:39 +10:30
Markus Stange
841a2df735 Fix type of _cairo_memory_stream_destroy parameter
In 9b9952ab4f
_cairo_memory_stream_destroy was changed to take an unsigned long
instead of unsigned int, and the two callsites in cairo-gl-shaders.c
weren't updated.
2010-11-26 10:02:34 +00:00
Andrea Canciani
b6a97499c7 xcb: Do not return value in void function
Sun Studio Compiler complains:
"cairo-xcb-surface.c", line 585: void function cannot return value
even if the returned value is void.
Some minor code restructuring removes the issue.
2010-11-26 10:02:16 +00:00
Andrea Canciani
e71588c80d test: Add romedalen images copyright information
romedalen.png and romedalen.jpg have been bundled into the test
suite without an explicit copyright notice.
2010-11-26 10:01:38 +00:00
Andrea Canciani
2b3d8de11a Fix degenerate arcs
Make sure that degenerate arcs become a move_to-line_to sequence
instead of just a move_to.

Fixes get-path-extents.
2010-11-26 10:01:19 +00:00
Joerg Sonnenberger
fafca7ace2 LD_PRELOAD is supported on DragonFly. 2010-11-26 10:00:36 +00:00
Erik Zeek
c20d55eb1c Fix build on gentoo
The problem is probably caused by a change in the behavior of autoconf
(2.67).

See http://bugs.gentoo.org/336329
2010-11-26 10:00:21 +00:00
Andrea Canciani
8ef5161da3 configure: Correct reporting of tee backend
Since 9f33f8453b tee is not compiled in
anymore by default. Reporting it as always enabled is misleading.
2010-11-26 10:00:10 +00:00
Chris Wilson
2a1e7e18de wgl: Use CreateWindowA with an ASCII string
... or else compilation with fail on Windows if UNICODE is defined

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-11-26 09:48:13 +00:00
Andrea Canciani
493aaf0f15 array: Cleanup types
Const-ify where appropriate and make all index and element counts
unsigned int.

This is needed to enable accessing const cairo_array_t's without
having to manually remove the const qualifier (which happens in the
to-be-merged mesh pattern code, for example).
2010-11-24 14:45:19 +01:00
Andrea Canciani
9960f299ac array: Add read-only accessor
It is sometimes useful to read the elements of a const cairo_array_t,
but it is currently only possible by ignoring the const qualifier.
The _cairo_array_index_const function allows read-only access to the
array elements.

This is needed to enable accessing const cairo_array_t's without
having to manually remove the const qualifier (which happens in the
to-be-merged mesh pattern code, for example).
2010-11-24 14:45:14 +01:00
Andrea Canciani
ae6a0de23b array: Remove snapshot support
Array snapshots are not used anymore and just bloat the implementation
of cairo_array_t.

In particular, double indirection was needed to implement array
snapshots, as explained in c786853993.
2010-11-24 14:45:07 +01:00
Andrea Canciani
a6b503961b ps: Fix painting
Painting of some pattern was broken because the paint operation was
implemented as a fill to a rect containing the clip, but this rect was
not transformed as appropriate (using the cairo_to_ps matrix).
PDF simply fills the whole surface rect, so we implement the same
behavior in PS.

Fixes clip-group-shapes-circles, clip-stroke, linear-gradient-extend,
linear-gradient-one-stop, radial-gradient-one-stop.
2010-11-24 13:32:40 +01:00
Uli Schlachter
520206e991 xcb: Handle deferred_clear in _copy_to_picture
This ensures that surfaces with the deferred_clear flag on are cleared
before being used as sources.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-11-23 22:12:45 +01:00
Andrea Canciani
56528d7b9d ps: Fix painting
Painting of some pattern was broken because the paint operation was
implemented as a fill to a rect containing the clip, but this rect was
not transformed as appropriate (using the cairo_to_ps matrix).
PDF simply fills the whole surface rect, so we implement the same
behavior in PS.

Fixes clip-group-shapes-circles, clip-stroke, linear-gradient-extend,
linear-gradient-one-stop, radial-gradient-one-stop.
2010-11-23 15:08:44 +01:00
Andrea Canciani
e2c9964c3e quartz-font: Implement new load_truetype_table semantics
fb0304e2a9 changed and specified the
behavior of load_truetype_table.
This commit makes quartz-font implement the new behavior.
2010-11-23 14:29:24 +01:00
Adrian Johnson
8db239660f Check is_synthetic() font backend exists before calling it 2010-11-23 23:26:49 +10:30
Adrian Johnson
12b1cbb07e Fix xml-surface use of load_truetype_font 2010-11-23 23:20:25 +10:30
Adrian Johnson
e2dcbfd895 Automate error checking for ps-eps test 2010-11-23 23:13:50 +10:30
Adrian Johnson
67a90e8035 Check table size in cairo_truetype_get_style() 2010-11-23 22:02:55 +10:30
Adrian Johnson
fb0304e2a9 Document load_truetype_table function and ensure ft-font and Win32-font are compliant
There were some difference between how the FT and Win32
load_truetype_table font backend functions worked due to the
difference between FT_Load_Sfnt_Table() and GetFontData(). eg FT
returns an error if less than the requested number of bytes could be
read while Win32 returns success and sets the length to the number of
bytes read.
2010-11-23 21:44:31 +10:30
Chris Wilson
abff335348 pdf: Silence compiler for an impossible case
Make the default case be an assert to catch a silly programming error
and silence the compiler:

  cairo-pdf-operators.c: In function ‘_word_wrap_stream_write’:
  cairo-pdf-operators.c:300: warning: ‘count’ may be used uninitialized in
  this function

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-11-22 18:49:22 +00:00
Adrian Johnson
1effa1e823 win32: add synthetic font subsetting support 2010-11-23 00:13:56 +10:30
Adrian Johnson
7f0029c31e Use fallback font for synthetic fonts
If the font has been synthesized we can't use the native subsetters as
the outlines won't be the same. Instead force the use of the fallback
subsetters so the synthesized outlines will used to generate the font.
2010-11-23 00:13:24 +10:30
Adrian Johnson
9862c38fc7 Add unique_id mime type
to ensure surfaces with the same unique_id mime type are not embedded
more than once in PDF files.
2010-11-23 00:13:02 +10:30
Adrian Johnson
b8347e3353 PS: Fix regression - incorrect EPS bounding box
https://bugs.freedesktop.org/show_bug.cgi?id=24688
(cherry picked from commit bb4055dac6)
2010-11-21 20:34:47 +10:30
Adrian Johnson
cfff4f30a0 PS: Fix regression - missing page content in EPS output
https://bugs.freedesktop.org/show_bug.cgi?id=24688
(cherry picked from commit d3746448d7)
2010-11-21 20:34:35 +10:30
Adrian Johnson
ed87ddddb3 PS/PDF: Fix regression when changing page size to a larger size
https://bugs.freedesktop.org/show_bug.cgi?id=24691
(cherry picked from commit e7c5f47043)
2010-11-21 20:34:18 +10:30
Adrian Johnson
ccff76433e PDF: Restrict ActualText to PDF version >= 1.5
The use of ActualText in a marked content sequence is a PDF 1.5
feature.

A 'use_actual_text' flag linked to the PDF version has already been
implemented in pdf-operators but for some reason this flag had not
been used to control the use of ActualText.
(cherry picked from commit 3afd7cd031)
2010-11-21 20:33:57 +10:30