Commit graph

12230 commits

Author SHA1 Message Date
John Ralls
b6e0f36ee5 [quartz]Cleanup _cairo_quartz_cairo_repeating_surface_pattern_to_quartz 2022-02-24 17:00:07 -08:00
John Ralls
ae320c4d75 [quartz] Use CoreGraphics instead of Qt to write debug png file. 2022-02-24 17:00:07 -08:00
John Ralls
bacbe9bb2d [quartz] Create similar surfaces using a CGLayer for faster drawing. 2022-02-24 17:00:07 -08:00
John Ralls
76e6a0ddf7 [quartz] Remove cached image_surface on quartz surfaces.
Caching doesn't really do anything and removing it provides a 50%
speedup and gets pdf-operators-text to pass on argb32.
2022-02-24 17:00:07 -08:00
John Ralls
64786613ee [quartz] Snapshot CGBitmapContext-mapped surfaces to cache CGImages.
Motivation: Avoid need to recreate CGImages for unchanged surfaces,
an expensive operation, while ensuring that the CGImages are properly
freed and new ones created when the surface does change.

Thanks to Uli Schlacter for suggestion and coding guidance.
2022-02-24 16:59:56 -08:00
Uli Schlachter
4fc72919e1 Merge branch 'mempool-overflow' into 'master'
Fix integer overflows in cairo-mempool

Closes #510

See merge request cairo/cairo!253
2022-02-24 14:35:17 +00:00
Uli Schlachter
2c24c18b14 Merge branch 'test-hairline' into 'master'
test/hairline.c: Use Unix line endings & add copyright header

See merge request cairo/cairo!234
2022-02-24 14:34:04 +00:00
Uli Schlachter
c2005c22e2 Merge branch 'chrstphrchvz-master-patch-67648' into 'master'
quartz: Fix spelling in comment

See merge request cairo/cairo!284
2022-02-23 16:18:51 +00:00
Christopher Chavez
04394d5b15 quartz: Fix spelling in comment 2022-02-23 13:12:35 +00:00
Uli Schlachter
2ec0a87403 Merge branch 'develop3' into 'master'
miscellaneous math fixes

See merge request cairo/cairo!280
2022-02-20 12:09:02 +00:00
Ayman El Didi
f83e0ed4e6 removed redundant casts in cairoint.h
In a couple of instances, ints are being casted to int before use.
2022-02-19 12:04:21 -07:00
Ayman El Didi
915dd79422 fixed some multiplications prone to overflowing their type
In a couple of instances, code is present where two numbers are being
multiplied in a type like unsigned int, but immediately being casted
to a wider type like size_t.

This means, although the result can be any size_t value, the
multiplication can potentially overflow before it's used because
unsigned int has a smaller range of values.

In another more niche case, I also cast to size_t before multiplying
a signed integer, since the result is immediately used as an argument
to memcpy, which would give memory corruption if the value was negative
anyway.
2022-02-19 11:59:41 -07:00
Uli Schlachter
cf75083941 Merge branch 'develop4' into 'master'
added missing documentation to cairo_font_options_status

See merge request cairo/cairo!281
2022-02-19 09:42:15 +00:00
Ayman El Didi
c932bb7ae7 added missing documentation to cairo_font_options_status
The documentation for cairo_font_options_status says it can return
either CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY, but the
implementation can also return CAIRO_STATUS_NULL_POINTER, which wasn't
mentioned.
2022-02-18 15:14:57 -07:00
Ayman El Didi
8f7d039801 fixed some comparisons between signed and unsigned integers
In some places, there were int variables being compared to unsigned
ints when they would never take a negative value, exposing some edge
cases that didn't need to be there.
2022-02-18 15:00:53 -07:00
Emmanuele Bassi
4d68059656 Merge branch 'meson-xml-option' into 'master'
meson: Add xml option and disable by default

See merge request cairo/cairo!275
2022-02-16 17:04:37 +00:00
David King
627aa65674 meson: Add xml option and disable by default
Just like autotools does.
2022-02-15 13:32:13 +00:00
Uli Schlachter
bdb4d05868 Merge branch 'user-font-subpixel-position' into 'master'
[user-font] Implement subpixel-positioning

See merge request cairo/cairo!274
2022-02-14 17:19:50 +00:00
Behdad Esfahbod
a62eea4aec [user-font] Implement subpixel-positioning
See:

https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033118545
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033125311
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1037765840

