Skip to content

Fix issue with sketch not working on PathCollection in Agg #25645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions src/_backend_agg.h
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,10 @@
typedef PathSnapper<clipped_t> snapped_t;
typedef agg::conv_curve<snapped_t> snapped_curve_t;
typedef agg::conv_curve<clipped_t> curve_t;
typedef Sketch<clipped_t> sketch_clipped_t;
typedef Sketch<curve_t> sketch_curve_t;
typedef Sketch<snapped_t> sketch_snapped_t;
typedef Sketch<snapped_curve_t> sketch_snapped_curve_t;

size_t Npaths = path_generator.num_paths();
size_t Noffsets = safe_first_shape(offsets);
Expand Down Expand Up @@ -994,31 +998,29 @@
}
}

gc.isaa = antialiaseds(i % Naa);
transformed_path_t tpath(path, trans);
nan_removed_t nan_removed(tpath, true, has_codes);
clipped_t clipped(nan_removed, do_clip, width, height);
if (check_snap) {
gc.isaa = antialiaseds(i % Naa);

transformed_path_t tpath(path, trans);
nan_removed_t nan_removed(tpath, true, has_codes);
clipped_t clipped(nan_removed, do_clip, width, height);
snapped_t snapped(
clipped, gc.snap_mode, path.total_vertices(), points_to_pixels(gc.linewidth));
if (has_codes) {
snapped_curve_t curve(snapped);
_draw_path(curve, has_clippath, face, gc);
sketch_snapped_curve_t sketch(curve, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
_draw_path(sketch, has_clippath, face, gc);
} else {
_draw_path(snapped, has_clippath, face, gc);
sketch_snapped_t sketch(snapped, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);
_draw_path(sketch, has_clippath, face, gc);
}
} else {
gc.isaa = antialiaseds(i % Naa);

transformed_path_t tpath(path, trans);
nan_removed_t nan_removed(tpath, true, has_codes);
clipped_t clipped(nan_removed, do_clip, width, height);
if (has_codes) {
curve_t curve(clipped);
_draw_path(curve, has_clippath, face, gc);
sketch_curve_t sketch(curve, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);

Check warning on line 1019 in src/_backend_agg.h

View check run for this annotation

Codecov / codecov/patch

src/_backend_agg.h#L1019

Added line #L1019 was not covered by tests
_draw_path(sketch, has_clippath, face, gc);
} else {
_draw_path(clipped, has_clippath, face, gc);
sketch_clipped_t sketch(clipped, gc.sketch.scale, gc.sketch.length, gc.sketch.randomness);

Check warning on line 1022 in src/_backend_agg.h

View check run for this annotation

Codecov / codecov/patch

src/_backend_agg.h#L1022

Added line #L1022 was not covered by tests
_draw_path(sketch, has_clippath, face, gc);
}
}
}
Expand Down
Loading