Projects
Multimedia
synfig
synfig-isnan.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File synfig-isnan.patch of Package synfig (Revision 17)
Currently displaying revision
17
,
Show latest
--- a/src/synfig/vector.h +++ b/src/synfig/vector.h @@ -34,29 +34,6 @@ /* === M A C R O S ========================================================= */ -// For some reason isnan() isn't working on macosx any more. -// This is a quick fix. -#if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX) -#ifdef isnan -#undef isnan -#endif -inline bool isnan(double x) { return x != x; } -inline bool isnan(float x) { return x != x; } -#define SYNFIG_ISNAN_FIX 1 -#ifdef isinf -#undef isinf -#endif -inline bool isinf(double x) { return !isnan(x) && isnan(x - x); } -inline bool isinf(float x) { return !isnan(x) && isnan(x - x); } -#define SYNFIG_ISINF_FIX 1 -#else -#ifndef isnan -#define isnan(x) (std::isnan)(x) -#endif -#ifndef isinf -#define isinf(x) (std::isinf)(x) -#endif -#endif /* === T Y P E D E F S ===================================================== */ @@ -84,8 +61,8 @@ public: _y(radius*Angle::sin(angle).get()) { }; - bool is_valid()const { return !(isnan(_x) || isnan(_y)); } - bool is_nan_or_inf()const { return isnan(_x) || isnan(_y) || isinf(_x) || isinf(_y); } + bool is_valid()const { return !(std::isnan(_x) || std::isnan(_y)); } + bool is_nan_or_inf()const { return std::isnan(_x) || std::isnan(_y) || std::isinf(_x) || std::isinf(_y); } value_type & operator[](const int& i) --- a/src/modules/lyr_std/curvewarp.cpp +++ b/src/modules/lyr_std/curvewarp.cpp @@ -567,7 +567,7 @@ CurveWarp::accelerated_render(Context co tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else (*surface)[y][x]=source.cubic_sample(u,v); @@ -582,7 +582,7 @@ CurveWarp::accelerated_render(Context co tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else (*surface)[y][x]=source.linear_sample(u,v); @@ -597,7 +597,7 @@ CurveWarp::accelerated_render(Context co tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else (*surface)[y][x]=source[floor_to_int(v)][floor_to_int(u)]; @@ -770,7 +770,7 @@ if (along > max_along) max_along = along tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) result[y][x]=CairoColor(context.get_color(tmp)).premult_alpha(); else result[y][x]=source.cubic_sample_cooked(u,v); @@ -785,7 +785,7 @@ if (along > max_along) max_along = along tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) result[y][x]=CairoColor(context.get_color(tmp)).premult_alpha(); else result[y][x]=source.linear_sample_cooked(u,v); @@ -800,7 +800,7 @@ if (along > max_along) max_along = along tmp=transform(pos); u=(tmp[0]-src_tl[0])/src_pw; v=(tmp[1]-src_tl[1])/src_ph; - if(u<0 || v<0 || u>=src_w || v>=src_h || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=src_w || v>=src_h || std::isnan(u) || std::isnan(v)) result[y][x]=CairoColor(context.get_color(tmp)).premult_alpha(); else result[y][x]=source[floor_to_int(v)][floor_to_int(u)]; --- a/src/modules/lyr_std/insideout.cpp +++ b/src/modules/lyr_std/insideout.cpp @@ -127,7 +127,7 @@ public: Point origin=layer->param_origin.get(Point()); Point pos(x-origin); Real inv_mag=pos.inv_mag(); - if(!isnan(inv_mag)) + if(!std::isnan(inv_mag)) return (pos*(inv_mag*inv_mag)+origin); return x; } @@ -137,7 +137,7 @@ public: Point origin=layer->param_origin.get(Point()); Point pos(x-origin); Real inv_mag=pos.inv_mag(); - if(!isnan(inv_mag)) + if(!std::isnan(inv_mag)) return (pos*(inv_mag*inv_mag)+origin); return x; } --- a/src/modules/lyr_std/warp.cpp +++ b/src/modules/lyr_std/warp.cpp @@ -742,7 +742,7 @@ Warp::accelerated_render(Context context u=(tmp[0]-tl[0])*src_pw; v=(tmp[1]-tl[1])*src_ph; - if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else (*surface)[y][x]=source.cubic_sample(u,v); @@ -776,7 +776,7 @@ Warp::accelerated_render(Context context u=(tmp[0]-tl[0])*src_pw; v=(tmp[1]-tl[1])*src_ph; - if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else (*surface)[y][x]=source.linear_sample(u,v); @@ -809,7 +809,7 @@ Warp::accelerated_render(Context context u=(tmp[0]-tl[0])*src_pw; v=(tmp[1]-tl[1])*src_ph; - if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=source.get_w() || v>=source.get_h() || std::isnan(u) || std::isnan(v)) (*surface)[y][x]=context.get_color(tmp); else //pen.set_value(source[v][u]); @@ -1094,7 +1094,7 @@ Warp::accelerated_cairorender(Context co u=(tmp[0]-tl[0])*src_pw; v=(tmp[1]-tl[1])*src_ph; - if(u<0 || v<0 || u>=sourcew || v>=sourceh || isnan(u) || isnan(v)) + if(u<0 || v<0 || u>=sourcew || v>=sourceh || std::isnan(u) || std::isnan(v)) csurface[y][x]=context.get_cairocolor(tmp); else { --- a/src/modules/mod_filter/colorcorrect.cpp +++ b/src/modules/mod_filter/colorcorrect.cpp @@ -117,9 +117,9 @@ Layer_ColorCorrect::correct_color(const } } - assert(!isnan(ret.get_r())); - assert(!isnan(ret.get_g())); - assert(!isnan(ret.get_b())); + assert(!std::isnan(ret.get_r())); + assert(!std::isnan(ret.get_g())); + assert(!std::isnan(ret.get_b())); if(exposure!=0.0) { --- a/src/modules/mod_particle/plant.cpp +++ b/src/modules/mod_particle/plant.cpp @@ -280,7 +280,7 @@ Plant::sync()const if((((i+1)*sprouts + steps/2) / steps) > branch_count) { Vector branch_velocity(deriv(f).norm()*velocity + deriv(f).perp().norm()*perp_velocity); - if (isnan(branch_velocity[0]) || isnan(branch_velocity[1])) + if (std::isnan(branch_velocity[0]) || std::isnan(branch_velocity[1])) continue; branch_velocity[0] += random_factor * random(Random::SMOOTH_COSINE, 1, f*splits, 0.0f, 0.0f); @@ -595,7 +595,7 @@ Plant::draw_particles(Surface *dest_surf const Real pw = (br[0] - tl[0]) / w; const Real ph = (br[1] - tl[1]) / h; - if (isinf(pw) || isinf(ph)) + if (std::isinf(pw) || std::isinf(ph)) return; if (particle_list.begin() != particle_list.end()) --- a/src/synfig/color/cairocoloraccumulator.h +++ b/src/synfig/color/cairocoloraccumulator.h @@ -113,7 +113,7 @@ public: { return CairoColorAccumulator(-r_,-g_,-b_,-a_); } bool is_valid()const - { return !isnan(r_) && !isnan(g_) && !isnan(b_) && !isnan(a_); } + { return !std::isnan(r_) && !std::isnan(g_) && !std::isnan(b_) && !std::isnan(a_); } public: CairoColorAccumulator(): a_(), r_(), g_(), b_() { } --- a/src/synfig/color/color.cpp +++ b/src/synfig/color/color.cpp @@ -160,10 +160,10 @@ Color::clamped_negative()const if(ret.b_>1) ret.b_=1; if(ret.a_>1) ret.a_=1; - if(isnan(ret.get_r())) ret.r_=0.5; - if(isnan(ret.get_g())) ret.g_=0.5; - if(isnan(ret.get_b())) ret.b_=0.5; - if(isnan(ret.get_a())) ret.a_=1; + if(std::isnan(ret.get_r())) ret.r_=0.5; + if(std::isnan(ret.get_g())) ret.g_=0.5; + if(std::isnan(ret.get_b())) ret.b_=0.5; + if(std::isnan(ret.get_a())) ret.a_=1; /* if(ret.r_>1) { ret.g_/=ret.r_; ret.b_/=ret.r_; ret.r_=1; } @@ -193,10 +193,10 @@ Color::clamped()const if(ret.b_>1) ret.b_=1; if(ret.a_>1) ret.a_=1; - if(isnan(ret.get_r())) ret.r_=0.5; - if(isnan(ret.get_g())) ret.g_=0.5; - if(isnan(ret.get_b())) ret.b_=0.5; - if(isnan(ret.get_a())) ret.a_=1; + if(std::isnan(ret.get_r())) ret.r_=0.5; + if(std::isnan(ret.get_g())) ret.g_=0.5; + if(std::isnan(ret.get_b())) ret.b_=0.5; + if(std::isnan(ret.get_a())) ret.a_=1; return(ret); } --- a/src/synfig/color/color.hpp +++ b/src/synfig/color/color.hpp @@ -117,7 +117,7 @@ Color Color::operator~()const { return Color(1.0f-r_,1.0f-g_,1.0f-b_,a_); } bool Color::is_valid()const -{ return !isnan(r_) && !isnan(g_) && !isnan(b_) && !isnan(a_); } +{ return !std::isnan(r_) && !std::isnan(g_) && !std::isnan(b_) && !std::isnan(a_); } Color Color::premult_alpha() const { --- a/src/synfig/color/coloraccumulator.h +++ b/src/synfig/color/coloraccumulator.h @@ -111,7 +111,7 @@ public: { return ColorAccumulator(-r_,-g_,-b_,-a_); } bool is_valid()const - { return !isnan(r_) && !isnan(g_) && !isnan(b_) && !isnan(a_); } + { return !std::isnan(r_) && !std::isnan(g_) && !std::isnan(b_) && !std::isnan(a_); } public: ColorAccumulator(): a_(), r_(), g_(), b_() { } --- a/src/synfig/color/common.h +++ b/src/synfig/color/common.h @@ -47,20 +47,6 @@ #define gamma_in(x) ((x>=0) ? pow((float)x,1.0f/colorspace_gamma()) : -pow((float)-x,1.0f/colorspace_gamma())) #define gamma_out(x) ((x>=0) ? pow((float)x, colorspace_gamma()) : -pow((float)-x, colorspace_gamma())) -// For some reason isnan() isn't working on macosx any more. -// This is a quick fix. -#if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX) - #ifdef isnan - #undef isnan - #endif - inline bool isnan(double x) { return x != x; } - inline bool isnan(float x) { return x != x; } - #define SYNFIG_ISNAN_FIX 1 -#else - #ifndef isnan - #define isnan(x) (std::isnan)(x) - #endif -#endif namespace synfig { --- a/src/synfig/gradient.cpp +++ b/src/synfig/gradient.cpp @@ -327,7 +327,7 @@ synfig::Gradient::operator()(const Real float begin_sample(x-supersample*0.5); float end_sample(x+supersample*0.5); - if(cpoints.size()==1 || end_sample<=cpoints.front().pos || isnan(x)) + if(cpoints.size()==1 || end_sample<=cpoints.front().pos || std::isnan(x)) return cpoints.front().color; if(begin_sample>=cpoints.back().pos) --- a/src/synfig/layers/layer_polygon.cpp +++ b/src/synfig/layers/layer_polygon.cpp @@ -127,7 +127,7 @@ Layer_Polygon::add_polygon(const std::ve for(i = 1;i < pointcount; i++) { - if(isnan(point_list[i][0]) || isnan(point_list[i][1])) + if(std::isnan(point_list[i][0]) || std::isnan(point_list[i][1])) break; line_to(point_list[i][0],point_list[i][1]); } --- a/src/synfig/layers/layer_shape.cpp +++ b/src/synfig/layers/layer_shape.cpp @@ -1084,8 +1084,8 @@ public: void move_to(Real x, Real y) { close(); - if(isnan(x))x=0; - if(isnan(y))y=0; + if(std::isnan(x))x=0; + if(std::isnan(y))y=0; move_pen((int)floor(x),(int)floor(y)); close_y = cur_y = y; close_x = cur_x = x; @@ -1832,8 +1832,8 @@ void Layer_Shape::PolySpan::draw_line(Re Real fy1 = y1 - iy1; Real fy2 = y2 - iy2; - assert(!isnan(fy1)); - assert(!isnan(fy2)); + assert(!std::isnan(fy1)); + assert(!std::isnan(fy2)); Real dx,dy,dxdy,mult,x_from,x_to; @@ -2046,8 +2046,8 @@ void Layer_Shape::endpath() void Layer_Shape::line_to(Real x, Real y) { - assert(!isnan(x)); - assert(!isnan(y)); + assert(!std::isnan(x)); + assert(!std::isnan(y)); //const int sizeblock = sizeof(Primitive)+sizeof(Point); Primitive op; --- a/src/synfig/matrix.cpp +++ b/src/synfig/matrix.cpp @@ -32,16 +32,6 @@ #include "matrix.h" -// For some reason isnan() isn't working on macosx any more. -// This is a quick fix. -#if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX) -#ifdef isnan -#undef isnan -#endif -inline bool isnan(double x) { return x != x; } -inline bool isnan(float x) { return x != x; } -#define SYNFIG_ISNAN_FIX 1 -#endif #endif --- a/src/synfig/matrix.h +++ b/src/synfig/matrix.h @@ -38,16 +38,6 @@ /* === M A C R O S ========================================================= */ -// For some reason isnan() isn't working on macosx any more. -// This is a quick fix. -#if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX) -#ifdef isnan -#undef isnan -#endif -inline bool isnan(double x) { return x != x; } -inline bool isnan(float x) { return x != x; } -#define SYNFIG_ISNAN_FIX 1 -#endif #define COUT_MATRIX(m) \ cout<<"["<<m.m00<<"]["<<m.m01<<"]["<<m.m02<<"]"<<endl; \ --- a/src/synfig/time.cpp +++ b/src/synfig/time.cpp @@ -43,16 +43,6 @@ #include <ctype.h> -// For some reason isnan() isn't working on macosx any more. -// This is a quick fix. -#if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX) -#ifdef isnan -#undef isnan -#endif -inline bool isnan(double x) { return x != x; } -inline bool isnan(float x) { return x != x; } -#define SYNFIG_ISNAN_FIX 1 -#endif #endif --- a/src/synfig/transformation.h +++ b/src/synfig/transformation.h @@ -72,8 +72,8 @@ public: bool is_valid()const { return offset.is_valid() - && !isnan(Angle::rad(angle).get()) - && !isnan(Angle::rad(skew_angle).get()) + && !std::isnan(Angle::rad(angle).get()) + && !std::isnan(Angle::rad(skew_angle).get()) && scale.is_valid(); } @@ -142,10 +142,10 @@ public: static Rect transform_bounds(const Matrix &matrix, const Rect &bounds) { - if (isnan(bounds.minx) || isinf(bounds.minx) - || isnan(bounds.maxx) || isinf(bounds.maxx) - || isnan(bounds.miny) || isinf(bounds.miny) - || isnan(bounds.maxy) || isinf(bounds.maxy)) + if (std::isnan(bounds.minx) || std::isinf(bounds.minx) + || std::isnan(bounds.maxx) || std::isinf(bounds.maxx) + || std::isnan(bounds.miny) || std::isinf(bounds.miny) + || std::isnan(bounds.maxy) || std::isinf(bounds.maxy)) return Rect::infinite(); Rect transformed_bounds(
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.