Basically the code in cairo-image-compositor.c:composite_glyphs()
is flooring glyph positions and putting some phase in the glyph-id.
This was being lost in the user-font backend. Fetch that and put it
in the recording-surface's device-transform translation, to be applied.
2022-02-13 14:34:24 -06:00
Behdad Esfahbod
c90faeb749 Merge branch 'mixed-color-clusters' into 'master'
Fix mixed color clusters

See merge request cairo/cairo!273
2022-02-13 05:08:03 +00:00
Matthias Clasen
65d4325e6f Fix mixed color clusters
When rendering clusters that have colored and non-colored
glyphs, we were falling back to using show_text_glyphs,
rendering all glyphs in the cluster without color.
Instead, make composite_one_color_glyph smart enough
to handle non-color glyphs, and only skip clusters
that are entirely non-color.

Testcase: hb-view AmiriQuranColored.otf -u 627,64e
2022-02-12 21:19:39 -06:00
Emmanuele Bassi
cd21fa0814 Merge branch 'fix-user-font-leaks' into 'master'
user-font: Plug some memory leaks

See merge request cairo/cairo!271
2022-02-11 11:59:03 +00:00
Emmanuele Bassi
396d258e41 Merge branch 'fix-rtl-color-glyphs' into 'master'
Fix rtl handling for color glyphs

Closes #533

See merge request cairo/cairo!272
2022-02-11 11:43:02 +00:00
Emmanuele Bassi
1bc922d045 Apply 1 suggestion(s) to 1 file(s) 2022-02-11 10:58:39 +00:00
Matthias Clasen
603cdf939f Fix rtl handling for color glyphs
When the run contains a mix of color and non-color
glyphs, composite_color_glyphs returns the non-color
glyphs unhandled in the same array. In the rtl case,
the glyphs are processed from the end and the unhandled
glyphs are accumulated at the end as well, and we
need to move them to the beginning of the array before
we return. Add the missing memmove call to do that.

Fixes: #533
2022-02-11 05:47:01 -05:00
Matthias Clasen
139f3f25b1 Plug another memory leak 2022-02-10 22:19:10 -05:00
Matthias Clasen
537445c4f0 user-font: Plug some memory leaks
We were leaking a cairo_t and a surface here, in
some code paths.
2022-02-10 21:17:58 -05:00
Emmanuele Bassi
fb3734fac0 Merge branch 'fix-build-when-pdf-is-disabled' into 'master'
meson: Fix build when PDF backend is disabled

See merge request cairo/cairo!269
2022-01-21 14:14:23 +00:00
Nirbheek Chauhan
57498b301c meson: Fix build when PDF backend is disabled
Symbols from cairo-tag-stack.c are used by cairo-tag-attributes.c, so
this should be in the same list of sources as that. Fixes this build
error:

```
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_array':
/path/to/cairo/_build/../src/cairo-tag-attributes.c:347: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_name':
/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:359: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o: in function `parse_attributes':
/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:410: undefined reference to `_cairo_tag_error'
/usr/bin/ld: /path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:431: undefined reference to `_cairo_tag_error'
/usr/bin/ld: /path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:441: undefined reference to `_cairo_tag_error'
/usr/bin/ld: src/libcairo.so.2.11705.0.p/cairo-tag-attributes.c.o:/path/to/cairo/cairo/_build/../src/cairo-tag-attributes.c:455: more undefined references to `_cairo_tag_error' follow
/usr/bin/ld: src/libcairo.so.2.11705.0: hidden symbol `_cairo_tag_error' isn't defined
```
2022-01-21 11:59:36 +05:30
Uli Schlachter
a6b2a39f36 Merge branch 'fix-doc-warning' into 'master'
Fix a doc comment

See merge request cairo/cairo!263
2022-01-12 16:52:45 +00:00
Uli Schlachter
5c9112b25e Merge branch 'meson-redundant-version_compare' into 'master'
meson: Remove useless version_compare()

See merge request cairo/cairo!267
2022-01-09 19:02:22 +00:00
Nirbheek Chauhan
e3b4db1645 meson: Remove useless version_compare()
We require meson 0.56 in project() now, all these are redundant.
2022-01-09 17:17:28 +05:30
Uli Schlachter
46c0b8bb4f Merge branch 'amos/win32-static-build' into 'master'
Set CAIRO_WIN32_STATIC_BUILD when doing a static build on windows

