Merge branch 'jrmuizel-stroking-fixes' into cairo
Conflicts: test/dash-caps-joins-ps-argb32-ref.png test/degenerate-path-ps-argb32-ref.png test/degenerate-path.c
1
ROADMAP
|
|
@ -39,6 +39,7 @@ cairo-1.2.4 (August 21, 2006): Fix build bugs with 1.2.2
|
|||
✓- source-clip-scale
|
||||
- PS/PDF Type1/Type3 problem with rotated font_matrices
|
||||
✓- close_path behavior (T Rowley's mail)
|
||||
✓- degenerate-path dashing fixes
|
||||
|
||||
cairo-1.4 (October 2006): Better performance
|
||||
- New tessellator
|
||||
|
|
|
|||
|
|
@ -699,6 +699,8 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
|
|||
cairo_point_t *p2 = point;
|
||||
cairo_slope_t slope;
|
||||
|
||||
stroker->has_sub_path = stroker->dash_on;
|
||||
|
||||
if (p1->x == p2->x && p1->y == p2->y)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
|
|
@ -758,6 +760,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
|
|||
return status;
|
||||
}
|
||||
}
|
||||
stroker->has_sub_path = TRUE;
|
||||
}
|
||||
if (remain) {
|
||||
/*
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 3.8 KiB |
|
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;
|
||||
}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 189 B |
|
|
@ -25,41 +25,75 @@
|
|||
|
||||
#include "cairo-test.h"
|
||||
|
||||
#define IMAGE_WIDTH 40
|
||||
#define IMAGE_HEIGHT 22
|
||||
#define PAD 3.0
|
||||
#define LINE_WIDTH 6.0
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
static cairo_test_draw_function_t draw;
|
||||
|
||||
cairo_test_t test = {
|
||||
"degenerate-path",
|
||||
"Tests the behaviour of degenerate paths with different cap types",
|
||||
IMAGE_WIDTH, IMAGE_HEIGHT,
|
||||
3*(PAD+LINE_WIDTH+PAD), 6*(LINE_WIDTH+PAD) + PAD,
|
||||
draw
|
||||
};
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
static cairo_test_status_t
|
||||
draw (cairo_t *cr, int width, int height)
|
||||
{
|
||||
const cairo_line_cap_t cap[] = { CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE, CAIRO_LINE_CAP_BUTT };
|
||||
size_t i;
|
||||
double dash[] = {2, 2};
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 0, 0);
|
||||
|
||||
for (i=0; i<ARRAY_SIZE(cap); i++) {
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_set_line_cap (cr, cap[i]);
|
||||
|
||||
cairo_set_line_width (cr, 6);
|
||||
cairo_move_to (cr, 6, 6);
|
||||
cairo_line_to (cr, 6, 6);
|
||||
/* simple degenerate paths */
|
||||
cairo_set_line_width (cr, LINE_WIDTH);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_move_to (cr, 6, 15);
|
||||
cairo_translate (cr, 0, 3*PAD);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_close_path (cr);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_translate (cr, 12, 0);
|
||||
/* degenerate paths starting with dash on */
|
||||
cairo_set_dash (cr, dash, 2, 0.);
|
||||
|
||||
cairo_translate (cr, 0, 3*PAD);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_translate (cr, 0, 3*PAD);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_close_path (cr);
|
||||
cairo_stroke (cr);
|
||||
|
||||
/* degenerate paths starting with dash off */
|
||||
/* these should not draw anything */
|
||||
cairo_set_dash (cr, dash, 2, 2.);
|
||||
|
||||
cairo_translate (cr, 0, 3*PAD);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_line_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_translate (cr, 0, 3*PAD);
|
||||
cairo_move_to (cr, LINE_WIDTH, LINE_WIDTH);
|
||||
cairo_close_path (cr);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_translate (cr, PAD+LINE_WIDTH+PAD, 0);
|
||||
}
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
|
|
|||