Commit graph

11373 commits

Author SHA1 Message Date
Bryce Harrington
9d2983175e Fix grammar in cairo_*_reference() function documentation.
"can be get" is incorrect grammar; "can be gotten" would be better, but
active voice is best.

Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
2016-10-10 14:39:19 -07:00
Adrian Johnson
4790a3663d strndup is not avuilable with MSVC 2016-10-07 07:38:37 +10:30
Adrian Johnson
55f8c6d9f4 fix compiler warnings 2016-10-04 12:00:30 +10:30
Adrian Johnson
3c33d97041 fix make check 2016-10-04 12:00:30 +10:30
Adrian Johnson
23fd706bd1 add test for PDF document interchange features such as tagged text and links 2016-10-01 22:48:05 +09:30
Adrian Johnson
2d6a0f5d16 pdf: thumbnail API 2016-10-01 22:46:49 +09:30
Adrian Johnson
26b3f83ff6 pdf: page label API 2016-10-01 22:44:22 +09:30
Adrian Johnson
5bfadd5530 pdf: metadata API 2016-10-01 22:41:36 +09:30
Adrian Johnson
dfc7b9e669 pdf: add document outline API 2016-10-01 22:28:02 +09:30
Adrian Johnson
dcbfb72647 pdf: structured text and hyperlink support 2016-10-01 22:05:42 +09:30
Adrian Johnson
25da407a5f Support tag operations in analysis and paginated surface 2016-10-01 17:30:13 +09:30
Adrian Johnson
3bd5efa1b6 Add tag functions to recording surface and surface-wrapper 2016-10-01 17:26:16 +09:30
Adrian Johnson
4e70815b34 Add tag functions to cairo_t and cairo_surface_t
The cairo_tag_begin/cairo_tag_end API is for supporting hyperlinks and
creating tagged PDF files.

The source, ctm, and stroke style are passed to the backend to allow
these parameters to be used to specify hyperlink border attributes.
2016-10-01 17:14:28 +09:30
Peter TB Brett
b207a932a2 Correctly decode Adobe CMYK JPEGs in PDF export
Adobe PhotoShop generates CMYK JPEG files with inverted CMYK.  When a
JPEG file with this format is included in a PDF file, a `/Decode`
array must be included to convert to "normal" CMYK.

These JPEG files can be detected via the presence of the APP14 "Adobe"
marker.  However, PDF viewers are not required to detect and handle
this private marker, so it must be detected and handled (by adding a
`/Decode`) by the PDF generator.

Signed-Off-By: Peter TB Brett <peter.brett@livecode.com>
2016-09-09 22:35:55 +09:30
Ed Schouten
a69e5af9cd Write debugging information to the debugging file
Some debugging functions wrote to stdout, which is inconsistent with
the other debugging functions of the same groups.

Instead they should write to the debugging file that they are given as
input.

Reviewed-by: Andrea Canciani <ranma42@gmail.com>

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95227
2016-09-04 11:05:43 +02:00
Ed Schouten
efc40a9493 Prevent observer surfaces from writing to stdout
Invoking cairo_surface_mark_dirty () on an observer surface would
cause it to print debugging output to stdout.

Reviewed-by: Andrea Canciani <ranma42@gmail.com>

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95227
2016-09-04 08:45:06 +02:00
Behdad Esfahbod
0aad04a88b Bug 29319 - Modules are built as versioned shared objects
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29319
2016-09-02 15:54:01 -07:00
darxus@chaosreigns.com
cbbd02f9c5 Add example to run specific tests by name to the test/README
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2016-08-31 20:29:57 -07:00
darxus@chaosreigns.com
66205ad48e Remove closed poppler bugs from test/README
These bugs have all been closed resolved / fixed for years.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-31 18:22:10 -07:00
Olivier Blin
35a1761776 Pull -lz for the script backend
It uses cairo_deflate_stream.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Behdad Esfahbod <behdad.esfahbod@gmail.com>
2016-08-31 14:35:12 -07:00
Hans Petter Jansson
1057487ce8 scaled-font: Fix deadlock when recursing in _cairo_scaled_font_reset_cache()
The destruction of a scaled font could indirectly trigger the destruction
of a second scaled font, causing the global cache to be locked twice in
the same thread.

