| 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/transform.h" | 10 #include "ui/gfx/transform.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 ColorSpace::MatrixID::SMPTE170M, ColorSpace::MatrixID::SMPTE240M, | 46 ColorSpace::MatrixID::SMPTE170M, ColorSpace::MatrixID::SMPTE240M, |
| 47 | 47 |
| 48 // YCOCG produces lots of negative values which isn't compatible with many | 48 // YCOCG produces lots of negative values which isn't compatible with many |
| 49 // transfer functions. | 49 // transfer functions. |
| 50 // TODO(hubbe): Test this separately. | 50 // TODO(hubbe): Test this separately. |
| 51 // ColorSpace::MatrixID::YCOCG, | 51 // ColorSpace::MatrixID::YCOCG, |
| 52 ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_CL, | 52 ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_CL, |
| 53 ColorSpace::MatrixID::YDZDX, | 53 ColorSpace::MatrixID::YDZDX, |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::FULL, | 56 ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::UNSPECIFIED, |
| 57 ColorSpace::RangeID::LIMITED}; | 57 ColorSpace::RangeID::FULL, |
| 58 ColorSpace::RangeID::LIMITED, |
| 59 ColorSpace::RangeID::DERIVED}; |
| 58 | 60 |
| 59 TEST(SimpleColorSpace, BT709toSRGB) { | 61 TEST(SimpleColorSpace, BT709toSRGB) { |
| 60 ColorSpace bt709 = ColorSpace::CreateREC709(); | 62 ColorSpace bt709 = ColorSpace::CreateREC709(); |
| 61 ColorSpace sRGB = ColorSpace::CreateSRGB(); | 63 ColorSpace sRGB = ColorSpace::CreateSRGB(); |
| 62 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( | 64 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( |
| 63 bt709, sRGB, ColorTransform::Intent::INTENT_ABSOLUTE)); | 65 bt709, sRGB, ColorTransform::Intent::INTENT_ABSOLUTE)); |
| 64 | 66 |
| 65 ColorTransform::TriStim tmp(16.0f / 255.0f, 0.5f, 0.5f); | 67 ColorTransform::TriStim tmp(16.0f / 255.0f, 0.5f, 0.5f); |
| 66 t->transform(&tmp, 1); | 68 t->transform(&tmp, 1); |
| 67 EXPECT_NEAR(tmp.x(), 0.0f, 0.001f); | 69 EXPECT_NEAR(tmp.x(), 0.0f, 0.001f); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 testing::ValuesIn(all_ranges))); | 527 testing::ValuesIn(all_ranges))); |
| 526 | 528 |
| 527 INSTANTIATE_TEST_CASE_P( | 529 INSTANTIATE_TEST_CASE_P( |
| 528 C, | 530 C, |
| 529 ColorSpaceTest, | 531 ColorSpaceTest, |
| 530 testing::Combine(testing::ValuesIn(all_primaries), | 532 testing::Combine(testing::ValuesIn(all_primaries), |
| 531 testing::Values(ColorSpace::TransferID::BT709), | 533 testing::Values(ColorSpace::TransferID::BT709), |
| 532 testing::ValuesIn(all_matrices), | 534 testing::ValuesIn(all_matrices), |
| 533 testing::ValuesIn(all_ranges))); | 535 testing::ValuesIn(all_ranges))); |
| 534 } // namespace | 536 } // namespace |
| OLD | NEW |