diff --git a/ChangeLog b/ChangeLog index f2cb64362..a6cd0f458 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2005-09-27 Carl Worth + + * ROADMAP: Note that bug #4409 (Dashes are missing initial caps) + is now fixed. + + * src/cairo-path-stroke.c: (_cairo_stroker_add_cap), + (_cairo_stroker_add_leading_cap), + (_cairo_stroker_add_trailing_cap), + (_cairo_stroker_add_caps): Move face-flipping from inside + _cairo_stroker_add_caps to new _cairo_stroker_add_leading_cap + variant of _cairo_stoker_add_cap. + + * src/cairo-path-stroke.c: (_cairo_stroker_line_to_dashed): Change + to call _cairo_stroker_add_leading_cap or + _cairo_stroker_add_trailing_cap as appropriate. + + * test/Makefile.am (XFAIL_TESTS): + * test/dash-caps-joins-ref.png: + * test/dash-caps-joins.c: (main): Remove dash-caps-joins from the + XFAIL list and add reference image. + 2005-09-27 Carl Worth * test/.cvsignore: diff --git a/ROADMAP b/ROADMAP index 0a96cedc2..347ab6613 100644 --- a/ROADMAP +++ b/ROADMAP @@ -5,7 +5,7 @@ https://bugs.freedesktop.org/show_bug.cgi?id=XXXX ✓4260 Antialised font is rendered over green background ✓4299 Assertion fails in "cairo-font.c" when using multithreads ✓4408 Missing dashes on stroked curves - 4409 Dashes are missing initial caps +✓4409 Dashes are missing initial caps ✓4414 SIGILL caused by libcairo when running gnome-terminal ✓PASS clip-all test 4599 Missing wedges on some paths diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index e6fc934ac..788973100 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -341,7 +341,7 @@ _cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_st } static cairo_status_t -_cairo_stroker_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f) +_cairo_stroker_add_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f) { cairo_status_t status; cairo_gstate_t *gstate = stroker->gstate; @@ -411,28 +411,47 @@ _cairo_stroker_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f) } } +static cairo_status_t +_cairo_stroker_add_leading_cap (cairo_stroker_t *stroker, + cairo_stroke_face_t *face) +{ + cairo_stroke_face_t reversed; + cairo_point_t t; + + reversed = *face; + + /* The initial cap needs an outward facing vector. Reverse everything */ + reversed.usr_vector.x = -reversed.usr_vector.x; + reversed.usr_vector.y = -reversed.usr_vector.y; + reversed.dev_vector.dx = -reversed.dev_vector.dx; + reversed.dev_vector.dy = -reversed.dev_vector.dy; + t = reversed.cw; + reversed.cw = reversed.ccw; + reversed.ccw = t; + + return _cairo_stroker_add_cap (stroker, &reversed); +} + +static cairo_status_t +_cairo_stroker_add_trailing_cap (cairo_stroker_t *stroker, + cairo_stroke_face_t *face) +{ + return _cairo_stroker_add_cap (stroker, face); +} + static cairo_status_t _cairo_stroker_add_caps (cairo_stroker_t *stroker) { cairo_status_t status; if (stroker->has_first_face) { - cairo_point_t t; - /* The initial cap needs an outward facing vector. Reverse everything */ - stroker->first_face.usr_vector.x = -stroker->first_face.usr_vector.x; - stroker->first_face.usr_vector.y = -stroker->first_face.usr_vector.y; - stroker->first_face.dev_vector.dx = -stroker->first_face.dev_vector.dx; - stroker->first_face.dev_vector.dy = -stroker->first_face.dev_vector.dy; - t = stroker->first_face.cw; - stroker->first_face.cw = stroker->first_face.ccw; - stroker->first_face.ccw = t; - status = _cairo_stroker_cap (stroker, &stroker->first_face); + status = _cairo_stroker_add_leading_cap (stroker, &stroker->first_face); if (status) return status; } if (stroker->has_current_face) { - status = _cairo_stroker_cap (stroker, &stroker->current_face); + status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face); if (status) return status; } @@ -673,7 +692,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) /* * Not first dash in this segment, cap start */ - status = _cairo_stroker_cap (stroker, &sub_start); + status = _cairo_stroker_add_leading_cap (stroker, &sub_start); if (status) return status; } else { @@ -691,7 +710,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) stroker->first_face = sub_start; stroker->has_first_face = 1; } else { - status = _cairo_stroker_cap (stroker, &sub_start); + status = _cairo_stroker_add_leading_cap (stroker, &sub_start); if (status) return status; } @@ -701,7 +720,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) /* * Cap if not at end of segment */ - status = _cairo_stroker_cap (stroker, &sub_end); + status = _cairo_stroker_add_trailing_cap (stroker, &sub_end); if (status) return status; } else { @@ -719,7 +738,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) */ if (first) { if (stroker->has_current_face) { - status = _cairo_stroker_cap (stroker, &stroker->current_face); + status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face); if (status) return status; } diff --git a/test/Makefile.am b/test/Makefile.am index cbb62bab0..eb2b9be4e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -150,7 +150,6 @@ rel-path-ref.png # provide an explanation for the expected failure. XFAIL_TESTS = \ a8-mask \ -dash-caps-joins \ filter-nearest-offset \ pixman-rotate \ self-intersecting \ diff --git a/test/dash-caps-joins-ref.png b/test/dash-caps-joins-ref.png new file mode 100644 index 000000000..c44352bcd Binary files /dev/null and b/test/dash-caps-joins-ref.png differ diff --git a/test/dash-caps-joins.c b/test/dash-caps-joins.c index 2a0d015c8..d0e68ecfc 100644 --- a/test/dash-caps-joins.c +++ b/test/dash-caps-joins.c @@ -90,6 +90,5 @@ draw (cairo_t *cr, int width, int height) int main (void) { - return cairo_test_expect_failure (&test, draw, - "Dashes are missing initial caps: https://bugs.freedesktop.org/show_bug.cgi?id=4409"); + return cairo_test (&test, draw); }