diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/cairo-path.c | 8 | ||||
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/rel-path-ref.png | bin | 0 -> 212 bytes | |||
-rw-r--r-- | test/rel-path.c | 56 |
5 files changed, 77 insertions, 6 deletions
@@ -1,3 +1,15 @@ +2005-05-02 Keith Packard <keithp@keithp.com> + + reviewed by: cworth + + * src/cairo-path.c: (_cairo_path_fixed_rel_curve_to): + Use correct arguments to compute absolute positions. + + * test/Makefile.am: + * test/rel-path-ref.png: + * test/rel-path.c: (draw), (main): + Test cairo_rel_move_to, cairo_rel_line_to and cairo_rel_curve_to + 2005-05-02 Owen Taylor <otaylor@redhat.com> * test/Makefile.am (EXTRA_DIST): mask-ref.png, not diff --git a/src/cairo-path.c b/src/cairo-path.c index 53c2375c..0df8fc41 100644 --- a/src/cairo-path.c +++ b/src/cairo-path.c @@ -260,11 +260,11 @@ _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path, x0 = path->current_point.x + dx0; y0 = path->current_point.y + dy0; - x1 = path->current_point.x + dx0; - y1 = path->current_point.y + dy0; + x1 = path->current_point.x + dx1; + y1 = path->current_point.y + dy1; - x2 = path->current_point.x + dx0; - y2 = path->current_point.y + dy0; + x2 = path->current_point.x + dx2; + y2 = path->current_point.y + dy2; return _cairo_path_fixed_curve_to (path, x0, y0, diff --git a/test/Makefile.am b/test/Makefile.am index d26e2791..531f9b37 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -25,7 +25,8 @@ text-rotate \ transforms \ translate-show-surface \ trap-clip \ -user-data +user-data \ +rel-path # All tests which have a reference image go here. # I really don't like having to repeat this list. Anyone know a good @@ -50,7 +51,8 @@ set-source-ref.png \ surface-pattern-ref.png \ transforms-ref.png \ translate-show-surface-ref.png \ -trap-clip-ref.png +trap-clip-ref.png \ +rel-path-ref.png # Any test for which the code committed to CVS is expected to fail # should be listed here. @@ -123,6 +125,7 @@ transforms_LDADD = $(LDADDS) translate_show_surface_LDADD = $(LDADDS) trap_clip_LDADD = $(LDADDS) user_data_LDADD = $(LDADDS) +rel_path_LDADD = $(LDADDS) noinst_PROGRAMS = imagediff imagediff_LDADD = $(LDADDS) diff --git a/test/rel-path-ref.png b/test/rel-path-ref.png Binary files differnew file mode 100644 index 00000000..7b7007f3 --- /dev/null +++ b/test/rel-path-ref.png diff --git a/test/rel-path.c b/test/rel-path.c new file mode 100644 index 00000000..72a7076c --- /dev/null +++ b/test/rel-path.c @@ -0,0 +1,56 @@ +/* + * $Id: rel-path.c,v 1.1 2005-05-02 19:36:20 keithp Exp $ + * + * Copyright © 2005 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "cairo-test.h" + +#define SIZE 10 + +cairo_test_t test = { + "rel-path", + "Tests calls to various relative path functions", + SIZE, SIZE +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_move_to (cr, 0, 0); + cairo_rel_move_to (cr, SIZE, SIZE/2); + cairo_rel_line_to (cr, -SIZE, SIZE/2); + cairo_rel_curve_to (cr, + SIZE/2, -SIZE/2, + SIZE*2/3, -SIZE/3, + SIZE/2, -SIZE); + + cairo_stroke (cr); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} |