Commit graph

2310 commits

Author SHA1 Message Date
Adrian Johnson
616c300cd3 view-test-results.py: try up to 10 ports 2022-05-28 16:16:06 +09:30
Adrian Johnson
e7da8451f8 Update long-lines test 2022-05-28 16:14:31 +09:30
Adrian Johnson
29acc55849 Make it easier for cairo-test-suite to find the source dir 2022-05-19 06:44:58 +09:30
Adrian Johnson
6fec25a51f python script to view tests results
testtables.js no longer works in modern browsers as local file access
has been disabled. This script runs a python http server that serves
the contents of the current directory then opens the test results in
the webbrowser
2022-05-17 16:49:02 +09:30
Adrian Johnson
455a4cca54 Merge branch 'quartz-core-text' into 'master'
quartz: support rendering colored bitmap fonts

See merge request cairo/cairo!289
2022-04-27 00:04:43 +00:00
John Ralls
cfb3835f57 [quartz] Add wiggle test for quartz emoji. 2022-04-26 15:52:04 -07:00
John Ralls
2784159d0e [quartz] Adjust x_extents metric.
CoreText uses different advances depending on the font size, with very
small point sizes sometimes getting advances that are smaller than the
glyph's width. This is manifested in the Apple Color Emoji font with the
Emoji glyphs having a width of 1.25 and an advance width of 1.0. That
results in overlapping emoji when they're in a string.

The small spacing difference also affects 3 tests so updated reference
images are included in this commit.

 # Please enter the commit message for your changes. Lines starting
2022-04-25 11:30:10 -07:00
Adrian Johnson
4815949d2f Fix the scaled_glyph_init color glyph logic
and split _cairo_user_scaled_glyph_init() into multiple functions.

Update user-font test to test changing foreground text color.
2022-04-25 17:08:07 +09:30
John Ralls
c6dc5df612 [quartz] Convert font handling from CGFont to CTFont. 2022-04-24 13:08:48 -07:00
Adrian Johnson
083ff4b511 Merge branch 'color-font-vector-surface' into 'master'
Paint color glyphs in fallback resolution on vector surfaces

See merge request cairo/cairo!293
2022-04-24 12:26:20 +00:00
luz paz
25d588e6c0 Fix typos in doxygen and source comments 2022-03-28 16:43:03 -04:00
Uli Schlachter
63973958bc Add an rgb24 ref image for alpha similar
This commit copies the current alpha-similar.image.rgb24.out.png to
alpha-similar.rgb24.ref.png to make the test pass.

This failure goes back to commits 6647511 / 049060 which changed the
image comparison in the test suite. Previously, transparent "nothing"
and black compared equal, but said commits fixed that. Thus, having a
special reference image with black instead of transparency is the right
fix.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-03-13 16:14:48 +01:00
Uli Schlachter
6a81bf8201 script: Implement device finish
Before this commit, calling cairo_device_finish() on a cairo-script
context did not actually do anything in the backend. Thus, it was
possible to continue emitting output on the script context even after it
was finished, which means that API user had no way of preventing
use-after-free bugs in their write callback. Bug 277 triggers this via
detaching a snapshot, but I guess one could also simply continue drawing
to a script surface.

This commit implements the finish function by closing the underlying
stream.

However, that was not enough to fix things. This commit also turns
writing into a stream into a no-op after the stream was closed.

I checked that the new test case actually fails before this commit and
is indeed fixed by it.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/277
Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-03-08 18:11:23 +01:00
Adrian Johnson
5018120af0 Update ref images 2022-03-05 11:51:55 +10:30
Adrian Johnson
1a799577b2 Merge branch 'issue-526' into 'master'
pdf: ensure urls and filename strings are correctly encoded

Closes #526

See merge request cairo/cairo!266
2022-02-27 03:51:50 +00:00
Uli Schlachter
1781e59c57 Merge branch 'drop-backends' into 'master'
Remove old backends

See merge request cairo/cairo!285
2022-02-25 15:44:51 +00:00
Emmanuele Bassi
64db153c43 Drop OS/2 support
OS/2 support was last built in Cairo 1.12, which was released 10 years
ago.

Additionally, OS/2 is not supported by Meson.
2022-02-25 01:44:57 +00:00
John Ralls
2e0075e265 [quartz] Don't use CGContextDrawTiledImage for tiled patterns.
CGContextDrawTiledImage turned up as a significant time-user while
profiling a benchmark created to evaluate
https://gitlab.gnome.org/GNOME/gtk/-/issues/3714. Without this commit
the benchmark is able to perform a mean frame rate of 2.19 frames per
second with a standard deviation of 0.09; with the commit the mean frame
rate is 2.37 fps, s.d. 0.30, both over 15 10-second samples. Student's
t-test reports a 9.8% likelyhood that the two represent the same
distribution.
2022-02-24 17:00:07 -08: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
01c93c7f36 Fix bug #535 in cairo-script
cairo-script has a special case for drawing a set of rectangles. The
rectangle detection can trip over a "degenerate rectangle": Just a
horizontal line. It detects the line as the beginning of a rectangle and
then claims CAIRO_STATUS_INVALID_PATH_DATA when the other sides of the
rectangle are missing.

This commit simply changes the return value to
CAIRO_INT_STATUS_UNSUPPORTED to trigger a fallback to the generate case.

