diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index bbd6d9faf47c..aad782d8b41d 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -957,7 +957,7 @@ def test_markevery_polar(): @image_comparison(baseline_images=['marker_edges'], - remove_text=True) + remove_text=True, tol=3) def test_marker_edges(): x = np.linspace(0, 1, 10) fig = plt.figure() diff --git a/src/_backend_agg.h b/src/_backend_agg.h index 172fbfc5d1c1..96e90022c4ba 100644 --- a/src/_backend_agg.h +++ b/src/_backend_agg.h @@ -528,6 +528,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc, theRasterizer.reset(); theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); + agg::rect_i marker_size(0x7FFFFFFF, 0x7FFFFFFF, -0x7FFFFFFF, -0x7FFFFFFF); agg::int8u staticFillCache[MARKER_CACHE_SIZE]; agg::int8u staticStrokeCache[MARKER_CACHE_SIZE]; @@ -545,6 +546,10 @@ inline void RendererAgg::draw_markers(GCAgg &gc, fillCache = new agg::int8u[fillSize]; } scanlines.serialize(fillCache); + marker_size = agg::rect_i(scanlines.min_x(), + scanlines.min_y(), + scanlines.max_x(), + scanlines.max_y()); } stroke_t stroke(marker_path_curve); @@ -559,6 +564,10 @@ inline void RendererAgg::draw_markers(GCAgg &gc, strokeCache = new agg::int8u[strokeSize]; } scanlines.serialize(strokeCache); + marker_size = agg::rect_i(std::min(marker_size.x1, scanlines.min_x()), + std::min(marker_size.y1, scanlines.min_y()), + std::max(marker_size.x2, scanlines.max_x()), + std::max(marker_size.y2, scanlines.max_y())); theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); @@ -570,10 +579,10 @@ inline void RendererAgg::draw_markers(GCAgg &gc, agg::serialized_scanlines_adaptor_aa8 sa; agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl; - agg::rect_d clipping_rect(-1.0 - scanlines.max_x(), - -1.0 - scanlines.max_y(), - 1.0 + width - scanlines.min_x(), - 1.0 + height - scanlines.min_y()); + agg::rect_d clipping_rect(-1.0 - marker_size.x2, + -1.0 - marker_size.y2, + 1.0 + width - marker_size.x1, + 1.0 + height - marker_size.y1); if (has_clippath) { while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {