Commit graph

11916 commits

Author SHA1 Message Date
Anton Danilkin
d397ab6d10 Change the default SVG unit to user unit 2021-04-11 23:59:47 +02:00
Anton Danilkin
f85834a1f5 Do not use the style attribute 2021-04-11 23:59:47 +02:00
Anton Danilkin
71eef9c8bc Implement the rest of the operators 2021-04-11 23:59:47 +02:00
Anton Danilkin
0df89ca8d8 Implement most of the non-blending operators 2021-04-11 23:59:47 +02:00
Anton Danilkin
e728eb43de Implement the in operator 2021-04-11 23:59:47 +02:00
Anton Danilkin
961db5b846 Implement operators for the rest of operations 2021-04-11 23:59:47 +02:00
Anton Danilkin
1a03d883ab Implement operators for the mask operation 2021-04-11 23:59:47 +02:00
Anton Danilkin
a89960a67c Add support for the source and clear operators for the paint operation 2021-04-11 23:59:47 +02:00
Anton Danilkin
f6f73ba836 Add a layer of indiraction to calls to the clipper 2021-04-11 23:59:47 +02:00
Anton Danilkin
daeb9736e9 Update the analyze mode of operations 2021-04-11 23:59:47 +02:00
Anton Danilkin
2a9e189410 Remove the use of extra_attributes 2021-04-11 23:59:47 +02:00
Anton Danilkin
d59c7fb71f Remove the use of discard_filter 2021-04-11 23:59:47 +02:00
Anton Danilkin
0cddf4769c Introduce _cairo_svg_surface_svg_clip_or_svg_mask_should_be_used 2021-04-11 23:59:47 +02:00
Anton Danilkin
7a21a930e9 Add warning supression in one place and remove them in others 2021-04-11 23:59:47 +02:00
Anton Danilkin
3b6ea32854 Do not check the status after creating a memory stream
As we do not check the status after _cairo_output_stream_printf
and _cairo_memory_stream_copy (which are more common operations)
anyway.

This simplifies the code, but keeps it correct, as the status
will be propagated anyway, just a bit later.
2021-04-11 23:59:47 +02:00
Anton Danilkin
170fa0f9bb Fix using signed types where unsigned ones were needed 2021-04-11 23:59:47 +02:00
Anton Danilkin
7ade55ac5b Add new SVG filters system 2021-04-11 23:59:47 +02:00
Anton Danilkin
b340dc19f2 Fix emitting black background for color-only non-bounded SVG surfaces 2021-04-11 23:59:47 +02:00
Anton Danilkin
fa5179e9fd Add a test with operator samples from https://cairographics.org/operators/ 2021-04-11 23:59:47 +02:00
Anton Danilkin
170f8812fb Add a test for #361 2021-04-11 23:59:47 +02:00
Anton Danilkin
9563d6b661 Ignore .idea, compile_commands.json and /build 2021-04-11 23:59:47 +02:00
Anton Danilkin
18c0196414 Fix generating syntactically invalid SVG files 2021-04-11 23:59:47 +02:00
Anton Danilkin
8c08f499bd Fix problems in the SVG backend related to outputting surfaces and patterns
Now the SVG surface should work correctly work with bounded and unbounded image (-like) and recording surfaces with NONE and REPEAT extends as source for all operations.

Fill or stroke with an unbounded surface as source now means using clip or mask respectively.

Fix using unitialized memory in the SVG surface.

Also fix unintialized memory and working with offsetted images in the recording surface.
2021-04-11 23:59:47 +02:00
Heiko Lewin
277a1daec8 Merge branch 'type1_find_segments_bounds_check' into 'master'
Fix out of bounds access in cairo_type1_font_subset_find_segments

See merge request cairo/cairo!146
2021-04-11 16:35:03 +00:00
Uli Schlachter
1484cfa551 Fix out of bounds access in cairo_type1_font_subset_find_segments
This function parses some raw font data and it trusts the font to be
well-formed. This means that a font can just say "this segment is a
gigabyte large" and the code will happily jump ahead in memory. Bad
things then happen in practice.

