2 * Copyright © 2009 Jeff Muizelaar
3 * Copyright © 2009 Chris Wilson
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting documentation, and
9 * that the name of the copyright holders not be used in advertising or
10 * publicity pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no representations
12 * about the suitability of this software for any purpose. It is provided "as
13 * is" without express or implied warranty.
15 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 #include "cairo-test.h"
27 static cairo_test_status_t
28 draw (cairo_t *cr, int width, int height)
34 cairo_surface_t *shadow;
38 cairo_set_source_rgb (cr, 1, 1, 1);
41 cairo_translate (cr, 130, 130);
42 cairo_rotate (cr, .5);//2*M_PI*angle/360);
43 cairo_rectangle (cr, 0, 0, 50, 100);
44 cairo_get_matrix (cr, &m);
46 shadow = cairo_surface_create_similar (cairo_get_target (cr),
47 CAIRO_CONTENT_COLOR_ALPHA,
50 cairo_surface_set_device_offset (shadow, xoffset, yoffset);
51 shadow_cr = cairo_create (shadow);
52 cairo_surface_destroy (shadow);
54 cairo_set_source_rgb (shadow_cr, 0, 1, 0);
55 cairo_set_matrix (shadow_cr, &m);
57 path = cairo_copy_path (cr);
58 cairo_new_path (shadow_cr);
59 cairo_append_path (shadow_cr, path);
60 cairo_fill (shadow_cr);
61 cairo_path_destroy (path);
63 cairo_identity_matrix (cr);
64 cairo_translate (cr, 10, 50);
65 cairo_set_source_surface (cr, cairo_get_target (shadow_cr), 0, 0);
67 cairo_set_matrix (cr, &m);
68 cairo_set_source_rgb (cr, 1, 0, 0);
71 cairo_destroy (shadow_cr);
73 return CAIRO_TEST_SUCCESS;
76 CAIRO_TEST (path_append,
77 "Test appending path to a context, in particular to exercise a regression in 005436",
78 "path", /* keywords */
79 NULL, /* requirements */