diff options
author | Norbert Preining <norbert@preining.info> | 2019-10-29 03:00:39 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-10-29 03:00:39 +0000 |
commit | 97f5151099967e6c823d640a90d87bca92c44035 (patch) | |
tree | 685caa49488599f87d0caa4e972833b2263d8567 /dviware/dvisvgm/src/Color.cpp | |
parent | 25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff) |
CTAN sync 201910290300
Diffstat (limited to 'dviware/dvisvgm/src/Color.cpp')
-rw-r--r-- | dviware/dvisvgm/src/Color.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dviware/dvisvgm/src/Color.cpp b/dviware/dvisvgm/src/Color.cpp index 949fcba56c..de7e9074ab 100644 --- a/dviware/dvisvgm/src/Color.cpp +++ b/dviware/dvisvgm/src/Color.cpp @@ -40,7 +40,7 @@ const Color Color::TRANSPARENT(uint32_t(0xff000000)); static inline uint8_t double_to_byte (double v) { v = max(0.0, min(1.0, v)); - return uint8_t(floor(255*v+0.5)); + return uint8_t(round(255.0*v)); } @@ -632,14 +632,14 @@ double Color::deltaE (const Color &c) const { c.getLab(l2, a2, b2); const double deltaL = l2-l1; const double lBar = (l1+l2)/2; - const double c1 = sqrt(a1*a1 + b1*b1); - const double c2 = sqrt(a2*a2 + b2*b2); + const double c1 = hypot(a1, b1); + const double c2 = hypot(a2, b2); const double cBar = (c1+c2)/2.0; const double g = (1.0-sqrt(pow(cBar, 7.0)/(pow(cBar, 7.0)+6103515625.0)))/2.0; const double aa1 = a1*(1.0+g); const double aa2 = a2*(1.0+g); - const double cc1 = sqrt(aa1*aa1 + b1*b1); - const double cc2 = sqrt(aa2*aa2 + b2*b2); + const double cc1 = hypot(aa1, b1); + const double cc2 = hypot(aa2, b2); const double ccBar = (cc1+cc2)/2.0; const double deltaCC = cc2-cc1; double hh1 = atan2(b1, aa1); |