| 1 | /* |
| 2 | * Copyright © 2005 Red Hat, Inc. |
| 3 | * Copyright © 2009 Chris Wilson |
| 4 | * |
| 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 | * Red Hat, Inc. not be used in advertising or publicity pertaining to |
| 11 | * distribution of the software without specific, written prior |
| 12 | * permission. Red Hat, Inc. makes no representations about the |
| 13 | * suitability of this software for any purpose. It is provided "as |
| 14 | * is" without express or implied warranty. |
| 15 | * |
| 16 | * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
| 17 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 18 | * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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. |
| 23 | * |
| 24 | * Author: Carl D. Worth <[email protected]> |
| 25 | * Chris Wilson <[email protected]> |
| 26 | */ |
| 27 | |
| 28 | #include "cairo-test.h"cxx . . $ `<file>/test/cairo-test.h`/ |
| 29 | |
| 30 | #define SIZEcxx . . $ `test/degenerate-rel-curve-to.c:30:9`! 30 |
| 31 | |
| 32 | /* Another attempt at avoiding unnecessary splines was made, where |
| 33 | * a curve-to that ended on the same point as it began were discarded. |
| 34 | * The same bug was made to rel-curve-to as well, hence this test. |
| 35 | */ |
| 36 | static cairo_test_status_tcxx . . $ cairo_test_status_t# |
| 37 | drawcxx . . $ draw(af37fefdaf43f036). (cairo_tcxx . . $ cairo_t# *cr, int width, int height) |
| 38 | { |
| 39 | cairo_set_source_rgbcxx . . $ cairo_set_source_rgb(2bdc80def475f266). (cr, 1.0, 1.0, 1.0); /* white */ |
| 40 | cairo_paintcxx . . $ cairo_paint(21788b7825b29bf). (cr); |
| 41 | |
| 42 | cairo_set_line_widthcxx . . $ cairo_set_line_width(74853563bcf87c34). (cr, 1.0); |
| 43 | cairo_set_line_capcxx . . $ cairo_set_line_cap(d77e63337584009). (cr, CAIRO_LINE_CAP_BUTTcxx . . $ CAIRO_LINE_CAP_BUTT.); |
| 44 | cairo_set_line_joincxx . . $ cairo_set_line_join(344263d01aaacd1b). (cr, CAIRO_LINE_JOIN_BEVELcxx . . $ CAIRO_LINE_JOIN_BEVEL.); |
| 45 | cairo_set_source_rgbcxx . . $ cairo_set_source_rgb(2bdc80def475f266). (cr, 0.0, 0.0, 0.0); /* black */ |
| 46 | |
| 47 | /* entirely degenerate */ |
| 48 | cairo_move_tocxx . . $ cairo_move_to(e818af540ecaa23a). (cr, 2.5, 2.5); |
| 49 | cairo_rel_curve_tocxx . . $ cairo_rel_curve_to(522436b4d317b4dd). (cr, |
| 50 | 0., 0., |
| 51 | 0., 0., |
| 52 | 0., 0.); |
| 53 | cairo_strokecxx . . $ cairo_stroke(21788b7825b29bf). (cr); |
| 54 | |
| 55 | /* horizontal */ |
| 56 | cairo_move_tocxx . . $ cairo_move_to(e818af540ecaa23a). (cr, 5.5, 2.5); |
| 57 | cairo_rel_curve_tocxx . . $ cairo_rel_curve_to(522436b4d317b4dd). (cr, |
| 58 | 10., 0., |
| 59 | -10., 0., |
| 60 | 0., 0.); |
| 61 | cairo_strokecxx . . $ cairo_stroke(21788b7825b29bf). (cr); |
| 62 | |
| 63 | /* vertical */ |
| 64 | cairo_move_tocxx . . $ cairo_move_to(e818af540ecaa23a). (cr, 5.5, 2.5); |
| 65 | cairo_rel_curve_tocxx . . $ cairo_rel_curve_to(522436b4d317b4dd). (cr, |
| 66 | 0., 10., |
| 67 | 0., -10., |
| 68 | 0., 0.); |
| 69 | cairo_strokecxx . . $ cairo_stroke(21788b7825b29bf). (cr); |
| 70 | |
| 71 | cairo_translatecxx . . $ cairo_translate(e818af540ecaa23a). (cr, 15, 0); |
| 72 | |
| 73 | /* horizontal/vertical */ |
| 74 | cairo_move_tocxx . . $ cairo_move_to(e818af540ecaa23a). (cr, 5.5, 0.5); |
| 75 | cairo_rel_curve_tocxx . . $ cairo_rel_curve_to(522436b4d317b4dd). (cr, |
| 76 | -6., 0., |
| 77 | 0., 10., |
| 78 | 0., 0.); |
| 79 | |
| 80 | cairo_translatecxx . . $ cairo_translate(e818af540ecaa23a). (cr, 10, 0); |
| 81 | |
| 82 | /* vertical/horizontal */ |
| 83 | cairo_move_tocxx . . $ cairo_move_to(e818af540ecaa23a). (cr, 5.5, 0.0); |
| 84 | cairo_rel_curve_tocxx . . $ cairo_rel_curve_to(522436b4d317b4dd). (cr, |
| 85 | 0., 11., |
| 86 | 5., 0., |
| 87 | 0., 0.); |
| 88 | cairo_strokecxx . . $ cairo_stroke(21788b7825b29bf). (cr); |
| 89 | |
| 90 | return CAIRO_TEST_SUCCESScxx . . $ CAIRO_TEST_SUCCESS.; |
| 91 | } |
| 92 | |
| 93 | CAIRO_TESTcxx . . $ `test/cairo-test.h:210:9`! (degenerate_rel_curve_to, |
| 94 | "Test optimization treating degenerate rel-curve-to as line-to", |
| 95 | "path", /* keywords */ |
| 96 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* requirements */ |
| 97 | 40, |
| 98 | 5, |
| 99 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, draw) |