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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 static void test_xform(skiatest::Reporter* r, const sk_sp<SkGammas>& gammas) { | 24 static void test_xform(skiatest::Reporter* r, const sk_sp<SkGammas>& gammas) { |
25 // Arbitrary set of 10 pixels | 25 // Arbitrary set of 10 pixels |
26 constexpr int width = 10; | 26 constexpr int width = 10; |
27 constexpr uint32_t srcPixels[width] = { | 27 constexpr uint32_t srcPixels[width] = { |
28 0xFFABCDEF, 0xFF146829, 0xFF382759, 0xFF184968, 0xFFDE8271, | 28 0xFFABCDEF, 0xFF146829, 0xFF382759, 0xFF184968, 0xFFDE8271, |
29 0xFF32AB52, 0xFF0383BC, 0xFF000000, 0xFFFFFFFF, 0xFFDDEEFF, }; | 29 0xFF32AB52, 0xFF0383BC, 0xFF000000, 0xFFFFFFFF, 0xFFDDEEFF, }; |
30 uint32_t dstPixels[width]; | 30 uint32_t dstPixels[width]; |
31 | 31 |
32 // Identity matrix | 32 // Identity matrix |
33 SkMatrix44 srcToDst = SkMatrix44::I(); | 33 SkMatrix44 srcToDst(SkMatrix44::kIdentity_Constructor); |
34 | 34 |
35 // Create and perform xform | 35 // Create and perform xform |
36 std::unique_ptr<SkColorSpaceXform> xform( | 36 std::unique_ptr<SkColorSpaceXform> xform( |
37 ColorSpaceXformTest::CreateDefaultXform(gammas, srcToDst, gammas)); | 37 ColorSpaceXformTest::CreateDefaultXform(gammas, srcToDst, gammas)); |
38 xform->xform_RGB1_8888(dstPixels, srcPixels, width); | 38 xform->xform_RGB1_8888(dstPixels, srcPixels, width); |
39 | 39 |
40 // Since the matrix is the identity, and the gamma curves match, the pixels | 40 // Since the matrix is the identity, and the gamma curves match, the pixels |
41 // should be unchanged. | 41 // should be unchanged. |
42 for (int i = 0; i < width; i++) { | 42 for (int i = 0; i < width; i++) { |
43 // TODO (msarett): | 43 // TODO (msarett): |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) { | 96 DEF_TEST(ColorSpaceXform_ExponentialGamma, r) { |
97 // Exponential gamma curves | 97 // Exponential gamma curves |
98 SkGammaCurve red, green, blue; | 98 SkGammaCurve red, green, blue; |
99 red.fValue = green.fValue = blue.fValue = 4.0f; | 99 red.fValue = green.fValue = blue.fValue = 4.0f; |
100 sk_sp<SkGammas> gammas = | 100 sk_sp<SkGammas> gammas = |
101 sk_make_sp<SkGammas>(std::move(red), std::move(green), std::move(blu
e)); | 101 sk_make_sp<SkGammas>(std::move(red), std::move(green), std::move(blu
e)); |
102 test_xform(r, gammas); | 102 test_xform(r, gammas); |
103 } | 103 } |
OLD | NEW |