Skip to content

Commit d28f102

Browse files
committed
Rename has_curves to has_codes
Because that is really what it checks and is for.
1 parent 5f0e6df commit d28f102

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

src/_backend_agg.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ bool RendererAgg::render_clippath(py::PathIterator &clippath,
152152

153153
rendererBaseAlphaMask.clear(agg::gray8(0, 0));
154154
transformed_path_t transformed_clippath(clippath, trans);
155-
nan_removed_t nan_removed_clippath(transformed_clippath, true, clippath.has_curves());
155+
nan_removed_t nan_removed_clippath(transformed_clippath, true, clippath.has_codes());
156156
snapped_t snapped_clippath(nan_removed_clippath, snap_mode, clippath.total_vertices(), 0.0);
157157
simplify_t simplified_clippath(snapped_clippath,
158-
clippath.should_simplify() && !clippath.has_curves(),
158+
clippath.should_simplify() && !clippath.has_codes(),
159159
clippath.simplify_threshold());
160160
curve_t curved_clippath(simplified_clippath);
161161
theRasterizer.add_path(curved_clippath);

src/_backend_agg.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class RendererAgg
277277
DashesVector &linestyles,
278278
AntialiasedArray &antialiaseds,
279279
bool check_snap,
280-
bool has_curves);
280+
bool has_codes);
281281

