| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkColorSpace_Base_DEFINED | 8 #ifndef SkColorSpace_Base_DEFINED |
| 9 #define SkColorSpace_Base_DEFINED | 9 #define SkColorSpace_Base_DEFINED |
| 10 | 10 |
| 11 #include "SkColorSpace.h" | 11 #include "SkColorSpace.h" |
| 12 #include "SkData.h" | 12 #include "SkData.h" |
| 13 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
| 14 | 14 |
| 15 struct SkGammaCurve { | 15 struct SkGammaCurve { |
| 16 bool isValue() const { | 16 bool isValue() const { |
| 17 bool result = (0.0f != fValue); | 17 bool result = (0.0f != fValue); |
| 18 SkASSERT(!result || (0 == fTableSize)); | 18 SkASSERT(!result || (0 == fTableSize)); |
| 19 SkASSERT(!result || (0.0f == fG)); | 19 SkASSERT(!result || (0.0f == fG && 0.0f == fE)); |
| 20 return result; | 20 return result; |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool isTable() const { | 23 bool isTable() const { |
| 24 bool result = (0 != fTableSize); | 24 bool result = (0 != fTableSize); |
| 25 SkASSERT(!result || (0.0f == fValue)); | 25 SkASSERT(!result || (0.0f == fValue)); |
| 26 SkASSERT(!result || (0.0f == fG)); | 26 SkASSERT(!result || (0.0f == fG && 0.0f == fE)); |
| 27 SkASSERT(!result || fTable); | 27 SkASSERT(!result || fTable); |
| 28 return result; | 28 return result; |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool isParametric() const { | 31 bool isParametric() const { |
| 32 bool result = (0.0f != fG); | 32 bool result = (0.0f != fG || 0.0f != fE); |
| 33 SkASSERT(!result || (0.0f == fValue)); | 33 SkASSERT(!result || (0.0f == fValue)); |
| 34 SkASSERT(!result || (0 == fTableSize)); | 34 SkASSERT(!result || (0 == fTableSize)); |
| 35 return result; | 35 return result; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // We have three different ways to represent gamma. | 38 // We have three different ways to represent gamma. |
| 39 // (1) A single value: | 39 // (1) A single value: |
| 40 float fValue; | 40 float fValue; |
| 41 | 41 |
| 42 // (2) A lookup table: | 42 // (2) A lookup table: |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) { | 151 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) { |
| 152 return static_cast<const SkColorSpace_Base*>(colorSpace); | 152 return static_cast<const SkColorSpace_Base*>(colorSpace); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { | 155 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { |
| 156 return static_cast<SkColorSpace_Base*>(colorSpace.get()); | 156 return static_cast<SkColorSpace_Base*>(colorSpace.get()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 #endif | 159 #endif |
| OLD | NEW |