| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 // It's important to check fProfileData before named gammas. Some profiles
may have named | 350 // It's important to check fProfileData before named gammas. Some profiles
may have named |
| 351 // gammas, but also include other wacky features that cause us to save the d
ata. | 351 // gammas, but also include other wacky features that cause us to save the d
ata. |
| 352 switch (src->fGammaNamed) { | 352 switch (src->fGammaNamed) { |
| 353 case kSRGB_GammaNamed: | 353 case kSRGB_GammaNamed: |
| 354 case k2Dot2Curve_GammaNamed: | 354 case k2Dot2Curve_GammaNamed: |
| 355 case kLinear_GammaNamed: | 355 case kLinear_GammaNamed: |
| 356 return (src->fGammaNamed == dst->fGammaNamed) && (src->fToXYZD50 ==
dst->fToXYZD50); | 356 return (src->fGammaNamed == dst->fGammaNamed) && (src->fToXYZD50 ==
dst->fToXYZD50); |
| 357 default: | 357 default: |
| 358 // If |src| does not have a named gamma, fProfileData should be non-
null. | 358 // If |src| does not have a named gamma, fProfileData should be non-
null. |
| 359 SkASSERT(false); | 359 // FIXME (msarett): We may hit this case on pngs that specify float
gammas. |
| 360 // Gamma can be non-standard, but we don't have a p
rofile |
| 361 // to fall back on. What do we do? |
| 360 return false; | 362 return false; |
| 361 } | 363 } |
| 362 } | 364 } |
| 363 | 365 |
| 364 bool SkColorSpace::gammasAreMatching() const { | 366 bool SkColorSpace::gammasAreMatching() const { |
| 365 const SkGammas* gammas = as_CSB(this)->gammas(); | 367 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 366 SkASSERT(gammas); | 368 SkASSERT(gammas); |
| 367 return gammas->fRedType == gammas->fGreenType && gammas->fGreenType == gamma
s->fBlueType && | 369 return gammas->fRedType == gammas->fGreenType && gammas->fGreenType == gamma
s->fBlueType && |
| 368 gammas->fRedData == gammas->fGreenData && gammas->fGreenData == gamma
s->fBlueData; | 370 gammas->fRedData == gammas->fGreenData && gammas->fGreenData == gamma
s->fBlueData; |
| 369 } | 371 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 392 gammas->fBlueType == SkGammas::Type::kTable_Type; | 394 gammas->fBlueType == SkGammas::Type::kTable_Type; |
| 393 } | 395 } |
| 394 | 396 |
| 395 bool SkColorSpace::gammasAreParams() const { | 397 bool SkColorSpace::gammasAreParams() const { |
| 396 const SkGammas* gammas = as_CSB(this)->gammas(); | 398 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 397 SkASSERT(gammas); | 399 SkASSERT(gammas); |
| 398 return gammas->fRedType == SkGammas::Type::kParam_Type && | 400 return gammas->fRedType == SkGammas::Type::kParam_Type && |
| 399 gammas->fGreenType == SkGammas::Type::kParam_Type && | 401 gammas->fGreenType == SkGammas::Type::kParam_Type && |
| 400 gammas->fBlueType == SkGammas::Type::kParam_Type; | 402 gammas->fBlueType == SkGammas::Type::kParam_Type; |
| 401 } | 403 } |
| OLD | NEW |