@@ -713,8 +713,6 @@ void GraphicsContextRenderer::draw_markers(
713
713
throw std::invalid_argument (" Non-matching GraphicsContext" );
714
714
}
715
715
auto const & ac = additional_context ();
716
- auto const & old_snap = get_additional_state ().snap ;
717
- get_additional_state ().snap = false ;
718
716
719
717
// As paths store their vertices in an array, the .cast<>() will not make a
720
718
// copy and we don't need to explicitly keep the intermediate result alive.
@@ -754,11 +752,19 @@ void GraphicsContextRenderer::draw_markers(
754
752
}
755
753
756
754
if (patterns) {
755
+ // When stamping subpixel-positioned markers, there is no benefit in
756
+ // snapping (we're going to shift the path by subpixels anyways). We don't
757
+ // want to force snapping off in the non-stamped case, as that would e.g.
758
+ // ruin alignment of ticks and spines, so the change is only applied in
759
+ // this branch.
760
+ auto const & old_snap = get_additional_state ().snap ;
761
+ get_additional_state ().snap = false ;
762
+ load_path_exact (cr_, marker_path, &marker_matrix);
763
+ get_additional_state ().snap = old_snap;
757
764
// Get the extent of the marker. Importantly, cairo_*_extents() ignores
758
765
// surface dimensions and clipping.
759
766
// Matplotlib chooses *not* to call draw_markers() if the marker is bigger
760
767
// than the canvas (which may make sense if the marker is indeed huge...).
761
- load_path_exact (cr_, marker_path, &marker_matrix);
762
768
double x0, y0 , x1, y1 ;
763
769
cairo_stroke_extents (cr_, &x0, &y0 , &x1, &y1 );
764
770
if (fc) {
@@ -850,6 +856,7 @@ void GraphicsContextRenderer::draw_markers(
850
856
raw + std::lround (y) * stride + 4 * std::lround (x)) = fc_argb32;
851
857
}
852
858
cairo_surface_mark_dirty (surface);
859
+
853
860
} else {
854
861
for (auto i = 0 ; i < n_vertices; ++i) {
855
862
cairo_save (cr_);
@@ -862,8 +869,6 @@ void GraphicsContextRenderer::draw_markers(
862
869
cairo_restore (cr_);
863
870
}
864
871
}
865
-
866
- get_additional_state ().snap = old_snap;
867
872
}
868
873
869
874
void GraphicsContextRenderer::draw_path (
0 commit comments