Commit graph

22 commits

Author SHA1 Message Date
Uli Schlachter
8d74c4d019 Speed up coverage-column-triangles test
This commit changes the height of the coverage-column-triangles test by
using a smaller height for the test. Previously the image was 40 pixels
in height and the test took 517 seconds for me. Now, the image has a
height of 4 pixels and the test takes 55 seconds.

This is possible since column_triangles() does the same thing for each y
coordinate. Thus, previously this test just did the same thing 40 times.

Times are measured with the backends I happened to have enabled locally:
script, xcb, xlib, image, recording.

Thanks a lot to Christian Rohlfs for coming up with this idea in
https://gitlab.freedesktop.org/cairo/cairo/-/issues/498#note_1700197

Possibly-fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/498
Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-30 16:36:22 +01:00
Uli Schlachter
35f2610f4d coverage.c: Use width/height arguments
The tests in coverage.c have #defines for WIDTH and HEIGHT, but also
have function arguments for these numbers. This commit changes the tests
to use the function arguments instead of the defines.

One complication is the rhombus test that already had a factor 2 between
these two numbers. A new variable is added to get back the previous
value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2022-12-30 09:29:10 +01:00
Andrea Canciani
654b4a8efe test: Fix coverage-intersecting-triangles reference
Commit 4e3ef57bc8 added
coverage-intersecting-triangles with an incorrect reference and
generator. The test checks the rasterization of two overlapping
triangles in the following position:

   .   .
   |\ /|
   | X |
   |/ \|
   .---.

Since the triangles have both vertical and horizontal sides of size
x/WIDTH, the expected coverage is 3/4 (75%) of (x/WIDTH)^2. The
original code, instead, was checking for a coverage of 0.75*x/WIDTH,
as if one of the sides was always 1 unit long.

