OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #define SkColorSpacePrintf(...) |
| 9 |
| 10 inline bool color_space_almost_equal(float a, float b) { |
| 11 return SkTAbs(a - b) < 0.01f; |
| 12 } |
| 13 |
| 14 inline void set_gamma_value(SkGammaCurve* gamma, float value) { |
| 15 if (color_space_almost_equal(2.2f, value)) { |
| 16 gamma->fNamed = SkColorSpace::k2Dot2Curve_GammaNamed; |
| 17 } else if (color_space_almost_equal(1.0f, value)) { |
| 18 gamma->fNamed = SkColorSpace::kLinear_GammaNamed; |
| 19 } else if (color_space_almost_equal(0.0f, value)) { |
| 20 SkColorSpacePrintf("Treating invalid zero gamma as linear."); |
| 21 gamma->fNamed = SkColorSpace::kLinear_GammaNamed; |
| 22 } else { |
| 23 gamma->fValue = value; |
| 24 } |
| 25 } |
OLD | NEW |