Mercurial > hg > svgui
comparison layer/ColourMapper.cpp @ 904:e0f08e108064 cxx11
Move to using double rather than float for floating-point calculations (float only for storage); more build fixes
author | Chris Cannam |
---|---|
date | Mon, 09 Mar 2015 12:02:10 +0000 |
parents | a1226b3b7925 |
children | 6e2a034f7117 |
comparison
equal
deleted
inserted
replaced
903:1757933ce5a7 | 904:e0f08e108064 |
---|---|
118 h = blue; | 118 h = blue; |
119 s = 1.0; | 119 s = 1.0; |
120 v = norm * 2.0; | 120 v = norm * 2.0; |
121 if (v > 1.0) { | 121 if (v > 1.0) { |
122 v = 1.0; | 122 v = 1.0; |
123 s = 1.0 - (sqrtf(norm) - 0.707) * 3.413; | 123 s = 1.0 - (sqrt(norm) - 0.707) * 3.413; |
124 if (s < 0.0) s = 0.0; | 124 if (s < 0.0) s = 0.0; |
125 if (s > 1.0) s = 1.0; | 125 if (s > 1.0) s = 1.0; |
126 } | 126 } |
127 break; | 127 break; |
128 | 128 |
186 | 186 |
187 case HighGain: | 187 case HighGain: |
188 if (norm <= 1.0 / 256.0) { | 188 if (norm <= 1.0 / 256.0) { |
189 norm = 0.0; | 189 norm = 0.0; |
190 } else { | 190 } else { |
191 norm = 0.1f + (powf(((norm - 0.5) * 2.0), 3.0) + 1.0) / 2.081; | 191 norm = 0.1f + (pow(((norm - 0.5) * 2.0), 3.0) + 1.0) / 2.081; |
192 } | 192 } |
193 // now as for Sunset | 193 // now as for Sunset |
194 r = (norm - 0.24) * 2.38; | 194 r = (norm - 0.24) * 2.38; |
195 if (r > 1.0) r = 1.0; | 195 if (r > 1.0) r = 1.0; |
196 if (r < 0.0) r = 0.0; | 196 if (r < 0.0) r = 0.0; |