2 * Permission is hereby granted, free of charge, to any person
3 * obtaining a copy of this software and associated documentation
4 * files (the "Software"), to deal in the Software without
5 * restriction, including without limitation the rights to use, copy,
6 * modify, merge, publish, distribute, sublicense, and/or sell copies
7 * of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be
11 * included in all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
17 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "cairo-test.h"
25 static cairo_pattern_t *
26 create_pattern (cairo_surface_t *target)
28 cairo_surface_t *surface;
29 cairo_pattern_t *pattern;
33 surface = cairo_surface_create_similar(target,
34 cairo_surface_get_content (target),
36 cr = cairo_create (surface);
37 cairo_surface_destroy (surface);
39 cairo_set_source_rgb (cr, 0, 1, 0);
42 pattern = cairo_pattern_create_for_surface (cairo_get_target (cr));
45 cairo_matrix_init_translate (&m, 0, 0.1); // y offset must be non-integer
46 cairo_pattern_set_matrix (pattern, &m);
50 static cairo_test_status_t
51 draw (cairo_t *cr, int width, int height)
53 cairo_pattern_t *pattern;
55 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
57 cairo_set_source_rgb (cr, 1, 0, 0);
61 cairo_move_to (cr, 10, 400.1);
62 cairo_line_to (cr, 990, 400.1);
63 cairo_line_to (cr, 990, 600);
64 cairo_line_to (cr, 10, 600);
65 cairo_close_path (cr);
67 pattern = create_pattern (cairo_get_target (cr));
68 cairo_set_source (cr, pattern);
69 cairo_pattern_destroy (pattern);
73 return CAIRO_TEST_SUCCESS;
76 CAIRO_TEST (bug_source_cu,
77 "Exercises a bug discovered in the tracking of unbounded source extents",
78 "fill", /* keywords */
79 NULL, /* requirements */