This is solved by unlinking the font's glyph pages while holding the global
lock, then releasing the lock before destruction takes place.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93891
2016-08-02 14:21:45 -07:00
Uli Schlachter
3f8241f484 cairo-xcb: Remove a wrong optimisation
When doing a "complicated" mask operation, we draw the clip to a surface and use
this as a mask in later operations. The code assumes that this operation draws
to the whole target surface and thus a deferred clear may be skipped.

However, this requires that the extents of the trapezoids that will be drawn and
the extents of the surface are the same. This assumption is wrong, as can be
seen e.g. by the bug report that this commit fixes.

The fix is just not to skip the deferred clear.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84330
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-21 18:58:58 +02:00
Adrian Johnson
56ad58a807 pdf: fix combined image/smask
a736fd8 introduced a regression
2016-07-19 22:42:53 +09:30
Adrian Johnson
d28b6d9b12 pattern: revert an unintentional change added in 190678f 2016-07-18 18:43:03 +09:30
Adrian Johnson
8a921e6c3e truetype: reverse cmap search should end when 0xffff- 0xffff range reached 2016-07-17 21:33:12 +09:30
Adrian Johnson
16a8c13b6a pdf: Don't fail subsetting if unable to convert utf8 to utf16
If the unicode came from the font, don't fail if utf8_to_utf16 fails.
2016-07-17 21:19:37 +09:30
Adrian Johnson
190678f644 pattern: don't round extents to 0 on vector surfaces
In this bug a Type 3 font contains a dash glyph. The dash glyph
consists of an 82x2 image. The image height, when scaled to user space,
is < 1 resuling in the drawing operation for the image being culled.

https://bugs.freedesktop.org/show_bug.cgi?id=94615
2016-07-16 15:42:23 +09:30
Adrian Johnson
1a380ef5f3 ps/pdf: remove debug and commented out code 2016-07-15 22:03:04 +09:30
Adrian Johnson
0e6f7deac1 ps: flush ASCII85Decode file after use
If the image operator does not read all the ASCII85 data, the PS
interpreter will try to execute the next byte of unread data.

Define our own image operator that calls flushfile (reads until end of
file) on the filter after drawing the image.

https://bugs.freedesktop.org/show_bug.cgi?id=84811
2016-07-15 16:32:53 +09:30
Adrian Johnson
b73c082c7f truetype: Don't write glyph if num_contours == 0
According to the Opentype spec, num_contours in a glyf table entry can
be > 0 (single glyph) or < 0 (composite glyph).  num_contours == 0 is
undefined.

The embedded font in the test case for this bug contained a space
glyph with num_contours == 0. This was failing on some printers.
According to the spec, glyphs with no outlines such as space are
required to have a 0 size entry in the loca table.

https://bugs.freedesktop.org/show_bug.cgi?id=79897
2016-07-09 18:31:55 +09:30
Bryce Harrington
38fdcc30a3 cairo-misc: Whitespace cleanup 2016-07-06 15:46:00 -07:00
Adrian Johnson
deb994488f test: refresh text-rotate ref images 2016-07-05 20:26:47 +09:30
Adrian Johnson
bb4595130b ft: set font size to em size when retrieving unhinted metrics
fixes text-unhinted-metrics test
2016-07-05 20:26:47 +09:30
Adrian Johnson
d92015e4f9 add test text-unhinted-metrics
Based on bug report in https://lists.cairographics.org/archives/cairo/2016-April/027334.html
2016-07-05 20:26:47 +09:30
Adrian Johnson
1ada65c34f pdf: remove unused variable 2016-07-03 10:39:08 +09:30
Adrian Johnson
c2dc5aa684 recording: Remove unused function 2016-07-03 10:38:46 +09:30
Enrico Weigelt, metux IT consult
97d8b2b7de qt: replaced calls to _cairo_clip_init_copy() by _cairo_clip_copy()
_cairo_clip_init_copy() was removed with commit b132fae5e8,
but a few calls were still remaining.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-02 13:38:25 +02:00
Enrico Weigelt, metux IT consult
f212db2fcc core: fixed code duplication
We have two places where copying from box set to clip is
implemented in the same way. Just move that to one function.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-02 13:35:38 +02:00
Enrico Weigelt, metux IT consult
5bb43c92b3 core: dropped actually unused parameter of _cairo_boxes_to_array()
When parameter force_allocation is false *and* the box set has
exactly one chunk, this chunk is returned directly - w/o copying it.

