Skip to content

Commit 6035ad8

Browse files
committed
add include header and use std::round
1 parent 575145d commit 6035ad8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

csscolorparser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <vector>
2929
#include <sstream>
3030
#include <cmath>
31+
#include <algorithm>
3132
#include <map>
3233

3334
using namespace CSSColorParser;
@@ -113,7 +114,7 @@ const std::map<std::string, Color> kCSSColorTable = {
113114

114115
template <typename T>
115116
uint8_t clamp_css_byte(T i) { // Clamp to integer 0 .. 255.
116-
i = round(i); // Seems to be what Chrome does (vs truncation).
117+
i = std::round(i); // Seems to be what Chrome does (vs truncation).
117118
return i < 0 ? 0 : i > 255 ? 255 : i;
118119
}
119120

0 commit comments

Comments
 (0)