diff --git a/include/mapnik/offset_converter.hpp b/include/mapnik/offset_converter.hpp index 723282e91..4d75d679c 100644 --- a/include/mapnik/offset_converter.hpp +++ b/include/mapnik/offset_converter.hpp @@ -266,6 +266,14 @@ private: double sa = offset_ * std::sin(a); double ca = offset_ * std::cos(a); double h = std::tan(0.5 * (b - a)); + if (h > 1.5) + { + h = 1.5; + } + else if (h < -1.5) + { + h = -1.5; + } v.x = v.x - sa - h * ca; v.y = v.y + ca - h * sa; } 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)