Skip to content

Commit

Permalink
fix compile errors under c++17
Browse files Browse the repository at this point in the history
Fixes errors with collisions due to the addition of clamp to the std
namespace

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd authored and nickrasmussen committed Aug 9, 2018
1 parent af5fa2d commit 6d9e3f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions OpenEXR/IlmImfExamples/previewImageExamples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ gamma (float x)
//

x = pow (5.5555f * max (0.f, x), 0.4545f) * 84.66f;
return (unsigned char) clamp (x, 0.f, 255.f);
return (unsigned char) IMATH_NAMESPACE::clamp (x, 0.f, 255.f);
}


Expand Down Expand Up @@ -96,7 +96,7 @@ makePreviewImage (const Array2D <Rgba> &pixels,
outPixel.r = gamma (inPixel.r);
outPixel.g = gamma (inPixel.g);
outPixel.b = gamma (inPixel.b);
outPixel.a = int (clamp (inPixel.a * 255.f, 0.f, 255.f) + 0.5f);
outPixel.a = int (IMATH_NAMESPACE::clamp (inPixel.a * 255.f, 0.f, 255.f) + 0.5f);
}
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ writeRgbaWithPreview2 (const char fileName[],
outPixel.r = gamma (inPixel.r);
outPixel.g = gamma (inPixel.g);
outPixel.b = gamma (inPixel.b);
outPixel.a = int (clamp (inPixel.a * 255.f, 0.f, 255.f) + 0.5f);
outPixel.a = int (IMATH_NAMESPACE::clamp (inPixel.a * 255.f, 0.f, 255.f) + 0.5f);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions OpenEXR/exrmakepreview/makePreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ gamma (half h, float m)
if (x > 1)
x = 1 + knee (x - 1, 0.184874f);

return (unsigned char) (clamp (Math<float>::pow (x, 0.4545f) * 84.66f,
return (unsigned char) (IMATH_NAMESPACE::clamp (Math<float>::pow (x, 0.4545f) * 84.66f,
0.f,
255.f));
}
Expand Down Expand Up @@ -122,7 +122,7 @@ generatePreview (const char inFileName[],

float fx = (previewWidth > 0)? (float (w - 1) / (previewWidth - 1)): 1;
float fy = (previewHeight > 0)? (float (h - 1) / (previewHeight - 1)): 1;
float m = Math<float>::pow (2.f, clamp (exposure + 2.47393f, -20.f, 20.f));
float m = Math<float>::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));

for (int y = 0; y < previewHeight; ++y)
{
Expand All @@ -134,7 +134,7 @@ generatePreview (const char inFileName[],
preview.r = gamma (pixel.r, m);
preview.g = gamma (pixel.g, m);
preview.b = gamma (pixel.b, m);
preview.a = int (clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);
preview.a = int (IMATH_NAMESPACE::clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions OpenEXR/exrmaketiled/makeTiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ sampleX (const TypedImageChannel<T> &channel,

case CLAMP:

xs = clamp (xs, 0, w - 1);
xt = clamp (xt, 0, w - 1);
xs = IMATH_NAMESPACE::clamp (xs, 0, w - 1);
xt = IMATH_NAMESPACE::clamp (xt, 0, w - 1);
vs = channel (xs, y);
vt = channel (xt, y);
break;
Expand Down Expand Up @@ -195,8 +195,8 @@ sampleY (const TypedImageChannel<T> &channel,

case CLAMP:

ys = clamp (ys, 0, h - 1);
yt = clamp (yt, 0, h - 1);
ys = IMATH_NAMESPACE::clamp (ys, 0, h - 1);
yt = IMATH_NAMESPACE::clamp (yt, 0, h - 1);
vs = channel (x, ys);
vt = channel (x, yt);
break;
Expand Down

0 comments on commit 6d9e3f6

Please sign in to comment.