Fix this by adding lots of bounds check.

Also, an existing bounds check makes sure we are still before the end of
the data, but then happily reads the next six bytes. Fix this by making
sure we actually have six bytes of data.

No regression test since the last few times I tried to do this for font
issues, I ended up with a large/huge blob of font data. Too large for
the test suite.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27969
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-11 16:35:02 +00:00
Uli Schlachter
26663cf3be Merge branch 'fix_obvious_ub' into 'master'
Fix undefined left-shifts

See merge request cairo/cairo!149
2021-04-11 05:37:49 +00:00
Heiko Lewin
3ca8a46caf Minor corrections 2021-04-11 02:07:10 +02:00
Uli Schlachter
1904d7bf35 Merge branch 'fix-467' into 'master'
Rename cairo_lines_compare_at_y into _cairo_lines_compare_at_y and fix syntax

Closes #467

See merge request cairo/cairo!150
2021-04-02 13:43:39 +00:00
Marc Jeanmougin
d2a37ba60e
Rename cairo_lines_compare_at_y into _cairo_lines_compare_at_y and fix syntax
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/467
2021-04-02 14:35:46 +02:00
Heiko Lewin
518ba13779 Fix undefined left-shifts 2021-03-31 12:20:34 +02:00
Uli Schlachter
44f808fce9 Merge branch 'use-after-scope' into 'master'
Avoid a use-after-scope

Closes #453

See merge request cairo/cairo!143
2021-03-25 15:51:32 +00:00
Uli Schlachter
33cce5dc37 Merge branch 'pdf-mime-data' into 'master'
"Fix" the pdf-mime-data test

See merge request cairo/cairo!142
2021-03-25 15:51:13 +00:00
Uli Schlachter
c48ea2737c Merge branch 'serial-test-harness' into 'master'
Use the serial automake test harness

See merge request cairo/cairo!138
2021-03-25 15:50:44 +00:00
Uli Schlachter
5090dc3f4a Merge branch 'flush-in-tests' into 'master'
test suite: fflush() before fork()

See merge request cairo/cairo!139
2021-03-25 15:50:22 +00:00
Uli Schlachter
f5a4ec8ada Merge branch 'mime-unique-id' into 'master'
Fix the mime-unique-id test for me

See merge request cairo/cairo!141
2021-03-25 15:49:50 +00:00
Tim-Philipp Müller
104dfd8b04 Merge branch 'ci-bump-windows-image' into 'master'
ci: bump windows image to latest version to fix github ssl certificate issues

See merge request cairo/cairo!148
2021-03-22 11:22:09 +00:00
Tim-Philipp Müller
b40b1afaec ci: bump windows image to latest version to fix github ssl certificate issues 2021-03-20 16:16:27 +00:00
Tim-Philipp Müller
f604b4ba92 Merge branch 'gyf-table-leak' into 'master'
Fix a leak in an error path

See merge request cairo/cairo!144
2021-03-10 16:57:08 +00:00
Tim-Philipp Müller
b718dae717 Merge branch 'meson-make-cairo-trace-executable' into 'master'
meson: make cairo-trace executable

Closes #462

See merge request cairo/cairo!145
2021-03-09 19:08:29 +00: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
Uli Schlachter
2af4412aa3 Fix a leak in an error path
Tested with valgrind. Before this patch, I got the following "definitely
lost" entry, which is gone afterwards:

