| 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 #include "SkColorSpace.h" | 8 #include "SkColorSpace.h" |
| 9 #include "SkColorSpace_Base.h" | 9 #include "SkColorSpace_Base.h" |
| 10 #include "SkColorSpacePriv.h" | 10 #include "SkColorSpacePriv.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 static SkOnce sRGBOnce; | 129 static SkOnce sRGBOnce; |
| 130 static sk_sp<SkColorSpace> sRGB; | 130 static sk_sp<SkColorSpace> sRGB; |
| 131 static SkOnce adobeRGBOnce; | 131 static SkOnce adobeRGBOnce; |
| 132 static sk_sp<SkColorSpace> adobeRGB; | 132 static sk_sp<SkColorSpace> adobeRGB; |
| 133 | 133 |
| 134 switch (named) { | 134 switch (named) { |
| 135 case kSRGB_Named: { | 135 case kSRGB_Named: { |
| 136 sRGBOnce([] { | 136 sRGBOnce([] { |
| 137 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); | 137 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); |
| 138 srgbToxyzD50.set3x3RowMajorf(gSRGB_toXYZD50); | 138 srgbToxyzD50.set3x3RowMajorf(gSRGB_toXYZD50); |
| 139 |
| 140 // Force the mutable type mask to be computed. This avoids race
s. |
| 141 (void)srgbToxyzD50.getType(); |
| 139 sRGB.reset(new SkColorSpace_Base(kSRGB_GammaNamed, srgbToxyzD50,
kSRGB_Named)); | 142 sRGB.reset(new SkColorSpace_Base(kSRGB_GammaNamed, srgbToxyzD50,
kSRGB_Named)); |
| 140 }); | 143 }); |
| 141 return sRGB; | 144 return sRGB; |
| 142 } | 145 } |
| 143 case kAdobeRGB_Named: { | 146 case kAdobeRGB_Named: { |
| 144 adobeRGBOnce([] { | 147 adobeRGBOnce([] { |
| 145 SkMatrix44 adobergbToxyzD50(SkMatrix44::kUninitialized_Construct
or); | 148 SkMatrix44 adobergbToxyzD50(SkMatrix44::kUninitialized_Construct
or); |
| 146 adobergbToxyzD50.set3x3RowMajorf(gAdobeRGB_toXYZD50); | 149 adobergbToxyzD50.set3x3RowMajorf(gAdobeRGB_toXYZD50); |
| 150 |
| 151 // Force the mutable type mask to be computed. This avoids race
s. |
| 152 (void)adobergbToxyzD50.getType(); |
| 147 adobeRGB.reset(new SkColorSpace_Base(k2Dot2Curve_GammaNamed, ado
bergbToxyzD50, | 153 adobeRGB.reset(new SkColorSpace_Base(k2Dot2Curve_GammaNamed, ado
bergbToxyzD50, |
| 148 kAdobeRGB_Named)); | 154 kAdobeRGB_Named)); |
| 149 }); | 155 }); |
| 150 return adobeRGB; | 156 return adobeRGB; |
| 151 } | 157 } |
| 152 default: | 158 default: |
| 153 break; | 159 break; |
| 154 } | 160 } |
| 155 return nullptr; | 161 return nullptr; |
| 156 } | 162 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 gammas->fBlueType == SkGammas::Type::kTable_Type; | 400 gammas->fBlueType == SkGammas::Type::kTable_Type; |
| 395 } | 401 } |
| 396 | 402 |
| 397 bool SkColorSpace::gammasAreParams() const { | 403 bool SkColorSpace::gammasAreParams() const { |
| 398 const SkGammas* gammas = as_CSB(this)->gammas(); | 404 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 399 SkASSERT(gammas); | 405 SkASSERT(gammas); |
| 400 return gammas->fRedType == SkGammas::Type::kParam_Type && | 406 return gammas->fRedType == SkGammas::Type::kParam_Type && |
| 401 gammas->fGreenType == SkGammas::Type::kParam_Type && | 407 gammas->fGreenType == SkGammas::Type::kParam_Type && |
| 402 gammas->fBlueType == SkGammas::Type::kParam_Type; | 408 gammas->fBlueType == SkGammas::Type::kParam_Type; |
| 403 } | 409 } |
| OLD | NEW |