| 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkCodec.h" | 9 #include "SkCodec.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkColorSpace.h" | 11 #include "SkColorSpace.h" |
| 12 #include "SkColorSpace_Base.h" | 12 #include "SkColorSpace_Base.h" |
| 13 #include "SkColorSpaceXform.h" | 13 #include "SkColorSpaceXform.h" |
| 14 #include "Test.h" | 14 #include "Test.h" |
| 15 | 15 |
| 16 class ColorSpaceXformTest { | 16 class ColorSpaceXformTest { |
| 17 public: | 17 public: |
| 18 static std::unique_ptr<SkColorSpaceXform> CreateIdentityXform(const sk_sp<Sk
Gammas>& gammas) { | 18 static std::unique_ptr<SkColorSpaceXform> CreateIdentityXform(const sk_sp<Sk
Gammas>& gammas) { |
| 19 // Logically we can pass any matrix here. For simplicty, pass I(), i.e.
D50 XYZ gamut. | 19 // Logically we can pass any matrix here. For simplicty, pass I(), i.e.
D50 XYZ gamut. |
| 20 sk_sp<SkColorSpace> space(new SkColorSpace_Base( | 20 sk_sp<SkColorSpace> space(new SkColorSpace_Base( |
| 21 nullptr, SkColorSpace::kNonStandard_GammaNamed, gammas, SkMatrix
::I(), nullptr)); | 21 nullptr, kNonStandard_SkGammaNamed, gammas, SkMatrix::I(), nullp
tr)); |
| 22 | 22 |
| 23 // Use special testing entry point, so we don't skip the xform, even tho
ugh src == dst. | 23 // Use special testing entry point, so we don't skip the xform, even tho
ugh src == dst. |
| 24 return SlowIdentityXform(space); | 24 return SlowIdentityXform(space); |
| 25 } | 25 } |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 static bool almost_equal(int x, int y) { | 28 static bool almost_equal(int x, int y) { |
| 29 return SkTAbs(x - y) <= 1; | 29 return SkTAbs(x - y) <= 1; |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 gammas->fGreenType = SkGammas::Type::kTable_Type; | 147 gammas->fGreenType = SkGammas::Type::kTable_Type; |
| 148 gammas->fGreenData.fTable.fSize = tableSize; | 148 gammas->fGreenData.fTable.fSize = tableSize; |
| 149 gammas->fGreenData.fTable.fOffset = 0; | 149 gammas->fGreenData.fTable.fOffset = 0; |
| 150 | 150 |
| 151 gammas->fBlueType = SkGammas::Type::kParam_Type; | 151 gammas->fBlueType = SkGammas::Type::kParam_Type; |
| 152 gammas->fBlueData.fParamOffset = sizeof(float) * tableSize; | 152 gammas->fBlueData.fParamOffset = sizeof(float) * tableSize; |
| 153 | 153 |
| 154 test_identity_xform(r, gammas); | 154 test_identity_xform(r, gammas); |
| 155 } | 155 } |
| OLD | NEW |