Commit graph

11293 commits

Author SHA1 Message Date
Bryce Harrington
ac43e15bb5 Hide skia backend from users
Comment out the skia backend in configure.ac to avoid presenting it as
an option to users.

Skia is not API stable and is not available in a packaged/versioned
form.  This results in Cairo's skia backend constantly being out of date
and broken, since it will only work with a specific Skia snapshot.  The
last time the cairo skia backend was updated was 2014, and it hadn't
been updated very regularly prior to that.  For these reasons, unless
someone raises an interest in using and/or maintaining the backend,
we'll consider dropping it entirely.
2018-01-03 21:32:36 -08:00
Uli Schlachter
2acc4382c5 Revert "fix warning: variable X might be clobbered by 'longjmp'"
This reverts commit b092b63119 which
introduced a wrapper function around setjmp(). To quote from man setjmp:

  If the function which called setjmp() returns before longjmp() is
  called, the behavior is undefined.  Some kind of subtle or unsubtle
  chaos is sure to result.

Since after the above commit setjmp() is called from the wrapper
function, the result might or might not work, depending on compiler
settings. If the setjmp() wrapper is not inlined, then the state of the
stack after longjmp() will likely be garbage.

[Cherry-Pick:]

This is a cherry-pick from a master branch to the 1.14 branch. The
reverted commit was cherry-picked to this branch in commit
d53db01d01, so this is what this commit
actually reverts.
2017-12-23 13:07:56 +01:00
Bryce Harrington
3d98047095 Start 1.14.13 development 2017-12-06 15:45:39 -08:00
Bryce Harrington
7cf32a065e Release 1.14.12 2017-12-06 14:50:19 -08:00
Behdad Esfahbod
5d5c5ee9c5 Fix undefined-behavior with integer math
As reported to me:

"A calculation on signed integers has undefined behaviour if the result is not
representable in the type. In this case, it's trying to negate int_min, aka
-2^31 but the range of an int is [-2^31, 2^31-1] so it doesn't fit. Instead,
cast to unsigned which has 2's complement wrap-around arithmetic which is what
this particular function expects."
2017-12-04 16:21:33 -08:00
Adrian Johnson
ea42e027d9 build: use _WIN32 instead of windows.h to check for windows build
ifdef _WIN32 is the recommended way to check for a windows build [1]
and avoids identifying cygwin as windows.

based on the patch at [2]

[1] https://lists.gnu.org/archive/html/autoconf/2012-02/msg00008.html
[2] https://lists.gnu.org/archive/html/autoconf/2012-02/msg00009.html
2017-12-04 16:21:04 -08:00
Adrian Johnson
36209baf7f replace _BSD_SOURCE with _DEFAULT_SOURCE
fixes the warning:

warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
2017-12-04 16:20:46 -08:00
Aleksander Morgado
49d396efa9 build: fix minor typo in autogen.sh
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102452
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-12-04 16:20:16 -08:00
Adrian Johnson
6491b686be truetype: reserve space in subset arrays for .notdef
Subset array sizes are allocated based on the number of glyphs in the
font. In this bug the fonts did not contain the mandatory .notdef
glyph, hence the subset arrays were not large enough.

https://bugs.freedesktop.org/show_bug.cgi?id=102922
2017-12-04 16:19:58 -08:00
Adrian Johnson
6b6926239d output-stream: allow %s strings larger than 512 chars
https://bugs.freedesktop.org/show_bug.cgi?id=103249
2017-12-04 16:17:35 -08:00
Adrian Johnson
47b7392416 truetype: limit font name to 127 chars
Some broken fonts have long strings of garbage in the font name