282282
template <class PointArray, class ColorArray>
283283
void _draw_gouraud_triangle(PointArray &points,
@@ -478,7 +478,7 @@ RendererAgg::draw_path(GCAgg &gc, PathIterator &path, agg::trans_affine &trans,
478478
}
479479

480480
transformed_path_t tpath(path, trans);
481-
nan_removed_t nan_removed(tpath, true, path.has_curves());
481+
nan_removed_t nan_removed(tpath, true, path.has_codes());
482482
clipped_t clipped(nan_removed, clip, width, height);
483483
snapped_t snapped(clipped, gc.snap_mode, path.total_vertices(), snapping_linewidth);
484484
simplify_t simplified(snapped, simplify, path.simplify_threshold());
@@ -512,7 +512,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
512512
trans *= agg::trans_affine_translation(0.5, (double)height + 0.5);
513513

514514
transformed_path_t marker_path_transformed(marker_path, marker_trans);
515-
nan_removed_t marker_path_nan_removed(marker_path_transformed, true, marker_path.has_curves());
515+
nan_removed_t marker_path_nan_removed(marker_path_transformed, true, marker_path.has_codes());
516516
snap_t marker_path_snapped(marker_path_nan_removed,
517517
gc.snap_mode,
518518
marker_path.total_vertices(),
@@ -910,7 +910,7 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
910910
DashesVector &linestyles,
911911
AntialiasedArray &antialiaseds,
912912
bool check_snap,
913-
bool has_curves)
913+
bool has_codes)
914914
{
915915
typedef agg::conv_transform<typename PathGenerator::path_iterator> transformed_path_t;
916916
typedef PathNanRemover<transformed_path_t> nan_removed_t;
@@ -998,11 +998,11 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
998998
gc.isaa = antialiaseds(i % Naa);
999999

10001000
transformed_path_t tpath(path, trans);
1001-
nan_removed_t nan_removed(tpath, true, has_curves);
1001+
nan_removed_t nan_removed(tpath, true, has_codes);
10021002
clipped_t clipped(nan_removed, do_clip, width, height);
10031003
snapped_t snapped(
10041004
clipped, gc.snap_mode, path.total_vertices(), points_to_pixels(gc.linewidth));
1005-
if (has_curves) {
1005+
if (has_codes) {
10061006
snapped_curve_t curve(snapped);
10071007
_draw_path(curve, has_clippath, face, gc);
10081008
} else {
@@ -1012,9 +1012,9 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
10121012
gc.isaa = antialiaseds(i % Naa);
10131013

10141014
transformed_path_t tpath(path, trans);
1015-
nan_removed_t nan_removed(tpath, true, has_curves);
1015+
nan_removed_t nan_removed(tpath, true, has_codes);
10161016
clipped_t clipped(nan_removed, do_clip, width, height);
1017-
if (has_curves) {
1017+
if (has_codes) {
10181018
curve_t curve(clipped);
10191019
_draw_path(curve, has_clippath, face, gc);
10201020
} else {

src/_path.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ inline void points_in_path(PointArray &points,
259259
}
260260

261261
transformed_path_t trans_path(path, trans);
262-
no_nans_t no_nans_path(trans_path, true, path.has_curves());
262+
no_nans_t no_nans_path(trans_path, true, path.has_codes());
263263
curve_t curved_path(no_nans_path);
264264
if (r != 0.0) {
265265
contour_t contoured_path(curved_path);
@@ -305,7 +305,7 @@ void points_on_path(PointArray &points,
305305
}
306306

307307
transformed_path_t trans_path(path, trans);
308-
no_nans_t nan_removed_path(trans_path, true, path.has_curves());
308+
no_nans_t nan_removed_path(trans_path, true, path.has_codes());
309309
curve_t curved_path(nan_removed_path);
310310
stroke_t stroked_path(curved_path);
311311
stroked_path.width(r * 2.0);
@@ -378,7 +378,7 @@ void update_path_extents(PathIterator &path, agg::trans_affine &trans, extent_li
378378
unsigned code;
379379

380380
transformed_path_t tpath(path, trans);
381-
nan_removed_t nan_removed(tpath, true, path.has_curves());
381+
nan_removed_t nan_removed(tpath, true, path.has_codes());
382382

383383
nan_removed.rewind(0);
384384

@@ -512,7 +512,7 @@ bool path_in_path(PathIterator1 &a,
512512
}
513513

514514
transformed_path_t b_path_trans(b, btrans);
515-
no_nans_t b_no_nans(b_path_trans, true, b.has_curves());
515+
no_nans_t b_no_nans(b_path_trans, true, b.has_codes());
516516
curve_t b_curved(b_no_nans);
517517

518518
double x, y;
@@ -884,8 +884,8 @@ bool path_intersects_path(PathIterator1 &p1, PathIterator2 &p2)
884884
return false;
885885
}
886886

887-
no_nans_t n1(p1, true, p1.has_curves());
888-
no_nans_t n2(p2, true, p2.has_curves());
887+
no_nans_t n1(p1, true, p1.has_codes());
888+
no_nans_t n2(p2, true, p2.has_codes());
889889

890890
curve_t c1(n1);
891891
curve_t c2(n2);
@@ -949,7 +949,7 @@ bool path_intersects_rectangle(PathIterator &path,
949949
return false;
950950
}
951951

952-
no_nans_t no_nans(path, true, path.has_curves());
952+
no_nans_t no_nans(path, true, path.has_codes());
953953
curve_t curve(no_nans);
954954

955955
double cx = (rect_x1 + rect_x2) * 0.5, cy = (rect_y1 + rect_y2) * 0.5;
@@ -998,7 +998,7 @@ void convert_path_to_polygons(PathIterator &path,
998998
bool simplify = path.should_simplify();
999999

10001000
transformed_path_t tpath(path, trans);
1001-
nan_removal_t nan_removed(tpath, true, path.has_curves());
1001+
nan_removal_t nan_removed(tpath, true, path.has_codes());
10021002
clipped_t clipped(nan_removed, do_clip, width, height);
10031003
simplify_t simplified(clipped, simplify, path.simplify_threshold());
10041004
curve_t curve(simplified);
@@ -1063,7 +1063,7 @@ void cleanup_path(PathIterator &path,
10631063
typedef Sketch<curve_t> sketch_t;
10641064

10651065
transformed_path_t tpath(path, trans);
1066-
nan_removal_t nan_removed(tpath, remove_nans, path.has_curves());
1066+
nan_removal_t nan_removed(tpath, remove_nans, path.has_codes());
10671067
clipped_t clipped(nan_removed, do_clip, rect);
10681068
snapped_t snapped(clipped, snap_mode, path.total_vertices(), stroke_width);
10691069
simplify_t simplified(snapped, do_simplify, path.simplify_threshold());
@@ -1222,7 +1222,7 @@ bool convert_to_string(PathIterator &path,
12221222
bool do_clip = (clip_rect.x1 < clip_rect.x2 && clip_rect.y1 < clip_rect.y2);
12231223

12241224
transformed_path_t tpath(path, trans);
1225-
nan_removal_t nan_removed(tpath, true, path.has_curves());
1225+
nan_removal_t nan_removed(tpath, true, path.has_codes());
12261226
clipped_t clipped(nan_removed, do_clip, clip_rect);
12271227
simplify_t simplified(clipped, simplify, path.simplify_threshold());
12281228

src/path_converters.h

+11-10
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,16 @@ class PathNanRemover : protected EmbeddedQueue<4>
162162
{
163163
VertexSource *m_source;
164164
bool m_remove_nans;
165-
bool m_has_curves;
165+
bool m_has_codes;
166166
bool valid_segment_exists;
167167

168168
public:
169-
/* has_curves should be true if the path contains bezier curve
170-
segments, as this requires a slower algorithm to remove the
171-
NaNs. When in doubt, set to true.
169+
/* has_codes should be true if the path contains bezier curve segments, or
170+
* closed loops, as this requires a slower algorithm to remove the NaNs.
171+
* When in doubt, set to true.
172172
*/
173-
PathNanRemover(VertexSource &source, bool remove_nans, bool has_curves)
174-
: m_source(&source), m_remove_nans(remove_nans), m_has_curves(has_curves)
173+
PathNanRemover(VertexSource &source, bool remove_nans, bool has_codes)
174+
: m_source(&source), m_remove_nans(remove_nans), m_has_codes(has_codes)
175175
{
176176
// ignore all close/end_poly commands until after the first valid
177177
// (nan-free) command is encountered
@@ -192,8 +192,9 @@ class PathNanRemover : protected EmbeddedQueue<4>
192192
return m_source->vertex(x, y);
193193
}
194194

195-
if (m_has_curves) {
196-
/* This is the slow method for when there might be curves. */
195+
if (m_has_codes) {
196+
/* This is the slow method for when there might be curves or closed
197+
* loops. */
197198
if (queue_pop(&code, x, y)) {
198199
return code;
199200
}
@@ -254,9 +255,9 @@ class PathNanRemover : protected EmbeddedQueue<4>
254255
} else {
255256
return agg::path_cmd_stop;
256257
}
257-
} else // !m_has_curves
258+
} else // !m_has_codes
258259
{
259-
/* This is the fast path for when we know we have no curves */
260+
/* This is the fast path for when we know we have no codes. */
260261
code = m_source->vertex(x, y);
261262

262263
if (code == agg::path_cmd_stop ||

src/py_adaptors.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class PathIterator
175175
return m_simplify_threshold;
176176
}
177177

178-
inline bool has_curves() const
178+
inline bool has_codes() const
179179
{
180180
return m_codes != NULL;
181181
}

0 commit comments

Comments
 (0)