| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 0xFFABCDEF, 0xFF146829, 0xFF382759, 0xFF184968, 0xFFDE8271, | 38 0xFFABCDEF, 0xFF146829, 0xFF382759, 0xFF184968, 0xFFDE8271, |
| 39 0xFF32AB52, 0xFF0383BC, 0xFF000102, 0xFFFFFFFF, 0xFFDDEEFF, }; | 39 0xFF32AB52, 0xFF0383BC, 0xFF000102, 0xFFFFFFFF, 0xFFDDEEFF, }; |
| 40 uint32_t dstPixels[width]; | 40 uint32_t dstPixels[width]; |
| 41 | 41 |
| 42 // Identity matrix | 42 // Identity matrix |
| 43 SkMatrix44 srcToDst = SkMatrix44::I(); | 43 SkMatrix44 srcToDst = SkMatrix44::I(); |
| 44 | 44 |
| 45 // Create and perform xform | 45 // Create and perform xform |
| 46 std::unique_ptr<SkColorSpaceXform> xform = | 46 std::unique_ptr<SkColorSpaceXform> xform = |
| 47 ColorSpaceXformTest::CreateDefaultXform(gammas, srcToDst, gammas); | 47 ColorSpaceXformTest::CreateDefaultXform(gammas, srcToDst, gammas); |
| 48 xform->xform_RGB1_8888(dstPixels, srcPixels, width); | 48 xform->applyTo8888(dstPixels, srcPixels, width); |
| 49 | 49 |
| 50 // Since the matrix is the identity, and the gamma curves match, the pixels | 50 // Since the matrix is the identity, and the gamma curves match, the pixels |
| 51 // should be unchanged. | 51 // should be unchanged. |
| 52 for (int i = 0; i < width; i++) { | 52 for (int i = 0; i < width; i++) { |
| 53 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 0) & 0xFF), | 53 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 0) & 0xFF), |
| 54 SkGetPackedR32(dstPixels[i]))); | 54 SkGetPackedR32(dstPixels[i]))); |
| 55 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 8) & 0xFF), | 55 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 8) & 0xFF), |
| 56 SkGetPackedG32(dstPixels[i]))); | 56 SkGetPackedG32(dstPixels[i]))); |
| 57 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 16) & 0xFF), | 57 REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 16) & 0xFF), |
| 58 SkGetPackedB32(dstPixels[i]))); | 58 SkGetPackedB32(dstPixels[i]))); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) { | 108 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) { |
| 109 // Exponential gamma curves | 109 // Exponential gamma curves |
| 110 SkGammaCurve red, green, blue; | 110 SkGammaCurve red, green, blue; |
| 111 red.fValue = green.fValue = blue.fValue = 1.4f; | 111 red.fValue = green.fValue = blue.fValue = 1.4f; |
| 112 sk_sp<SkGammas> gammas = | 112 sk_sp<SkGammas> gammas = |
| 113 sk_make_sp<SkGammas>(std::move(red), std::move(green), std::move(blu
e)); | 113 sk_make_sp<SkGammas>(std::move(red), std::move(green), std::move(blu
e)); |
| 114 test_xform(r, gammas); | 114 test_xform(r, gammas); |
| 115 } | 115 } |
| OLD | NEW |