https://bugs.freedesktop.org/show_bug.cgi?id=103249
2017-12-04 16:16:40 -08:00
Adrian Johnson
d53db01d01 fix warning: variable X might be clobbered by 'longjmp'
Move calls to setjmp into separate function to avoid clobbering
local variables.
2017-12-04 15:31:27 -08:00
Adrian Johnson
0aa4628557 util/font-view: fix build error 2017-12-04 15:31:20 -08:00
Adrian Johnson
47b40ad2d5 fix warning: inlining failed in call to '_csi_stack_push' 2017-12-04 15:31:11 -08:00
Carlos Garcia Campos
bc21c580c8 scaled-font: Fix assert when destroying glyph page
This happens when _cairo_ft_scaled_glyph_init() returns
CAIRO_INT_STATUS_UNSUPPORTED when called from
_cairo_scaled_glyph_lookup(). In those cases
_cairo_scaled_font_free_last_glyph() is called to release the glyph that
has just been allocated. If there aren't more glyphs,
_cairo_scaled_glyph_page_destroy() is called. The problem is that
_cairo_scaled_glyph_lookup() should always be called with the cache
frozen, and _cairo_scaled_glyph_page_destroy() without the cache
frozen. We can simply thaw/freeze the font before calling
_cairo_scaled_glyph_page_destroy().

https://bugs.freedesktop.org/show_bug.cgi?id=103335
2017-12-04 15:30:43 -08:00
Bryce Harrington
96b918c445 Start 1.14.11 development 2017-06-15 15:52:56 -07:00
Bryce Harrington
05b63e807b Release 1.14.10 2017-06-15 14:54:53 -07:00
Bryce Harrington
ff7ac087cb RELEASING: Sync doc from trunk 2017-06-15 14:54:46 -07:00
Adrian Johnson
c467f458b1 Fix off by one check in cairo-image-info.c
https://bugs.freedesktop.org/show_bug.cgi?id=101427
2017-06-15 14:54:46 -07:00
Adrian Johnson
e2ab1c608f pdf-operators: fix bug in line wrapping
patch by jmmorlan@sonic.net

https://bugs.freedesktop.org/show_bug.cgi?id=100029
2017-06-15 14:54:46 -07:00
Adrian Johnson
d48dd8575d truetype: reverse cmap search should end when 0xffff- 0xffff range reached 2017-06-15 14:54:46 -07:00
Adrian Johnson
0b4eda23b0 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.
2017-06-15 14:54:46 -07:00
Adrian Johnson
0aafba93f7 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
2017-06-15 14:54:46 -07:00
Adrian Johnson
55f218e845 ft: set font size to em size when retrieving unhinted metrics
fixes text-unhinted-metrics test
2017-06-15 14:54:46 -07:00
Adrian Johnson
834bab9d1c scaled-font-subsets: if glyph 0 used for rendering, remap to different index
Some broken pdfs use glyph 0 in embedded fonts for rendering instead of .notdef.
The cmap we use for embedding latin fonts does not allow rendering glyph 0. Ensure
if glyph 0 is used, it is mapped to a non 0 glyph in the subset.

Bug 89082
2017-06-15 14:54:46 -07:00
Adrian Johnson
0245756c21 cff: opentype fonts always use gid to lookup glyph
Bug 91902
2017-06-15 14:54:46 -07:00
Uli Schlachter
2f830badef xlib: Call XSync() before ignoring errors
The code here wants to ignore errors for a specific request. To do so,
it sets a no-op error handler. However, it could happen that some
previous request caused an error and this error will also be ignored by
the no-op error handler.

To avoid this, call XSync() before setting the error handler. This makes
sure that all pending errors are handled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-06-13 18:35:13 -07:00
Debarshi Ray
2d47ccbc01 doc: Fix the units used by cairo_surface_create_similar_image
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99094

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-06-13 18:35:08 -07:00
Debarshi Ray
80a0c20de2 doc: Clarify when the device scale is inherited and when it isn't
In short, cairo_surface_create_similar inherits it, while
cairo_surface_create_similar_image doesn't. It wasn't obvious without
reading the code or explicitly checking the device scale of the new
surface.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99094

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-06-13 18:35:02 -07:00
Uli Schlachter
eb82b4076d xcb: Fix error reporting if fallback fails
If we cannot let the X11 server do some operation (for example: the
RENDER extension is not available), then we fall back to an image
surface and do the operation locally instead. This fallback requires the
current content of the surface to be downloaded from the X11 server.
This fallback logic had an error.

The fallback is implemented with _get_image() in the function
_cairo_xcb_surface_fallback(). _get_image() is only called if we do not
yet have a fallback available, so when we call _get_image we have
surface->fallback == NULL. Then, if _get_image() fails, it returns a
surface in an error state.

