Opensource Compliance Issue.
[platform/core/graphics/cairo.git] / test / huge-radial.c
1 /*
2  * Copyright © 2006 Benjamin Otte
3  * Copyright © 2009 Chris Wilson
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  *
25  * Author: Benjamin Otte <otte@gnome.org>
26  *         Chris Wilson <chris@chris-wilson.co.uk>
27  */
28
29 #include "cairo-test.h"
30
31 /* set this to 0.1 to make this test work */
32 #define FACTOR 1.e6
33
34 /* XXX poppler-cairo doesn't handle gradients very well... */
35
36 static cairo_test_status_t
37 draw (cairo_t *cr, int width, int height)
38 {
39     cairo_pattern_t *pattern;
40     cairo_matrix_t mat = {
41         0, -4.5254285714285709 * FACTOR,
42         -2.6398333333333333 * FACTOR, 0,
43         0, 0
44     };
45
46     pattern = cairo_pattern_create_radial (0, 0, 0,
47                                            0, 0, 16384 * FACTOR);
48     cairo_pattern_add_color_stop_rgba (pattern,
49                                        0, 0.376471, 0.533333, 0.27451, 1);
50     cairo_pattern_add_color_stop_rgba (pattern, 1, 1, 1, 1, 1);
51     cairo_pattern_set_matrix (pattern, &mat);
52
53     cairo_scale (cr, 0.05, 0.05);
54     cairo_translate (cr, 6000, 3500);
55
56     cairo_set_source (cr, pattern);
57     cairo_rectangle (cr, -6000, -3500, 12000, 7000);
58     cairo_pattern_destroy (pattern);
59     cairo_fill (cr);
60
61     return CAIRO_TEST_SUCCESS;
62 }
63
64 CAIRO_TEST (huge_radial,
65             "Test huge radial patterns",
66             "gradient, radial", /* keywords */
67             NULL, /* requirements */
68             600, 350,
69             NULL, draw)