Skip to content

Use C++ stdlib for isfinite etc. #4527

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

Merged
merged 1 commit into from
Jun 22, 2015
Merged
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
69 changes: 0 additions & 69 deletions src/MPL_isnan.h

This file was deleted.

1 change: 0 additions & 1 deletion src/_backend_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "_backend_agg.h"
#include "mplutils.h"
#include "MPL_isnan.h"

void BufferRegion::to_string_argb(uint8_t *buf)
{
Expand Down
5 changes: 3 additions & 2 deletions src/_backend_agg.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef __BACKEND_AGG_H__
#define __BACKEND_AGG_H__

#include <cmath>
#include <vector>

#include "agg_alpha_mask_u8.h"
Expand Down Expand Up @@ -597,7 +598,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc,

if (has_clippath) {
while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
if (!(std::isfinite(x) && std::isfinite(y))) {
continue;
}

Expand Down Expand Up @@ -629,7 +630,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
}
} else {
while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
if (!(std::isfinite(x) && std::isfinite(y))) {
continue;
}

Expand Down
7 changes: 4 additions & 3 deletions src/_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <limits>
#include <math.h>
#include <vector>
#include <cmath>

#include "agg_conv_contour.h"
#include "agg_conv_curve.h"
Expand Down Expand Up @@ -102,7 +103,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
for (i = 0; i < n; ++i) {
ty = points[i][1];

if (MPL_isfinite64(ty)) {
if (std::isfinite(ty)) {
// get test bit for above/below X axis
yflag0[i] = (vty0 >= ty);

Expand All @@ -126,7 +127,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
tx = points[i][0];
ty = points[i][1];

if (MPL_notisfinite64(tx) || MPL_notisfinite64(ty)) {
if (!(std::isfinite(tx) && std::isfinite(ty))) {
continue;
}

Expand Down Expand Up @@ -174,7 +175,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
tx = points[i][0];
ty = points[i][1];

if (MPL_notisfinite64(tx) || MPL_notisfinite64(ty)) {
if (!(std::isfinite(tx) && std::isfinite(ty))) {
continue;
}

Expand Down
12 changes: 6 additions & 6 deletions src/path_converters.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#ifndef __PATH_CONVERTERS_H__
#define __PATH_CONVERTERS_H__

#include <cmath>
#include "agg_path_storage.h"
#include "agg_clip_liang_barsky.h"
#include "MPL_isnan.h"
#include "mplutils.h"
#include "agg_conv_segmentator.h"

Expand Down Expand Up @@ -176,14 +176,14 @@ class PathNanRemover : protected EmbeddedQueue<4>
}

size_t num_extra_points = num_extra_points_map[code & 0xF];
bool has_nan = (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
bool has_nan = (!(std::isfinite(*x) && std::isfinite(*y)));
queue_push(code, *x, *y);

/* Note: this test can not be short-circuited, since we need to
advance through the entire curve no matter what */
for (size_t i = 0; i < num_extra_points; ++i) {
m_source->vertex(x, y);
has_nan = has_nan || (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
has_nan = has_nan || !(std::isfinite(*x) && std::isfinite(*y));
queue_push(code, *x, *y);
}

Expand All @@ -196,7 +196,7 @@ class PathNanRemover : protected EmbeddedQueue<4>
/* If the last point is finite, we use that for the
moveto, otherwise, we'll use the first vertex of
the next curve. */
if (!(MPL_notisfinite64(*x) || MPL_notisfinite64(*y))) {
if (std::isfinite(*x) && std::isfinite(*y)) {
queue_push(agg::path_cmd_move_to, *x, *y);
needs_move_to = false;
} else {
Expand All @@ -219,14 +219,14 @@ class PathNanRemover : protected EmbeddedQueue<4>
return code;
}

if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)) {
if (!(std::isfinite(*x) && std::isfinite(*y))) {
do {
code = m_source->vertex(x, y);
if (code == agg::path_cmd_stop ||
code == (agg::path_cmd_end_poly | agg::path_flags_close)) {
return code;
}
} while (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
} while (!(std::isfinite(*x) && std::isfinite(*y)));
return agg::path_cmd_move_to;
}

Expand Down