The image and xlib backends still suffer from some jitter, caused by
the approximation of the actual coverage by means of sampling. For
this reason their references are still considered XFAIL, even though
their result now looks mostly consistent with the expected reference.
2015-04-08 14:32:17 +02:00
Chris Wilson
2144e7f48b test: Fix coverage-abutting
Using CAIRO_OPERATOR_OVER in case causes oversampling of the coincident
edges, to measure coverage we should only use ADD. :|

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:18:34 +01:00
Chris Wilson
0c42d5c176 test: Add another coverage example demonstrating the seams in tor
References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:15:33 +01:00
Chris Wilson
ff23afd5f2 test: Include coverage in the normal test run
Currently coverage is marked as slow. It is slower than the typical
test, but it is quite a useful check on our rasterisation quality
without going too far overboard (unlike partial-coverage!).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 12:25:56 +01:00
Chris Wilson
5c03b20732 test/coverage: Exercise invariance under mirror symmetry
Massimo noticed that the record/record-flip were not being rasterised as
identical mirror images due to a half-subpixel offset in the tor scan
converter. This test attempts to reproduce this error by rendering a
rhombus around the origin of each cell (that is it generates 4 mirror
images of a triangle in the 4 different orientations0. The expectation
is that each pixel in the group is lit identically as the coverage is
identical.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-29 08:42:17 +01:00
Chris Wilson
3d72b4aa70 test/coverage: The comment was still wrong.
Writing comments is hard. I give in.
2010-06-12 15:34:07 +01:00
Chris Wilson
b1e4df928f test/coverage: Refine comments
Joonas didn't like me putting incorrect labels in my comments. Said they
were misleading and worse than useless. Harsh.
2010-06-12 15:28:28 +01:00
Chris Wilson
968374b633 test/coverage: Add a comment describing the column_triangle geometry() 2010-06-12 15:14:17 +01:00
Chris Wilson
299263f8c9 test: Disable tests that are too slow to run by default.
Introduce a slow mode [-s] to the runner, and add "slow" to the
requirements for the very long running tests like the coverage stress
tests.
2010-06-12 14:06:06 +01:00
Chris Wilson
4e3ef57bc8 test: More coverage coverage.
A couple of different shapes that aim to test the tessellation side of
the rasterisers more... And worryingly there does seem to be an
unexpected systematic error.
2010-06-12 13:30:24 +01:00
Chris Wilson
c761e0c5bb test: Restrict the coverage tests to raster targets.
Typo inside the requirements failed to prevent the tests running on the
vector backends.
2010-06-11 12:40:36 +01:00
Chris Wilson
cf426bce8e test: Add a simple coverage test.
This test case should be much clearer than half-coverage over what it
purports to actually test. In each pixel, it draws a single geometric
primitive that coverages a known percentage of the pixel and then we
measure how close the rasterisers are to that ideal.
2010-06-11 10:05:09 +01:00
Owen Taylor
cea1de7579 src/cairo.[ch] doc/public/cairo-sections.txt: Add cairo_paint_with_alpha().
Fix segfault when mask == NULL.
test/mask.c test/mask-ref.png: Add testing of cairo_paint_with_alpha().
test/coverage.c test/coverage-ref.png: Remove ... it's not testing anything that mask doesn't test better.
2005-05-06 12:00:22 +00:00
Carl Worth
828094aef8 and delete:
cairo_set_pattern -> cairo_set_source cairo_get_pattern -> cairo_get_source cairo_set_rgb_color -> cairo_set_source_rgb
-> cairo_set_source_rgba cairo_set_alpha -> cairo_get_alpha ->
Note that we'll likely want to add cairo_set_source_surface.
Add _cairo_stock_color helper function. Improve some interfaces:
_cairo_color_init _cairo_color_init_rgb _cairo_color_set_rgb -> _cairo_color_init_rgba _cairo_color_set_alpha _cairo_color_multiply_alpha
_cairo_color_get_rgb -> _cairo_color_get_rbga _cairo_color_get_rgba_premultiplied
Add cairo_stock_t and some helper macros:
CAIRO_COLOR_WHITE CAIRO_COLOR_BLACK CAIRO_COLOR_TRANSPARENT
Fix cairo_pattern_t by eliminating pattern->alpha. Fix cairo_solid_pattern_t to use cairo_color_t rather than three doubles.
Track removal of pattern->alpha, simplifying the code considerably
Track _cairo_color interface changes. Remove gstate->alpha. Propagate down set_source renamings.
cairo_pattern_add_color_stop -> cairo_pattern_add_color_stop_rgba
and add:
cairo_pattern_add_color_stop_rgb
Remove pattern->alpha, simplifying the code considerably.
Track pattern and color interface changes.
Add const where appropriate on cairo_color_t*.
Add private type inspection predicate. (cairo_xlib_surface_set_size): Add check for surface type mismatch, (no useful error reporting yet, though).
Note coverage as en expected failure.
Improve line wrap on expected failure messages.
Port all tests to new cairo_set_source interfaces.
2005-04-14 14:42:26 +00:00
Carl Worth
f3af02bb0e Temporarily remove all text from this test case until we come up with an approach for drawing the same text with different freetype configurations. 2005-04-13 14:24:20 +00:00
Owen Taylor
ac6f15e245 src/cairo.[ch] src/cairoint.h src/cairo-gstate.c docs/public/cairo-sections.txt: cairo_select_font() => cairo_select_font_face() cairo_scale_font() => cairo_set_font_size() cairo_transform_font() => cairo_set_font_matrix() Add cairo_get_font_matrix(). Make cairo_set_font_face() not reset the font matrix. Default the font matrix to SCALE(10). Document cairo_select_font_face().
test/text-cache-crash.c (draw) test/text-rotate.c (draw): Use cairo_set_font_size().
src/cairo-font.c src/cairo.h: Fix up some parameter names for docs.
2005-04-07 13:29:32 +00:00
Carl Worth
35b9e3c45d More _/- renames in the test directory. 2005-03-29 00:02:19 +00:00
Carl Worth
c3bd9b1b8d Change the draw function under test to return a cairo_test_status_t so that it can indicate test failure even if there is no result image. 2005-03-09 13:58:20 +00:00
Kristian Høgsberg
79d9b82ff3 Set alpha to 1 before setting clip mask.
Added the right reference PNG. Running test against stock 0.3.0 gives the expected results.
2005-01-26 14:21:53 +00:00
Kristian Høgsberg
d4fb5c9240 New test case, covering various combinations of pattern types, drawing operations and clipping. Currently fails, for some combinations, coverage-ref.png is just a placeholder.
Added this PNG from cairo-snippets to use for pattern fills.
expose PNG loading to test cases.
2005-01-26 13:41:55 +00:00