Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: ui/gfx/color_transform_unittest.cc

Issue 2691213007: color: Don't use QCMS for transforms unless necessary (Closed)
Patch Set: Incorporate review feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/color_transform.cc ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/color_transform.cc ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698