Before this patch, the code would then just ignore this error surface
and return &surface->fallback->base, a NULL pointer. This would then
quickly cause a crash when e.g. the surface's ->status member is
accessed.

Fix this by returning the error surface instead as the fallback.

The end result of this patch will be that the XCB surface that is
currently drawn to ends up in an error state which is a lot better than
a NULL pointer dereference and actually correct in this case. The error
state is reached because the current drawing operation will fail and
this error is reported up the call stack and eventually "taints" the
surface.

(However, the error code could be better: _get_image() too often fails
with a generic CAIRO_STATUS_NO_MEMORY error, but that's left as future
work)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-10 14:39:18 +02:00
Bryce Harrington
3c60c57c60 Start 1.14.9 development 2016-12-07 21:03:27 -08:00
Bryce Harrington
9b23aa0f9d Release 1.14.8 2016-12-07 19:26:36 -08:00
Bryce Harrington
50b1767d75 build: Don't rely on non-POSIX 'strings -' behavior
On systems using GNU's strings implementation, 'strings -' causes a scan
of the whole file, which is equivalent to 'strings -a'.  However, in
POSIX passing '-' as the first argument to 'strings' is declared
unspecified, and thus may break the build on systems that use a
different POSIX strings implementation.

Patch from Jung-uk Kim

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88639
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-12-07 19:23:15 -08:00
Ed Schouten
6a43572922 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-12-07 19:23:15 -08:00
Ed Schouten
3cf64f126b 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-12-07 19:23:15 -08:00
Hans Petter Jansson
4f0abfb8c7 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-12-07 19:23:15 -08:00
Adrian Johnson
53f3077b06 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-12-07 17:59:06 -08:00
Uli Schlachter
14ab479282 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-11-27 17:33:11 +01:00
Uli Schlachter
f75075eef9 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-11-27 17:32:07 +01:00
Marc-André Lureau
42a743cfcb xlib: fix mixing xcb & xlib calls
NextRequest is a macro that doesn't mix well with xcb, since
dpy->request is not updated. Instead use XNextRequest() that was fixed
to do the right thing with xcb in libX11 commit:
http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=7f8f9a36ef901f31279c385caf960a22daeb33fe

This may solve application X errors when a shmdt() is called by cairo
before the Attach request is processed.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-11-27 17:16:32 +01:00
Bryce Harrington
65499badb7 NEWS: Fix link to changelog 2015-12-11 00:49:31 -08:00
Bryce Harrington
3f6dc36df1 Start 1.14.7 development. 2015-12-09 14:20:36 -08:00
Bryce Harrington
9d3191da6f Release 1.14.6 2015-12-09 12:41:13 -08:00
Bryce Harrington
3372181a17 Revert "win32: Add a win32 boilerplate that uses a real window"
This reverts commit 549e511814.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=92771
2015-12-09 11:02:43 -08:00
Bryce Harrington
5d336c66ab Bump version for new stable tree, 1.14.5 2015-10-29 18:19:01 -07:00
Bryce Harrington
0317ee7f61 1.14.4 release 2015-10-28 20:15:53 -07:00
Bryce Harrington
01fff9f2d1 NEWS: Update for 1.14.4 release 2015-10-28 20:14:29 -07:00
Bryce Harrington
6eba71d217 Revert "win32: Add cairo API to set up a Win32 surface for an HDC with an alpha channel."
This adds a new API call, which we generally avoid in micro releases.

This reverts commit 3d489616a2.
2015-10-28 17:37:41 -07:00
Bryce Harrington
b15e18fb90 Revert "pattern: allow for a floating one pixel rounded difference."
While this fixed a real bug, in testing this patch was found to fail a
number of tests and thus needs further work.

This reverts commit e7acf4b6dc.
2015-10-28 17:33:30 -07:00
Uli Schlachter
580a1b6c39 xcb: Fix _put_image_boxes() if no SHM is available
This function tries to use _cairo_xcb_connection_put_image() to do the actual
work. However, that function can only be used for images with "native" stride.
If we only want to upload a rectangle from within an image, the function
_cairo_xcb_connection_put_subimage() has to be used. This function makes sure
that the correct information is sent to the X11 server.

No unit test for this, because we currently do not test the !SHM case
automatically. Perhaps we should?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-28 17:11:41 -07:00