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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 uint32_t profileSize = *((uint32_t*) data); | 298 uint32_t profileSize = *((uint32_t*) data); |
299 data = SkTAddOffset<const void>(data, sizeof(uint32_t)); | 299 data = SkTAddOffset<const void>(data, sizeof(uint32_t)); |
300 length -= sizeof(uint32_t); | 300 length -= sizeof(uint32_t); |
301 if (length < profileSize) { | 301 if (length < profileSize) { |
302 return nullptr; | 302 return nullptr; |
303 } | 303 } |
304 | 304 |
305 return NewICC(data, profileSize); | 305 return NewICC(data, profileSize); |
306 } | 306 } |
| 307 |
| 308 bool SkColorSpace::gammasAreMatching() const { |
| 309 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 310 SkASSERT(gammas); |
| 311 return gammas->fRedData == gammas->fGreenData && gammas->fGreenData == gamma
s->fBlueData; |
| 312 } |
| 313 |
| 314 bool SkColorSpace::gammasAreNamed() const { |
| 315 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 316 SkASSERT(gammas); |
| 317 return gammas->fRedType == SkGammas::Type::kNamed_Type && |
| 318 gammas->fGreenType == SkGammas::Type::kNamed_Type && |
| 319 gammas->fBlueType == SkGammas::Type::kNamed_Type; |
| 320 } |
| 321 |
| 322 bool SkColorSpace::gammasAreValues() const { |
| 323 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 324 SkASSERT(gammas); |
| 325 return gammas->fRedType == SkGammas::Type::kValue_Type && |
| 326 gammas->fGreenType == SkGammas::Type::kValue_Type && |
| 327 gammas->fBlueType == SkGammas::Type::kValue_Type; |
| 328 } |
| 329 |
| 330 bool SkColorSpace::gammasAreTables() const { |
| 331 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 332 SkASSERT(gammas); |
| 333 return gammas->fRedType == SkGammas::Type::kTable_Type && |
| 334 gammas->fGreenType == SkGammas::Type::kTable_Type && |
| 335 gammas->fBlueType == SkGammas::Type::kTable_Type; |
| 336 } |
| 337 |
| 338 bool SkColorSpace::gammasAreParams() const { |
| 339 const SkGammas* gammas = as_CSB(this)->gammas(); |
| 340 SkASSERT(gammas); |
| 341 return gammas->fRedType == SkGammas::Type::kParam_Type && |
| 342 gammas->fGreenType == SkGammas::Type::kParam_Type && |
| 343 gammas->fBlueType == SkGammas::Type::kParam_Type; |
| 344 } |
OLD | NEW |