That mode is never used, and it's highly problematic as it's unclear
whether we have to free the returnd object or it's still owned
by somebody else.

Just dropping the useless parameter / corner case to make the function
simpler and more robust.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-02 13:35:38 +02:00
Enrico Weigelt, metux IT consult
b23c2291d8 core: helper inline for rect->box conversion
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-02 13:35:34 +02:00
Enrico Weigelt, metux IT consult
ae403448af core: fix compiler warnings
The code correct, but the compiler can't check that and thinks
there're uninitialized variables.

Perhaps we could rewrite it in a better way, so the compiler
can do better (even arch specific) optimizations.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt@gr13.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-02 13:27:11 +02:00
Adrian Johnson
1272db90f8 win32: gcc 5.4 build fix 2016-06-21 19:44:48 +09:30
Adrian Johnson
90d50cd923 win32-print: fix unbounded surface assertion
https://lists.cairographics.org/archives/cairo/2016-June/027445.html
2016-06-19 19:52:32 +09:30
Uli Schlachter
d69dd6b341 xlib: Fix double free in _get_image_surface()
If XShmGetImage() fails, the code tries to continue with its normal,
non-shared-memory path. However, the image variable, which was previously set to
NULL, now points to an already-destroyed surface, causing a double-free when the
function cleans up after itself (actually, its an assertion failure because the
reference count of the surface is zero, but technically this is still a double
free).

Fix this by setting image=NULL after destroying the surface that this refers to,
to make sure this surface will not be destroyed again.

While we are here (multiple changes in a single commit are bad...), also fix the
cleanup done in bail. In practice, &image->base should be safe when image==NULL,
because this just adds some offset to the pointer (the offset here is actually
zero, so this doesn't do anything at all). However, the C standard does not
require this to be safe, so let's handle this case specially.

Note that anything that is fixed by this change is still buggy, because the only
reason why XShmGetImage() could fail would be BadDrawable, meaning that the
target we draw to does not exist or was already destroyed. This patch will
likely just cause X11 errors elsewhere and drawing to (possible) invalid
drawables is not supported by cairo anyway. This means that if SHM fails, the
following fallback code has a high chance of failing, too.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91967
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-19 11:34:35 +02:00
Adrian Johnson
eb808aa625 image: only cache analyzed transparency/color for snapshot surfaces
https://lists.cairographics.org/archives/cairo/2016-June/027429.html
2016-06-19 14:08:55 +09:30
Adrian Johnson
113ba5f3fa Update ref images
ref images were creating using Debian Jessie 64-bit and latest poppler.
2016-06-05 20:43:36 +09:30
Adrian Johnson
1c5ec6e380 Fix PS record-neg-extents test failure 2016-06-05 20:43:36 +09:30
Adrian Johnson
a14d319e43 ps: change from ps coordinates to cairo coordinates 2016-06-05 20:43:36 +09:30
Adrian Johnson
14fa88fd02 pdf: fix record-replay-extend test failures 2016-06-05 20:43:36 +09:30
Adrian Johnson
e7b1cb0c53 image: fix record-replay-extend test failures 2016-06-05 20:43:36 +09:30