Skip to content

Commit 5ba391b

Browse files
committed
MNT: Fix type of _finalize_polygon::closed_only
It is `bool` for the Python wrapper, while internally `int`, but can be `bool` consistently. Also mark it as `inline` since it's used in a template and the compiler warns about a possible ODR violation (which isn't a problem since it's only used in one file.)
1 parent 6d5dd9a commit 5ba391b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/_path.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ struct XY
4343

4444
typedef std::vector<XY> Polygon;
4545

46-
void _finalize_polygon(std::vector<Polygon> &result, int closed_only)
46+
inline void
47+
_finalize_polygon(std::vector<Polygon> &result, bool closed_only)
4748
{
4849
if (result.size() == 0) {
4950
return;
@@ -691,12 +692,12 @@ clip_path_to_rect(PathIterator &path, agg::rect_d &rect, bool inside, std::vecto
691692

692693
// Empty polygons aren't very useful, so skip them
693694
if (polygon1.size()) {
694-
_finalize_polygon(results, 1);
695+
_finalize_polygon(results, true);
695696
results.push_back(polygon1);
696697
}
697698
} while (code != agg::path_cmd_stop);
698699

699-
_finalize_polygon(results, 1);
700+
_finalize_polygon(results, true);
700701
}
701702

702703
template <class VerticesArray, class ResultArray>
@@ -956,7 +957,7 @@ void convert_path_to_polygons(PathIterator &path,
956957
agg::trans_affine &trans,
957958
double width,
958959
double height,
959-
int closed_only,
960+
bool closed_only,
960961
std::vector<Polygon> &result)
961962
{
962963
typedef agg::conv_transform<mpl::PathIterator> transformed_path_t;
@@ -980,7 +981,7 @@ void convert_path_to_polygons(PathIterator &path,
980981

981982
while ((code = curve.vertex(&x, &y)) != agg::path_cmd_stop) {
982983
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) {
983-
_finalize_polygon(result, 1);
984+
_finalize_polygon(result, true);
984985
polygon = &result.emplace_back();
985986
} else {
986987
if (code == agg::path_cmd_move_to) {

0 commit comments

Comments
 (0)