mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 07:38:22 +02:00
Test closed dashed paths where the first and last sub-path do not join.
This tests the situation reported by Keith Wells where the start point of a closed dashed path was not being properly capped.
This commit is contained in:
parent
c70edff084
commit
b607cdff98
3 changed files with 27 additions and 18 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 4.6 KiB |
|
|
@ -41,7 +41,7 @@ cairo_test_t test = {
|
|||
"dash-caps-joins",
|
||||
"Test caps and joins when dashing",
|
||||
3 * (PAD + SIZE) + PAD,
|
||||
PAD + SIZE + PAD,
|
||||
PAD + SIZE + PAD + SIZE + PAD,
|
||||
draw
|
||||
};
|
||||
|
||||
|
|
@ -62,6 +62,8 @@ static cairo_test_status_t
|
|||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
double dash[] = {LINE_WIDTH, 1.5 * LINE_WIDTH};
|
||||
double dash_offset = -2 * LINE_WIDTH;
|
||||
int i;
|
||||
|
||||
/* We draw in the default black, so paint white first. */
|
||||
cairo_save (cr);
|
||||
|
|
@ -69,29 +71,36 @@ draw (cairo_t *cr, int width, int height)
|
|||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), - 2 * LINE_WIDTH);
|
||||
for (i=0; i<2; i++) {
|
||||
cairo_save (cr);
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_set_dash (cr, dash, sizeof(dash)/sizeof(dash[0]), dash_offset);
|
||||
|
||||
cairo_translate (cr, PAD, PAD);
|
||||
cairo_translate (cr, PAD, PAD);
|
||||
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
|
||||
cairo_stroke (cr);
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_BEVEL);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_translate (cr, SIZE + PAD, 0.);
|
||||
cairo_translate (cr, SIZE + PAD, 0.);
|
||||
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
cairo_stroke (cr);
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_translate (cr, SIZE + PAD, 0.);
|
||||
cairo_translate (cr, SIZE + PAD, 0.);
|
||||
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
|
||||
cairo_stroke (cr);
|
||||
make_path (cr);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
cairo_translate (cr, 0., SIZE + PAD);
|
||||
dash_offset = 0;
|
||||
}
|
||||
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue