2 * Copyright 2009 Chris Wilson
3 * Copyright 2011 Intel Corporation
5 * Permission to use, copy, modify, distribute, and sell this software
6 * and its documentation for any purpose is hereby granted without
7 * fee, provided that the above copyright notice appear in all copies
8 * and that both that copyright notice and this permission notice
9 * appear in supporting documentation, and that the name of
10 * Chris Wilson not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. Chris Wilson makes no representations about the
13 * suitability of this software for any purpose. It is provided "as
14 * is" without express or implied warranty.
16 * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
19 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
22 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 * Author: Chris Wilson <chris@chris-wilson.co.uk>
27 #include "cairo-test.h"
32 static void clip_mask (cairo_t *cr)
34 cairo_move_to (cr, 10, 0);
35 cairo_line_to (cr, 0, 10);
36 cairo_line_to (cr, 10, 20);
37 cairo_line_to (cr, 20, 10);
41 static cairo_test_status_t
42 draw (cairo_t *cr, int width, int height)
44 cairo_set_source_rgb (cr, 1, 1, 1);
48 cairo_set_source_rgb (cr, 0, 1, 0);
50 cairo_reset_clip (cr);
52 cairo_set_source_rgb (cr, 1, 0, 0);
54 cairo_rectangle (cr, 0, 0, 4, 4);
58 cairo_reset_clip (cr);
60 cairo_rectangle (cr, 20, 0, -4, 4);
64 cairo_reset_clip (cr);
66 cairo_rectangle (cr, 20, 20, -4, -4);
70 cairo_reset_clip (cr);
72 cairo_rectangle (cr, 0, 20, 4, -4);
76 cairo_reset_clip (cr);
78 cairo_set_source_rgb (cr, 0, 0, 1);
80 cairo_rectangle (cr, 8, 8, 4, 4);
84 cairo_reset_clip (cr);
86 return CAIRO_TEST_SUCCESS;
89 CAIRO_TEST (clip_intersect,
90 "Tests intersection of a simple clip with a clip-mask",
91 "clip, paint", /* keywords */
92 NULL, /* requirements */