Skip to content

Commit 87ea4e4

Browse files
authored
Merge pull request #29763 from anntzer/ctad
Shorten Agg template usage with class template argument deduction.
2 parents 2923bfb + 6a18060 commit 87ea4e4

File tree

3 files changed

+138
-245
lines changed

3 files changed

+138
-245
lines changed

src/_backend_agg.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,6 @@ bool RendererAgg::render_clippath(mpl::PathIterator &clippath,
122122
const agg::trans_affine &clippath_trans,
123123
e_snap_mode snap_mode)
124124
{
125-
typedef agg::conv_transform<mpl::PathIterator> transformed_path_t;
126-
typedef PathNanRemover<transformed_path_t> nan_removed_t;
127-
/* Unlike normal Paths, the clip path cannot be clipped to the Figure bbox,
128-
* because it needs to remain a complete closed path, so there is no
129-
* PathClipper<nan_removed_t> step. */
130-
typedef PathSnapper<nan_removed_t> snapped_t;
131-
typedef PathSimplifier<snapped_t> simplify_t;
132-
typedef agg::conv_curve<simplify_t> curve_t;
133-
134125
bool has_clippath = (clippath.total_vertices() != 0);
135126

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

143134
rendererBaseAlphaMask.clear(agg::gray8(0, 0));
144-
transformed_path_t transformed_clippath(clippath, trans);
145-
nan_removed_t nan_removed_clippath(transformed_clippath, true, clippath.has_codes());
146-
snapped_t snapped_clippath(nan_removed_clippath, snap_mode, clippath.total_vertices(), 0.0);
147-
simplify_t simplified_clippath(snapped_clippath,
148-
clippath.should_simplify() && !clippath.has_codes(),
149-
clippath.simplify_threshold());
150-
curve_t curved_clippath(simplified_clippath);
135+
auto transformed_clippath = agg::conv_transform{clippath, trans};
136+
auto nan_removed_clippath = PathNanRemover{
137+
transformed_clippath, true, clippath.has_codes()};
138+
// Unlike normal Paths, the clip path cannot be clipped to the Figure
139+
// bbox, because it needs to remain a complete closed path, so there is
140+
// no PathClipper step after nan-removal.
141+
auto snapped_clippath = PathSnapper{
142+
nan_removed_clippath, snap_mode, clippath.total_vertices(), 0.0};
143+
auto simplified_clippath = PathSimplifier{
144+
snapped_clippath,
145+
clippath.should_simplify() && !clippath.has_codes(),
146+
clippath.simplify_threshold()};
147+
auto curved_clippath = agg::conv_curve{simplified_clippath};
151148
theRasterizer.add_path(curved_clippath);
152149
rendererAlphaMask.color(agg::gray8(255, 255));
153150
agg::render_scanlines(theRasterizer, scanlineAlphaMask, rendererAlphaMask);

0 commit comments

Comments
 (0)