94,416 bytes in 1 blocks are definitely lost in loss record 427 of 427
   at 0x483877F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4B053F8: cairo_truetype_font_write_glyf_table (cairo-truetype-subset.c:625)
   by 0x4B06219: cairo_truetype_font_generate (cairo-truetype-subset.c:991)
   by 0x4B06917: cairo_truetype_subset_init_internal (cairo-truetype-subset.c:1159)
   by 0x4B06D72: _cairo_truetype_subset_init_pdf (cairo-truetype-subset.c:1255)
   by 0x4B6B113: _cairo_pdf_surface_emit_truetype_font_subset (cairo-pdf-surface.c:5892)
   by 0x4B6C2AD: _cairo_pdf_surface_emit_unscaled_font_subset (cairo-pdf-surface.c:6366)
   by 0x4B02FC7: _cairo_sub_font_collect (cairo-scaled-font-subsets.c:741)
   by 0x4B03A7A: _cairo_scaled_font_subsets_foreach_internal (cairo-scaled-font-subsets.c:1062)
   by 0x4B03B21: _cairo_scaled_font_subsets_foreach_unscaled (cairo-scaled-font-subsets.c:1090)
   by 0x4B6C3ED: _cairo_pdf_surface_emit_font_subsets (cairo-pdf-surface.c:6412)
   by 0x4B62B1A: _cairo_pdf_surface_finish (cairo-pdf-surface.c:2222)

To reproduce, run the test case from the below link.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28023
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-09 11:14:09 +01:00
Uli Schlachter
e5b9d96f22 Avoid a use-after-scope
This is the same fix as commit b345be5afe, but in a different place in
the same file.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/453
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-09 07:53:50 +01:00
Uli Schlachter
2f25fa68c0 test/pdf-mime-data.c: Check for pdfimages
Currently, the pdf-mime-data check just fails for me with the following
output:

    sh: 1: pdfimages: not found
    pdf-mime-data: FAIL

pdf-mime-data.log contains:

    pdfimages failed with exit status 32512

Since I do not have pdfimages installed... yeah.

This commit "fixes" that problem by skipping the test if pdfimages is
not available. No idea if it would pass if it were available, but I do
not feel like installing pdfimages just to test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:31:37 +01:00
Uli Schlachter
2a8d90c6fc pdf-mime-data: Fix for out-of-tree builds
This makes the code use the existing helper for loading PNGs that also
considers the $srcdir environment variable. This makes it find the file
in out of tree builds.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:27:52 +01:00
Uli Schlachter
0c64c216aa pdf-mime-data: Fix error checking
I am not quite sure, but an if for "ignore this error if something
failed" seems wrong. Either this should have compared against status2 or
checked for success. This commit fixes the code for the latter.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 17:26:50 +01:00
Uli Schlachter
433d9eb109 Update the PDF size limit in mime-unique-id
The test mime-unique-id checks that some images are only embedded once
in a PDF. It does so by checking if the file size is within some
expected bounds. However, the test fails for me because the file is too
small. Yes, too *small*.

Fix this by updating the test to expect my current file size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:30:33 +01:00
Uli Schlachter
0fd2197e2b test/mime-unique-id: Fix for out-of-tree builds
Instead of failing because it did not find an image, this now fails for
me since the PDF is too small (???).

This new code is modelled after cairo_test_create_surface_from_png().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 16:28:51 +01:00
Uli Schlachter
446d3972e5 test suite: fflush() before fork()
Forking a process also duplicates the buffers of FILE*s. Thus, if there
is pending data, both the parent and the child process will write
things. This is seldom a good idea.

This issue was not noticed so far since by default the test suite
already calls fflush() a lot. However, when stdout and stderr are both
not a tty (according to isatty(1) and isatty(2)), these flushes are
skipped. The result is that the child process repeat the full output
from the test suite starting with "Compiled against cairo 1.17.4,
running on 1.17.4."

To reproduce this problem run: ./cairo-test-suite 2>&1 | cat

Fix this by flushing all the files that I managed to find before fork().

Thanks to Pekka Paalanen for helping me figure this out.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-03-08 13:45:07 +01:00
Uli Schlachter
7788000be0 Merge branch 'meson-allow-skipping-of-run-check-for-ipc-rmid-deferred-release-in-cross-build' into 'master'
meson: allow skipping of run check for IPC_RMID_DEFERRED_RELEASE

Closes #408

See merge request cairo/cairo!134
2021-03-05 08:08:55 +00:00
Tim-Philipp Müller
71ece6d149 Merge branch 'alatiera/exclude-artifacts' into 'master'
ci: cleanup the autotools artifacts a bit

Closes #465

See merge request cairo/cairo!137
2021-03-04 11:09:29 +00:00