Commit graph

182 commits

Author SHA1 Message Date
Luca Bacci
6989158f4c Drop support for very old GCC versions
They don't support C11 anyway. Additionally, CLang defines a very
conservative __GNUC__ value (which is also configurable via the
-fgnuc-version= command-line argument)
2025-06-16 18:52:39 +02:00
Uli Schlachter
b35a9ead97 Fix cairo-fdr and cairo-trace
This partially reverts commit ba4d5fbd5 from MR !343 which asked for
hidden symbols everywhere. cairo-fdr and cairo-trace explicitly try to
interpose existing symbols. Changing them to hidden symbols breaks these
tools.

See: https://gitlab.freedesktop.org/cairo/cairo/-/issues/882#note_2759005
Signed-off-by: Uli Schlachter <psychon@znc.in>
2025-01-31 18:10:47 +01:00
Adrian Johnson
c235bc4dee Fix bug in cairo-trace when writing A8 images
Fixes: #848
2024-06-27 07:07:22 +09:30
Emmanuele Bassi
ba4d5fbd5d Build with hidden symbols by default
We should default on every platform we care about to hidden symbols, to
avoid leaking private symbols.

On Windows this is the default state of affairs with the MSVC toolchain;
with GCC and GCC-compatible toolchains, we need to opt into this
behaviour. Luckily for us, Cairo already has an annotation for public
symbols, so we can easily tweak it to include the visibility attribute.

When building ancillary libraries as part of the Cairo compilation on
Windows, we use a pre-processor symbol to ensure that we keep the
dllexport annotation. This avoids including the cairoint.h header file.

Fixes: #582
2023-08-16 16:33:04 +01:00
Khaled Hosny
a74ef93d82 Fix -Wunused-function warnings 2023-02-06 11:42:00 +02:00
Emmanuele Bassi
b5793081d0 Drop cairo-gl
The GL support in Cairo has always been a prototype, and
nothing happened in the past 10+ years to make it work as
it was meant to.

GL support is not enabled by any downstream packagers of
Cairo, so nobody should notice its absence.
2023-01-27 19:21:46 +00:00
Adrian Johnson
cbcf962da2 svg-font: return SVG_FONT_ERROR on error 2023-01-20 20:37:45 +10:30
Adrian Johnson
efe303d9db Remove autotools build 2023-01-08 22:27:47 +10:30
Simon McVittie
24996e6ee2 Fix build with newer binutils-dev installed
It seems the PTR typedef (or macro?) has been removed from newer versions
of libbfd.

Resolves: https://gitlab.freedesktop.org/cairo/cairo/-/issues/581
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-07-14 10:27:41 +01:00
Adrian Johnson
5b18aeffbb Replace use of ctype functions with internal version where only ASCII chars are used
In !309 Taylor R Campbell found a number of instances of ctype
incorrectly passed a signed char. In many cases, where only ASCII
characters are used, the code should have been using the cairo version
of the ctype function to avoid locale issues.
2022-04-09 22:08:57 +09:30
Adrian Johnson
989d368dc5 DWrite font docs 2022-03-05 16:56:56 +10:30
Emmanuele Bassi
9b9028c160 Drop cairo-vg surface
OpenVG is a failed experiment from 10 years ago, and nobody has been
using the cairo-vg surface in pretty much the same amount of time.
2022-02-25 02:09:58 +00:00
Adrian Johnson
2822728f2a Fix some MinGW warnings
The FT change is because my MinGW build is using a more recent version
of FT.

Remove the disabled _cairo_win32_scaled_font_text_to_glyphs() code to
fix the defined but not used warning.

_cairo_win32_scaled_font_text_to_glyphs() was diabled in d9408041aa with
the comment:

  "Currently disable the win32-font text_to_glyphs(), until that one
   is updated.  Or better yet, remove it and implement
   ucs4_to_index().  It's the toy font API afterall."

_cairo_win32_scaled_font_ucs4_to_index() was added in d1c619bc7d.
2021-09-02 21:14:51 +09:30
Adrian Johnson
9fbf427548 Use uintptr_t for all casts between pointer and integer
On 64-bit windows, long is 32-bit. When compiling there are a large
number of warnings about mismatched sizes when casting long to/from a
pointer.

