Skip to content

Shorten Agg template usage with class template argument deduction. #29763

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
29 changes: 13 additions & 16 deletions src/_backend_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ bool RendererAgg::render_clippath(mpl::PathIterator &clippath,
const agg::trans_affine &clippath_trans,
e_snap_mode snap_mode)
{
typedef agg::conv_transform<mpl::PathIterator> transformed_path_t;
typedef PathNanRemover<transformed_path_t> nan_removed_t;
/* Unlike normal Paths, the clip path cannot be clipped to the Figure bbox,
* because it needs to remain a complete closed path, so there is no
* PathClipper<nan_removed_t> step. */
typedef PathSnapper<nan_removed_t> snapped_t;
typedef PathSimplifier<snapped_t> simplify_t;
typedef agg::conv_curve<simplify_t> curve_t;

bool has_clippath = (clippath.total_vertices() != 0);

if (has_clippath &&
Expand All @@ -141,13 +132,19 @@ bool RendererAgg::render_clippath(mpl::PathIterator &clippath,
trans *= agg::trans_affine_translation(0.0, (double)height);

rendererBaseAlphaMask.clear(agg::gray8(0, 0));
transformed_path_t transformed_clippath(clippath, trans);
nan_removed_t nan_removed_clippath(transformed_clippath, true, clippath.has_codes());
snapped_t snapped_clippath(nan_removed_clippath, snap_mode, clippath.total_vertices(), 0.0);
simplify_t simplified_clippath(snapped_clippath,
clippath.should_simplify() && !clippath.has_codes(),
clippath.simplify_threshold());
curve_t curved_clippath(simplified_clippath);
auto transformed_clippath = agg::conv_transform{clippath, trans};
auto nan_removed_clippath = PathNanRemover{
transformed_clippath, true, clippath.has_codes()};
// Unlike normal Paths, the clip path cannot be clipped to the Figure
// bbox, because it needs to remain a complete closed path, so there is
// no PathClipper step after nan-removal.
auto snapped_clippath = PathSnapper{
nan_removed_clippath, snap_mode, clippath.total_vertices(), 0.0};
auto simplified_clippath = PathSimplifier{
snapped_clippath,
clippath.should_simplify() && !clippath.has_codes(),
clippath.simplify_threshold()};
auto curved_clippath = agg::conv_curve{simplified_clippath};
theRasterizer.add_path(curved_clippath);
rendererAlphaMask.color(agg::gray8(255, 255));
agg::render_scanlines(theRasterizer, scanlineAlphaMask, rendererAlphaMask);
Expand Down
Loading
Loading