Skip to content

Commit 1cd9255

Browse files
committed
Fix issue with sketch not working on PathCollection in Agg
1 parent 29f095d commit 1cd9255

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/_backend_agg.h

+16-14
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,10 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
919919
typedef PathSnapper<clipped_t> snapped_t;
920920
typedef agg::conv_curve<snapped_t> snapped_curve_t;
921921
typedef agg::conv_curve<clipped_t> curve_t;
922+
typedef Sketch<clipped_t> sketch_clipped_t;
923+
typedef Sketch<curve_t> sketch_curve_t;
924+
typedef Sketch<snapped_t> sketch_snapped_t;
925+
typedef Sketch<snapped_curve_t> sketch_snapped_curve_t;
922926

923927
size_t Npaths = path_generator.num_paths();
924928
size_t Noffsets = safe_first_shape(offsets);
@@ -994,31 +998,29 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
994998
}
995999
}
9961000

1001+
gc.isaa = antialiaseds(i % Naa);
1002+
transformed_path_t tpath(path, trans);
1003+
nan_removed_t nan_removed(tpath, true, has_codes);
1004+
clipped_t clipped(nan_removed, do_clip, width, height);
9971005
if (check_snap) {
998-
gc.isaa = antialiaseds(i % Naa);
999-
1000-
transformed_path_t tpath(path, trans);
1001-
nan_removed_t nan_removed(tpath, true, has_codes);
1002-
clipped_t clipped(nan_removed, do_clip, width, height);
10031006
snapped_t snapped(
10041007
clipped, gc.snap_mode, path.total_vertices(), points_to_pixels(gc.linewidth));
10051008
if (has_codes) {
10061009
snapped_curve_t curve(snapped);
1007-
_draw_path(curve, has_clippath, face, gc);
1010+
sketch_snapped_curve_t sketch(curve, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
1011+
_draw_path(sketch, has_clippath, face, gc);
10081012
} else {
1009-
_draw_path(snapped, has_clippath, face, gc);
1013+
sketch_snapped_t sketch(snapped, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
1014+
_draw_path(sketch, has_clippath, face, gc);
10101015
}
10111016
} else {
1012-
gc.isaa = antialiaseds(i % Naa);
1013-
1014-
transformed_path_t tpath(path, trans);
1015-
nan_removed_t nan_removed(tpath, true, has_codes);
1016-
clipped_t clipped(nan_removed, do_clip, width, height);
10171017
if (has_codes) {
10181018
curve_t curve(clipped);
1019-
_draw_path(curve, has_clippath, face, gc);
1019+
sketch_curve_t sketch(curve, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
1020+
_draw_path(sketch, has_clippath, face, gc);
10201021
} else {
1021-
_draw_path(clipped, has_clippath, face, gc);
1022+
sketch_clipped_t sketch(clipped, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
1023+
_draw_path(sketch, has_clippath, face, gc);
10221024
}
10231025
}
10241026
}

0 commit comments

Comments
 (0)