Use the (u)intptr_t type for any integer that will have a pointer stored
in it. Use a (u)intptr_t cast when integers are stored in pointers to
silence warnings.

Fixes #263
2021-07-25 11:01:20 +09:30
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
bfd1602db9 Remove stray _GNU_SOURCE definitions
We define _GNU_SOURCE globally in both the Autotools build, through the
use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
add_project_arguments().
2021-05-01 16:58:15 +01:00
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
Tim-Philipp Müller
ca478e0327 meson: make cairo-trace executable
Install with exec flag set and make sure tool is
executable in build directory as well (by making
the input file in the source directory executable).

Fixes #462
2021-03-09 10:59:57 +00:00
Tim-Philipp Müller
e30259f623 cairo-trace: fix build with newer versions of bfd
And update configure/meson checks to check for the new function.

Drop libiberty.h check since it's only needed by backtrace-symbols.c
which we're about to remove.

Closes #391, #460
2021-02-23 12:29:58 +00:00
George Matsumura
08c76f4cbf cairo-trace: Fix escape character encoding in string literals
This fixes a typo wherein both a return character and a tab character
were encoded when only a return character was specified for encoding.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-11-20 16:07:53 +00:00
George Matsumura
ed98414686 build: Fix various compiler warnings
This fixes a few compiler warnings that were encountered with gcc 9.3.0.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-11-07 06:45:01 -07:00
George Matsumura
f2cb9ba49a meson: Fix musl build
This constitutes few fixes that are necessary to compile correctly
and reduce errors when using musl libc.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-09-02 10:29:04 +00:00
Ting-Wei Lan
b87e53dc1c meson: Fix undefined reference when bfd library is installed
Add the missing file which is necessary when symbol lookup is enabled.
2020-08-31 23:20:49 +08:00
Mathieu Duponchelle
596a82f2d1 Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
2020-07-31 12:21:50 +01:00
Maarten Lankhorst
a34cb719cd Add support for RGBA128F and RGB96F formats.
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>
2019-01-07 19:10:44 -08:00
Maarten Lankhorst
87c1c19197 cairo-trace: Simplify bigendian case in emit_image.
All the cases are the same, except len is different.
Use the already calculated len parameter to handle all
cases except RGB24 the same.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Suggested-by: Bryce Harrington <bryce@bryceharrington.org>
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2019-01-07 19:10:30 -08:00
Paul Menzel
f246a2144f Use HTTPS URLs for gnome.org domains
Run the command below suggested by geirha in ##sed@irc.freenode.net.

    git grep -l 'http://.*gnome.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}gnome\.org\)|https\1|g'

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
2018-10-16 10:03:20 -07:00
Bryce Harrington
9d2e3646fa script-surface: Check for invalid ids (CID #1159557, 1159558)
If the bitmap's min is non-zero, _bitmap_next_id() could break out of
its loop early, before initializing the prev variable.  prev would then
be dereferenced without a null ptr check.  This condition should never
occur in practice, so add an assert() to assure it doesn't.

Same issue is present in trace.c.

Coverity IDs: #1159557, #1159558
Reviewed-By: Uli Schlachter <psychon@znc.in>
Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
2018-06-13 15:21:50 -07:00
Adrian Johnson
55f8c6d9f4 fix compiler warnings 2016-10-04 12:00:30 +10:30
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
Adrian Johnson
747cab741c Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors 2016-03-26 22:18:05 +10:30
Adrian Johnson
cdd5c92ced Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetype 2016-03-26 21:45:59 +10:30
Adrian Johnson
8f6790123e Adding missing error status to utils 2016-03-26 19:06:03 +10:30
Emanuele Aina
cca8b1960b cairo-trace: Fix duplicated surface push on similar-image
The current code results in trace lines with the source surface being
pushed on the stack two times instead of one:

s1 s1 //ARGB32 48 48 similar-image % s2

Instead of:

s1 //ARGB32 48 48 similar-image % s2

This greatly confuses later commands when the script was replayed,
causing traces for trivial GTK3 programs to be unplayable, usually
yielding the following error:
"invalid value (typically too big) for the size of the input (surface, pattern, etc.)"

Drop the duplicated entry from the trace line printed by the
cairo_surface_create_similar_image() override.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73580
Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
2015-01-20 18:14:52 +01:00
Behdad Esfahbod
312553af29 [trace] Don't print FC_CHARSET, FC_LANG, and FC_CAPABILITY
There are many more that can go, but these take the most bytes.
FC_CHARSET needs to go specially because I recently changed
its format in fontconfig.  Ouch!
2014-07-11 11:07:25 -04:00
Ravi Nanjundappa
52b137bc3e test and util: maintain consistency in the usage of ARRAY_LENGTH macro
ARRAY_LENGTH macro is used in perf's cairo-perf.h, src's cairoint.h,
test's cairo-test.h and in some internal header files of util's
directory.So to maintain consistency ARRAY_SIZE is replaced with
ARRAY_LENGTH macro.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-30 13:01:35 -07:00
Bryce Harrington
1ce452db4c cairo-trace: Stringify CAIRO_STATUS_JBIG2_GLOBAL_MISSING
This error enum was added last September when JBIG2 support was added.
Support it as well in the tracing code.  This fixes this warning:

trace.c:1544:5: warning: enumeration value
‘CAIRO_STATUS_JBIG2_GLOBAL_MISSING’ not handled in switch [-Wswitch]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:53 -08:00
Chris Wilson
c1ac8db7e6 trace: Fix operand emission
Recent updates (in the past couple of years) to firefox have exposed
numerous bugs in the way we emit the operands. A few off-by-ones,
missing surfaces and outright bugs all of which are intermixed into
producing a corrupt stack.

Reported-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 16:37:24 +01:00
Chris Wilson
a4164142f2 trace: Record set-device-scale
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 16:12:26 +01:00
Chris Wilson
17dc312221 trace: Improve operand emission
In particular fixing up a couple of corner cases in emitting the right
instructions for scaled-fonts and patterns.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-05 22:34:52 +01:00
Chris Wilson
dfbf80a57d trace: Do not forcibly add surfaces to the dictionary
Adjust the stack manipulation to avoid moving an unknown surface to
the dictionary.

Reported-by: Dongyeon Kim <dy5.kim@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-28 09:36:59 +00:00
Chris Wilson
376d39121c trace: Fix operand emission for map-to-image and unmap-image
Reported-by: Dongyeon Kim <dy5.kim@samsung.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-11-27 12:25:56 +00:00
Chris Wilson
b438e58308 trace: Fix propagation of CAIRO_TRACE_OUTDIR to children
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-11 17:42:17 +01:00
Dongyeon Kim
a473c03567 trace: Wrap GL surfaces 2012-03-19 10:36:08 +00:00
Chris Wilson
f5b5fad66e trace: Add breadcrumb for cairo_image_surface_get_data()
Just emit a marker for when cairo_image_surface_get_data() is called on
a surface so that we have a breadcrumb for when the pixels are first
exported. (Though note that pointer may be kept around and used much
later.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-15 11:58:51 +00:00
Nis Martensen
77da76ac6c doc: fix a few typos found by codespell
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-03-10 10:20:28 +01:00
Chris Wilson
4713562eda trace: Remove the warning about the unstable format
We're stuck with the PostScript style for this generation now.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:50:21 +00:00
Chris Wilson
8844d50308 Convert cairo_mime_surface_t to cairo_raster_source_pattern_t
As discussed, overloading the cairo_surface_t semantics to include
sources (i.e. read-only surfaces) was duplicating the definition of
cairo_pattern_t. So rather than introduce a new surface type with
pattern semantics, start along the thorny road of extensible pattern
types.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 10:35:42 +00:00
Chris Wilson
add9a4092b trace: Emit an stack operation to create a pattern from an undefined surface
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-27 14:56:55 +01:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
2011-09-12 08:29:48 +01:00