- vsnprintf and snprintf are available since vs2015
- define ISREG if not provided
- guard unistd.h include with HAVE_UNISTD_H
- isnan() is available after vs2010
When the build dir is different from the source dir,
"png.png" is not a valid path. As we can't dispose of
an allocated filename, we add an atexit handler.
This way all binutils tools are detected with $CHOST prefix
if exist. And strings is allowed to be substituted with
STRINGS environment override, so 'llvm-strings' (or other)
alternative can be used.
Bug: https://bugs.gentoo.org/726200
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This function is reachable via cairo_ft_font_face_create_for_ft_face()
-> _cairo_ft_unscaled_font_create_from_face() ->
_cairo_ft_unscaled_font_create_internal() ->
_cairo_ft_unscaled_font_map_lock(). Thus, it could happen that nothing
initialized mutexes before this code runs.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The code in test/cairo-test-runner.c properly takes into account
platforms that do have fork() support, and uses the SHOULD_FORK define
to know whether fork is available or not.
However, this SHOULD_FORK macro is used to guard the inclusion of
<unistd.h>, which is needed to get the prototype of other functions
(namely readlink and getppid), that are used in portions of this file
not guarded by SHOULD_FORK.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/cairo/0001-fix-nofork-build.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
We can't just move around the contents of the
passed-in string, we need to make a copy. This
was showing up as memory corruption in pango.
See https://gitlab.gnome.org/GNOME/pango/issues/346
Support subpixel positioning with a 4x4 subpixel grid.
When compositing glyphs in the image compositor,
we store the subpixel phases in the high bits of the
glyph index. The _cairo_scaled_glyph_index() macro
has been updated to discard these bits. By storing
the phases in the glyph index, the glyph cache just
keeps working. When loading a glyph, the Freetype
font backend shifts the outline according to the
phases.
FT_PIXEL_MODE_BGRA is an enum member, not a define, so it always appears
as 0 in the preprocessor conditions added in commit c0ed8ce1a1.
There is an existing define for color font support, use that instead.
Since commit a34cb719cd, we need pixman >= 0.36, which is not yet
in the latest Fedora. Thus, this switches to Fedora rawhide to make
things work again.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Commits cb871c6c made the function _cairo_clip_reduce_to_boxes()
actually do something instead of being a no-op. This exposed a latent
bug in cairo that was so far just not hit due to luck.
The function _cairo_clip_steal_boxes() removes the boxes from a clip and
gives them to a cairo_boxes_t. _cairo_clip_unsteal_boxes() undoes this
operation. For efficiency reasons, cairo_clip_t contains an embedded
cairo_box_t that is used when the clip has only one box to avoid a
memory allocation. Thus, _cairo_clip_unsteal_boxes() must be called on
the same clip that was given to _cairo_clip_steal_boxes(), or otherwise
a clip could end up to the embedded box of another instance of
cairo_clip_t. This is exactly what was happening here.
For example, cairo-xcb can replace extents->clip with another clip via
the call chain _cairo_xcb_render_compositor_paint() (which is where
boxes are stolen) -> _clip_and_composite_boxes() ->
trim_extents_to_traps() ->
_cairo_composite_rectangles_intersect_mask_extents(). This function
replaced the clip with the result of _cairo_clip_reduce_for_composite()
and frees the old clip. At this point, the boxes that were stolen
previously become invalid / become a dangling pointer. The crash later
on is just one of the side effects of this.
This commit fixes this problem by treating embedded boxes specially in
_cairo_clip_steal_boxes() and _cairo_clip_unsteal_boxes(): The
cairo_boxes_t instance also has embedded boxes. An embedded box on the
clip is copied to these other embedded boxes. When unstealing, the
embedded box of the clip is used again. Thus, it does not matter anymore
that another instance of _cairo_clip_t is used for unstealing.
Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/358
Signed-off-by: Uli Schlachter <psychon@znc.in>
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint`
Follow up of 12cb59be7d
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
The indentation of this line suggests it is a typo. In any case it
causes the function to unconditionally return immediately, thereby
shortcircuiting it entirely, which does not appear to be the intended
behavior.
Fixes: https://gitlab.com/cairo/cairo/issues/2
Similar to writing png, don't squash 16 bpc to 8 bpc and create
a float surface to contain the image.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
_cairo_image_surface_coerce will round down the image to a lower
bpp when using one of the floating point formats, so don't coerce those.
This makes the code actually work for those formats.
Because a float takes more storage than u16, we have to convert float
to u16 before calling png_write_image, because png_write
doesn't give us back the original row data, but an in-place copy.
With these changes we can dump floating point files with the highest
possible accuracy, with floats clamped between 0 and 1.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
IGT wants to add support for planes with a bit depth >10, which
requires a higher precision format than we have currently.
I'm using RGBA as format, because of its existence in OpenGL.
With the new formats we can directly convert our bytes to half float,
or multiply a colro vector with a matrix to go to the Y'CbCr colorspace.
This requires pixman 0.36.0, so bump the version requirement.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>