OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "ui/gfx/color_space.h" | 7 #include "ui/gfx/color_space.h" |
8 #include "ui/gfx/color_transform.h" | 8 #include "ui/gfx/color_transform.h" |
9 #include "ui/gfx/icc_profile.h" | 9 #include "ui/gfx/icc_profile.h" |
10 #include "ui/gfx/test/icc_profiles.h" | 10 #include "ui/gfx/test/icc_profiles.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ICCProfile srgb_icc_profile = ICCProfileForTestingSRGB(); | 90 ICCProfile srgb_icc_profile = ICCProfileForTestingSRGB(); |
91 ColorSpace srgb_fromicc = srgb_icc_profile.GetColorSpace(); | 91 ColorSpace srgb_fromicc = srgb_icc_profile.GetColorSpace(); |
92 ColorSpace srgb_default = gfx::ColorSpace::CreateSRGB(); | 92 ColorSpace srgb_default = gfx::ColorSpace::CreateSRGB(); |
93 ColorSpace xyzd50 = gfx::ColorSpace::CreateXYZD50(); | 93 ColorSpace xyzd50 = gfx::ColorSpace::CreateXYZD50(); |
94 | 94 |
95 value_fromicc = value_default = ColorTransform::TriStim(0.1f, 0.5f, 0.9f); | 95 value_fromicc = value_default = ColorTransform::TriStim(0.1f, 0.5f, 0.9f); |
96 | 96 |
97 std::unique_ptr<ColorTransform> toxyzd50_fromicc( | 97 std::unique_ptr<ColorTransform> toxyzd50_fromicc( |
98 ColorTransform::NewColorTransform( | 98 ColorTransform::NewColorTransform( |
99 srgb_fromicc, xyzd50, ColorTransform::Intent::INTENT_ABSOLUTE)); | 99 srgb_fromicc, xyzd50, ColorTransform::Intent::INTENT_ABSOLUTE)); |
100 // This will have 1 step, namely, the QCMS transform. | 100 // This will be converted to a transfer function and then linear transform. |
101 EXPECT_EQ(toxyzd50_fromicc->NumberOfStepsForTesting(), 1u); | 101 EXPECT_EQ(toxyzd50_fromicc->NumberOfStepsForTesting(), 2u); |
102 toxyzd50_fromicc->Transform(&value_fromicc, 1); | 102 toxyzd50_fromicc->Transform(&value_fromicc, 1); |
103 | 103 |
104 std::unique_ptr<ColorTransform> toxyzd50_default( | 104 std::unique_ptr<ColorTransform> toxyzd50_default( |
105 ColorTransform::NewColorTransform( | 105 ColorTransform::NewColorTransform( |
106 srgb_default, xyzd50, ColorTransform::Intent::INTENT_ABSOLUTE)); | 106 srgb_default, xyzd50, ColorTransform::Intent::INTENT_ABSOLUTE)); |
107 // This will have a transfer function and then linear transform. | 107 // This will have a transfer function and then linear transform. |
108 EXPECT_EQ(toxyzd50_default->NumberOfStepsForTesting(), 2u); | 108 EXPECT_EQ(toxyzd50_default->NumberOfStepsForTesting(), 2u); |
109 toxyzd50_default->Transform(&value_default, 1); | 109 toxyzd50_default->Transform(&value_default, 1); |
110 | 110 |
111 EXPECT_NEAR(value_fromicc.x(), value_default.x(), kEpsilon); | 111 EXPECT_NEAR(value_fromicc.x(), value_default.x(), kEpsilon); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 INSTANTIATE_TEST_CASE_P( | 334 INSTANTIATE_TEST_CASE_P( |
335 C, | 335 C, |
336 ColorSpaceTest, | 336 ColorSpaceTest, |
337 testing::Combine(testing::ValuesIn(all_primaries), | 337 testing::Combine(testing::ValuesIn(all_primaries), |
338 testing::Values(ColorSpace::TransferID::BT709), | 338 testing::Values(ColorSpace::TransferID::BT709), |
339 testing::ValuesIn(all_matrices), | 339 testing::ValuesIn(all_matrices), |
340 testing::ValuesIn(all_ranges), | 340 testing::ValuesIn(all_ranges), |
341 testing::ValuesIn(intents))); | 341 testing::ValuesIn(intents))); |
342 } // namespace | 342 } // namespace |
OLD | NEW |