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>
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>
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.
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>
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>
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>
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.
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.
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.
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.
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.