Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f747ca

Browse files
committed
FIX: make sure nans are dealt with in path
With gcc 5.1.0 it seems that the inner loop of the fast-path in PathNanRemover gets optimized out of existence and the first non-finite entry in the path prevents any further drawing. This PR (rather hackishly) adds explicit de-references to x and y to the loop to make sure the compiler does not decide it is unneeded. Closes #4252
1 parent a165735 commit 5f747ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/path_converters.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,21 @@ class PathNanRemover : protected EmbeddedQueue<4>
218218
code == (agg::path_cmd_end_poly | agg::path_flags_close)) {
219219
return code;
220220
}
221+
double _x, _y;
221222

222223
if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)) {
223224
do {
224225
code = m_source->vertex(x, y);
226+
// This de-reference makes sure this loop is not
227+
// optimized out of existence
228+
_x = *x;
229+
_y = *y;
230+
225231
if (code == agg::path_cmd_stop ||
226232
code == (agg::path_cmd_end_poly | agg::path_flags_close)) {
227233
return code;
228234
}
229-
} while (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
235+
} while (MPL_notisfinite64(_x) || MPL_notisfinite64(_y));
230236
return agg::path_cmd_move_to;
231237
}
232238

0 commit comments

Comments
 (0)