[DEBUG] correct LLVM Cxx dependency

This commit is contained in:
Edouard DUPIN 2016-01-08 21:22:33 +01:00
parent ebf36c924c
commit bac21ef69a
2 changed files with 53 additions and 12 deletions

View File

@ -86,7 +86,11 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec
}
ratio -= float(int32_t(ratio));
if (ratio <0.0f) {
ratio = 1.0f-std::abs(ratio);
#ifndef __STDCPP_LLVM__
ratio = 1.0f-std::abs(ratio);
#else
ratio = 1.0f-abs(ratio);
#endif
}
break;
}
@ -123,7 +127,11 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec
// nothing to do ...
break;
case spreadMethod_reflect:
ratio = std::abs(ratio);
#ifndef __STDCPP_LLVM__
ratio = std::abs(ratio);
#else
ratio = abs(ratio);
#endif
ratio -= float((int32_t(ratio)>>1)<<1);
if (ratio > 1.0f) {
ratio = 2.0f-ratio;
@ -132,7 +140,11 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec
case spreadMethod_repeat:
ratio -= float(int32_t(ratio));
if (ratio <0.0f) {
ratio = 1.0f-std::abs(ratio);
#ifndef __STDCPP_LLVM__
ratio = 1.0f-std::abs(ratio);
#else
ratio = 1.0f-abs(ratio);
#endif
}
break;
}
@ -182,8 +194,13 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
if (distToCenter == 0.0f) {
distToIntersection = _radius;
} else {
distToCenter = std::sqrt(distToCenter);
distToIntersection = std::sqrt(_radius * _radius - distToCenter * distToCenter);
#ifndef __STDCPP_LLVM__
distToCenter = std::sqrt(distToCenter);
distToIntersection = std::sqrt(_radius * _radius - distToCenter * distToCenter);
#else
distToCenter = sqrtf(distToCenter);
distToIntersection = sqrtf(_radius * _radius - distToCenter * distToCenter);
#endif
}
// normalize...
v1.safeNormalize();
@ -261,7 +278,11 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec
case spreadMethod_repeat:
ratio -= float(int32_t(ratio));
if (ratio <0.0f) {
ratio = 1.0f-std::abs(ratio);
#ifndef __STDCPP_LLVM__
ratio = 1.0f-std::abs(ratio);
#else
ratio = 1.0f-abs(ratio);
#endif
}
break;
}

View File

@ -101,7 +101,7 @@ void interpolateCubicBezier(std::vector<esvg::render::Point>& _listPoint,
vec2 pos34 = (_pos3+_pos4)*0.5f;
vec2 delta = _pos4 - _pos1;
#if __CPP_VERSION__ >= 2011 && !defined(__TARGET_OS__MacOs) && !defined(__TARGET_OS__IOs)
#ifndef __STDCPP_LLVM__
float distance2 = std::abs(((_pos2.x() - _pos4.x()) * delta.y() - (_pos2.y() - _pos4.y()) * delta.x() ));
float distance3 = std::abs(((_pos3.x() - _pos4.x()) * delta.y() - (_pos3.y() - _pos4.y()) * delta.x() ));
#else
@ -381,7 +381,11 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
ddd = (deltaPrim.x()*deltaPrim.x())/(radius.x()*radius.x())
+ (deltaPrim.y()*deltaPrim.y())/(radius.y()*radius.y());
if (ddd > 1.0f) {
ddd = std::sqrt(ddd);
#ifndef __STDCPP_LLVM__
ddd = std::sqrt(ddd);
#else
ddd = sqrtf(ddd);
#endif
radius *= ddd;
}
// Compute center'
@ -395,7 +399,11 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
ssa = 0.0f;
}
if (ssb > 0.0f) {
sss = std::sqrt(ssa / ssb);
#ifndef __STDCPP_LLVM__
sss = std::sqrt(ssa / ssb);
#else
sss = sqrtf(ssa / ssb);
#endif
}
if (tmpIt->m_largeArcFlag == tmpIt->m_sweepFlag) {
sss *= -1.0f;
@ -438,9 +446,17 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
matrix.translate(center);
// Split arc into max 90 degree segments.
// The loop assumes an iteration per end point (including start and end), this +1.
int32_t ndivs = int32_t(std::abs(deltaTheta) / (M_PI*0.5f)) + 1;
#ifndef __STDCPP_LLVM__
int32_t ndivs = int32_t(std::abs(deltaTheta) / (M_PI*0.5f)) + 1;
#else
int32_t ndivs = int32_t(fabs(deltaTheta) / (M_PI*0.5f)) + 1;
#endif
float hda = (deltaTheta / float(ndivs)) * 0.5f;
float kappa = std::abs(4.0f / 3.0f * (1.0f - std::cos(hda)) / std::sin(hda));
#ifndef __STDCPP_LLVM__
float kappa = std::abs(4.0f / 3.0f * (1.0f - std::cos(hda)) / std::sin(hda));
#else
float kappa = fabs(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda));
#endif
if (deltaTheta < 0.0f) {
kappa = -kappa;
}
@ -448,7 +464,11 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
vec2 tangentPrevious(0.0,0.0);
for (int32_t iii=0; iii<=ndivs; ++iii) {
float a = theta1 + deltaTheta * (float(iii)/(float)ndivs);
delta = vec2(std::cos(a), std::sin(a));
#ifndef __STDCPP_LLVM__
delta = vec2(std::cos(a), std::sin(a));
#else
delta = vec2(cosf(a), sinf(a));
#endif
// position
vec2 pointPos = matrix * vec2(delta.x()*radius.x(), delta.y()*radius.y());
// tangent