summaryrefslogtreecommitdiff
path: root/src/cairo-path-stroke.c
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2008-02-06 13:01:52 -0800
committerVladimir Vukicevic <vladimir@h-232.office.mozilla.org>2008-02-06 13:07:13 -0800
commitbf1f7f70b61b5bb657b2531dab63c541ac8fb59d (patch)
tree4fd061561341162c7ea544c4382f72cbe597969c /src/cairo-path-stroke.c
parente104fcab1c8c8d9a7a7962a1dbea0c87867c8f9a (diff)
downloadcairo-bf1f7f70b61b5bb657b2531dab63c541ac8fb59d.tar.gz
Do correct calculation of pen dimensions for stroke optimization
Diffstat (limited to 'src/cairo-path-stroke.c')
-rw-r--r--src/cairo-path-stroke.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 71510b1f9..b82c28a32 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -192,30 +192,23 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
stroker->has_bounds = _cairo_traps_get_limit (traps, &stroker->bounds);
if (stroker->has_bounds) {
- /* Extend the bounds by the line width in each direction so that we correctly
- * capture segment endcaps and other similar renderings that would extend beyond
- * the segment itself.
+ /* Extend the bounds in each direction to account for the maximum area
+ * we might generate trapezoids, to capture line segments that are outside
+ * of the bounds but which might generate rendering that's within bounds.
*/
- double width_x = stroker->style->line_width;
- double width_y = stroker->style->line_width;
-
- cairo_fixed_t fixed_x, fixed_y;
-
- if (stroke_style->line_join == CAIRO_LINE_JOIN_MITER) {
- width_x *= stroker->style->miter_limit;
- width_y *= stroker->style->miter_limit;
- }
+ double dx, dy;
+ cairo_fixed_t fdx, fdy;
- cairo_matrix_transform_distance (stroker->ctm, &width_x, &width_y);
+ _cairo_stroke_style_max_distance_from_path (stroker->style, stroker->ctm, &dx, &dy);
- fixed_x = _cairo_fixed_from_double (width_x);
- fixed_y = _cairo_fixed_from_double (width_y);
+ fdx = _cairo_fixed_from_double (dx);
+ fdy = _cairo_fixed_from_double (dy);
- stroker->bounds.p1.x -= fixed_x;
- stroker->bounds.p2.x += fixed_x;
+ stroker->bounds.p1.x -= fdx;
+ stroker->bounds.p2.x += fdx;
- stroker->bounds.p1.y -= fixed_y;
- stroker->bounds.p2.y += fixed_y;
+ stroker->bounds.p1.y -= fdy;
+ stroker->bounds.p2.y += fdy;
}
return CAIRO_STATUS_SUCCESS;
@@ -864,7 +857,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
segment.p2.y = _cairo_fixed_from_double (dy2) + p1->y;
if (fully_in_bounds ||
- _cairo_box_intersects_line (&stroker->bounds, &segment))
+ _cairo_box_intersects_line_segment (&stroker->bounds, &segment))
{
if (stroker->dash_on) {
status = _cairo_stroker_add_sub_edge (stroker, &segment.p1, &segment.p2, slope_dx, slope_dy, &sub_start, &sub_end);