Test case is a straight-forward adaption from the original bug report.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/535
2022-02-16 17:53:49 +01: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
Adrian Johnson
895b249b0a pdf: ensure filenames are correctly encoded 2022-01-16 13:49:53 +10:30
Uli Schlachter
d6180c2457 Add missing ref image for clip-unbounded
This commit copies clip-unbounded.base.rgb24.ref.png to
clip-unbounded.rgb24.ref.png. This makes the test pass for rgb24
targets.

This failure goes back to commits 6647511 / 049060 which changed the
image comparison in the test suite. Previously, transparent "nothing"
and black compared equal, but said commits fixed that. Thus, having a
special reference image with black instead of transparency is the right
fix.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-10-19 18:41:47 +02: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
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
918fe02666 Merge branch 'ming-warnings' into 'master'
Fix some MinGW warnings

See merge request cairo/cairo!247
2021-09-02 20:36:19 +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
Manuel Stoeckl
6647511593 test: explicitly handle image formats in buffer_diff_core
In practice, the A and B images may be any mixture of RGB24 and
ARGB32 formats, so this change accepts all combinations of these
types, and converts the pixel values to a common (ARGB32) format
as needed.

Some of the newly added test failures are cases where the image
output is RGB24, but the matching reference image is ARGB32 with
noticeable transparency. Some of the newly passing tests are cases
where the unused 'alpha' channel of an RGB24 image was not equal
to 0xff, and the previous code had incorrectly used this channel
in max_diff calculations.
2021-08-29 11:57:30 -04:00
Manuel Stoeckl
0490607584 pdiff: convert RGB24 image values to ARGB32 on read
To avoid reading a potentially garbage alpha channel when users
of pdiff_compare pass in RGB24 images, if the format is RGB24,
force the alpha channel to be 0xff.

This commit also updates CI to adjust for the new tests that have
started/stopped failing. New failures often are cases where
the reference image has alpha transparency, but the test output
does not; new passing tests may indicate that the unused alpha
channel of an RGB24 image was garbage, but now is ignored.
2021-08-29 11:56:27 -04:00
Tim-Philipp Müller
b1135db014 test: update quartz ref image to fix macos pthread test failure
The proper pthread check activated some tests that weren't active
before, which resulted in a test failure apparently caused by
inexact test rendering.

Update the quartz reference image accordingly.
2021-08-28 12:57:17 +01:00
Tim-Philipp Müller
e78a90ed98 meson: enable pthread tests if 'real pthread' is available
Fixes #477
2021-08-28 12:53:43 +01:00
Adrian Johnson
e73f236da6 Update user-font-mask ref images 2021-08-28 09:19:09 +09:30
Adrian Johnson
5e76dd7a5c Merge branch 'fix-comparison-warning' into 'master'
Fix comparison is always false in malloc overflow check

See merge request cairo/cairo!236
2021-08-27 23:44:08 +00:00
Adrian Johnson
a8c8363e35 Add overflow to Makefile.sources 2021-08-26 21:05:55 +09:30
Adrian Johnson
068e9b2eb4 Fix malloc overflow check warning
To fix this warning:

../src/cairo-malloc-private.h:83:32: warning: comparison is always false due to limited range of data type [-Wtype-limits]
   83 |   ((size) != 0 && (size_t) (a) >= SIZE_MAX / (size_t) (size) ? NULL : \
      |                                ^~

Create two new macros to do the overflow checks:
_cairo_addl_size_t_overflow and _cairo_mul_size_t_overflow. Implement
them using compiler builtins where available.

Update cairo-malloc-private to use these fuctions and add an overflow
test to test the functions.
2021-08-24 07:26:35 +09:30
Adrian Johnson
0d809e8051 Fix file mode of mime_unqiue-id.c 2021-08-24 07:26:35 +09:30
Adrian Johnson
0ce4c0fc29 Add cairo_pdf_surface_set_custom_metadata() 2021-08-22 13:43:34 +09:30
Adrian Johnson
78d267ee7a Fix some warnings 2021-08-22 12:07:36 +09:30
Uli Schlachter
b166db8ad9 test/hairline.c: Add copyright header
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-15 10:11:28 +02:00
Uli Schlachter
0e468cf921 test/hairline.c: Use Unix line endings
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-08-15 10:10:31 +02:00
Adrian Johnson
c773060195 Merge branch 'HairlineStroke' into 'master'
Added hairline support to cairo

See merge request cairo/cairo!21
2021-08-15 06:58:54 +00:00
Rick Yorgason
ecec0419f8 Added hairline support to cairo 2021-08-15 06:58:54 +00:00
Adrian Johnson
6ea9ec75ed Merge branch 'issue-389' into 'master'
Add color user-font support

See merge request cairo/cairo!223
2021-08-14 06:06:20 +00:00
Adrian Johnson
62cc53f9b8 Add color user-font support
Adds new API cairo_user_font_face_set_render_color_glyph_func()
to set a color glyph renderer.
2021-08-14 06:06:19 +00:00
Rick Yorgason
ada76e80db Fixed compile-time error on platforms without MMAP. 2021-08-01 17:34:14 -07:00
Adrian Johnson
7c6f2d4f24 Add ft-color-font test 2021-07-31 08:56:59 +09:30
Adrian Johnson
ca1fb44dd3 pdf links: fix forward references to dest names with 'internal' flag 2021-07-29 07:31:31 +09:30
Adrian Johnson
4e3f6bf0c2 Merge branch 'pdf-object-streams' into 'master'
pdf: use cross-reference stream for PDF >= 1.5

See merge request cairo/cairo!197
2021-07-28 20:27:45 +00:00