See merge request cairo/cairo!265
2022-01-01 19:37:24 +00:00
Amos Wenger
ca25e9860d Upgrade to expat-2.2.9-4 wrap
This provides the XML_STATIC definition when cairo is built as a static
library on Windows, see https://github.com/mesonbuild/wrapdb/pull/237
2021-12-08 13:36:07 +01:00
Amos Wenger
4d9657ad0d Set CAIRO_WIN32_STATIC_BUILD when doing a static build on windows 2021-12-07 12:13:02 +01:00
Uli Schlachter
ef149976e2 Fix a doc comment
This commit fixes the following warning from our check-def.sh:

PASS: check-def.sh
Checking documentation for incorrect syntax
./cairoint.h (523): ERROR: Get invalid doc id (should be 'cairo_...:')
./cairoint.h (534): ERROR: Get bad line: ' */'
./cairoint.h (534): ERROR: Get documentation comment not closed with **/

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-11-02 20:10:10 +01:00
Tim-Philipp Müller
a04786b933 Merge branch 'ci-update-windows-image-2' into 'master'
ci: bump windows image to latest

See merge request cairo/cairo!258
2021-10-07 14:29:57 +00:00
Tim-Philipp Müller
d3e0d27234 ci: update links in ci template from gst-ci to gstreamer monorep 2021-10-07 14:37:49 +01:00
Tim-Philipp Müller
e1646a7403 ci: bump windows image to latest
Which should include the subprojects cache again.
2021-10-07 14:32:55 +01:00
Adrian Johnson
b63dc83c8b Merge branch 'ci-update-windows-image' into 'master'
ci: update windows image and fix pixman build on android

Closes #515

See merge request cairo/cairo!257
2021-10-04 02:35:50 +00:00
Tim-Philipp Müller
ccb57d21ce ci: disable aarch64 neon asm in pixman to fix android build
To work around build failures, see #515
2021-10-03 13:17:49 +01:00
Tim-Philipp Müller
e3ba30bf7e ci: update windows image
Some root certs expired, which causes problems with letsencrypt
certificates, so update to latest image with updated certificates.

https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

Fixes #515
2021-10-03 12:47:31 +01:00
Adrian Johnson
d87fe096b9 Merge branch 'user-font-foreground-color' into 'master'
Support user fonts that use the foreground color

See merge request cairo/cairo!249
2021-09-20 09:01:58 +00:00
Adrian Johnson
8ea4ae5413 Allow user fonts to use the foreground color 2021-09-18 07:05:35 +09:30
Uli Schlachter
4f761bd5aa Merge branch 'fix-core-diff' into 'master'
Explicitly handle image formats in buffer_diff_core and pdiff_compare

Closes #25

See merge request cairo/cairo!243
2021-09-17 13:48:46 +00:00
Adrian Johnson
994e33215e Merge branch 'color-font-foreground-color' into 'master'
Support color fonts that use the foreground color

See merge request cairo/cairo!246
2021-09-16 21:47:25 +00:00
Adrian Johnson
23815978cc Merge branch 'master' into color-font-foreground-color 2021-09-17 06:25:07 +09:30
Adrian Johnson
4c520fea21 Merge branch 'custom-metadata' into 'master'
Add cairo_pdf_surface_set_custom_metadata()

See merge request cairo/cairo!240
2021-09-16 20:47:50 +00:00
Adrian Johnson
ffa2374b05 Merge branch 'large-pdf-file' into 'master'
Allow > 2GB PDF files on platforms with 32-bit long

See merge request cairo/cairo!251
2021-09-16 20:47:08 +00:00
Uli Schlachter
c0d2527ad0 Fix integer overflows in cairo-mempool
The expression "1 << whatever" has type int, no matter what the type of
"whatever" is. Thus, "1 << 31" ends up overflowing an "int" and
undefined behaviour occurs.

The above happened in cairo-mempool.c. I saw the following line:

  pool->free_bytes += 1 << (bits + pool->min_bits);

being executed with bits=15 and pool->min_bits=16, i.e. we had 1 << 31.
This ended up being INT_MIN due to the overflow. This was then promoted
to size_t and we ended up with a *huge* value being added to free_bytes.

This is obviously not the intended behaviour. Thus, this commit replaces
the "1" in all left shifts in cairo-mempool.c with "((size_t) 1)".

This fix avoids the integer overflow, but it does not fix issue #510,
because some allocation keeps the memory pool alive.

Related-to: https://gitlab.freedesktop.org/cairo/cairo/-/issues/510
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-09-15 18:02:05 +02:00