From 32d925b965fe613934d2bc25f0a5aea3801772af Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 8 Jun 2015 19:01:16 -0700 Subject: [PATCH] fix clipping regression on line patterns #2897 (proper tests depend on 2896) --- src/agg/process_line_pattern_symbolizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 03ce251f0..b5df95380 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -108,7 +108,9 @@ struct agg_renderer_process_visitor_l pattern_source source(image, opacity); pattern_type pattern (filter,source); renderer_type ren(ren_base, pattern); - ren.clip_box(0,0,common_.width_,common_.height_); + double half_stroke = std::max(marker.width()/2.0,marker.height()/2.0); + int rast_clip_padding = static_cast(std::round(half_stroke)); + ren.clip_box(-rast_clip_padding,-rast_clip_padding,common_.width_+rast_clip_padding,common_.height_+rast_clip_padding); rasterizer_type ras(ren); agg::trans_affine tr; @@ -119,7 +121,6 @@ struct agg_renderer_process_visitor_l if (clip) { double padding = (double)(common_.query_extent_.width()/pixmap_.width()); - double half_stroke = marker.width()/2.0; if (half_stroke > 1) padding *= half_stroke; if (std::fabs(offset) > 0) @@ -177,7 +178,9 @@ struct agg_renderer_process_visitor_l pattern_source source(image, opacity); pattern_type pattern (filter,source); renderer_type ren(ren_base, pattern); - ren.clip_box(0,0,common_.width_,common_.height_); + double half_stroke = std::max(marker.width()/2.0,marker.height()/2.0); + int rast_clip_padding = static_cast(std::round(half_stroke)); + ren.clip_box(-rast_clip_padding,-rast_clip_padding,common_.width_+rast_clip_padding,common_.height_+rast_clip_padding); rasterizer_type ras(ren); agg::trans_affine tr; @@ -188,7 +191,6 @@ struct agg_renderer_process_visitor_l if (clip) { double padding = (double)(common_.query_extent_.width()/pixmap_.width()); - double half_stroke = marker.width()/2.0; if (half_stroke > 1) padding *= half_stroke; if (std::fabs(offset) > 0)