Revert "Make ICCProfile no longer store a ColorSpace directly"
This reverts commit ac3c37d52e71853c54921c488cc52b7a9ebfb2fb.
Reason for revert: crbug.com/780848, crbug.com/780415
Original change's description:
> Make ICCProfile no longer store a ColorSpace directly
>
> Make ICCProfile store the primaries and transfer function that it
> read or computed directly, rather than storing a ColorSpace object.
> Construct the ColorSpace object when requested, rather than storing it.
>
> Store an approximate (or guessed) primary matrix and transfer function
> for ICC_BASED ColorSpace objects. When computing the parametric
> approximation of an ICC_BASED ColorSpace object, use these values
> directly, rather than having to look them up from original ICCProfile.
>
> Bug: 766736
> Change-Id: I21d6dfaa38706f814f6c9dd54517806e99366113
> Reviewed-on: https://chromium-review.googlesource.com/745311
> Reviewed-by: Fredrik Hubinette <[email protected]>
> Commit-Queue: ccameron <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#512958}
[email protected],[email protected]
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 766736
Change-Id: Ie36929800ab8f748cfc331b1a6ccda328c6559f8
Reviewed-on: https://chromium-review.googlesource.com/752061
Reviewed-by: ccameron <[email protected]>
Commit-Queue: ccameron <[email protected]>
Cr-Commit-Position: refs/heads/master@{#513624}
diff --git a/ui/gfx/icc_profile_unittest.cc b/ui/gfx/icc_profile_unittest.cc
index 186fceb..d9a008d 100644
--- a/ui/gfx/icc_profile_unittest.cc
+++ b/ui/gfx/icc_profile_unittest.cc
@@ -32,12 +32,8 @@
EXPECT_EQ(icc_profile.GetColorSpace().ToSkColorSpace().get(),
sk_color_space.get());
// The parametric generating code should recognize that this is SRGB.
- EXPECT_EQ(icc_profile.GetColorSpace().GetParametricApproximation(),
- ColorSpace::CreateSRGB());
- EXPECT_EQ(icc_profile.GetColorSpace()
- .GetParametricApproximation()
- .ToSkColorSpace()
- .get(),
+ EXPECT_EQ(icc_profile.GetParametricColorSpace(), ColorSpace::CreateSRGB());
+ EXPECT_EQ(icc_profile.GetParametricColorSpace().ToSkColorSpace().get(),
sk_color_space.get());
// The generated color space should recognize that this is SRGB.
EXPECT_EQ(color_space.ToSkColorSpace().get(), sk_color_space.get());
@@ -82,8 +78,7 @@
// This ICC profile has three transfer functions that differ enough that the
// parametric color space is considered inaccurate.
ICCProfile multi_tr_fn = ICCProfileForTestingNoAnalyticTrFn();
- EXPECT_NE(multi_tr_fn.GetColorSpace(),
- multi_tr_fn.GetColorSpace().GetParametricApproximation());
+ EXPECT_NE(multi_tr_fn.GetColorSpace(), multi_tr_fn.GetParametricColorSpace());
ICCProfile multi_tr_fn_color_space;
EXPECT_TRUE(
@@ -91,40 +86,35 @@
EXPECT_EQ(multi_tr_fn_color_space, multi_tr_fn);
ICCProfile multi_tr_fn_parametric_color_space;
- EXPECT_TRUE(
- multi_tr_fn.GetColorSpace().GetParametricApproximation().GetICCProfile(
- &multi_tr_fn_parametric_color_space));
+ EXPECT_TRUE(multi_tr_fn.GetParametricColorSpace().GetICCProfile(
+ &multi_tr_fn_parametric_color_space));
EXPECT_NE(multi_tr_fn_parametric_color_space, multi_tr_fn);
// This ICC profile has a transfer function with T(1) that is greater than 1
// in the approximation, but is still close enough to be considered accurate.
ICCProfile overshoot = ICCProfileForTestingOvershoot();
- EXPECT_EQ(overshoot.GetColorSpace(),
- overshoot.GetColorSpace().GetParametricApproximation());
+ EXPECT_EQ(overshoot.GetColorSpace(), overshoot.GetParametricColorSpace());
ICCProfile overshoot_color_space;
EXPECT_TRUE(overshoot.GetColorSpace().GetICCProfile(&overshoot_color_space));
EXPECT_EQ(overshoot_color_space, overshoot);
ICCProfile overshoot_parametric_color_space;
- EXPECT_TRUE(
- overshoot.GetColorSpace().GetParametricApproximation().GetICCProfile(
- &overshoot_parametric_color_space));
+ EXPECT_TRUE(overshoot.GetParametricColorSpace().GetICCProfile(
+ &overshoot_parametric_color_space));
EXPECT_EQ(overshoot_parametric_color_space, overshoot);
// This ICC profile is precisely represented by the parametric color space.
ICCProfile accurate = ICCProfileForTestingAdobeRGB();
- EXPECT_EQ(accurate.GetColorSpace(),
- accurate.GetColorSpace().GetParametricApproximation());
+ EXPECT_EQ(accurate.GetColorSpace(), accurate.GetParametricColorSpace());
ICCProfile accurate_color_space;
EXPECT_TRUE(accurate.GetColorSpace().GetICCProfile(&accurate_color_space));
EXPECT_EQ(accurate_color_space, accurate);
ICCProfile accurate_parametric_color_space;
- EXPECT_TRUE(
- accurate.GetColorSpace().GetParametricApproximation().GetICCProfile(
- &accurate_parametric_color_space));
+ EXPECT_TRUE(accurate.GetParametricColorSpace().GetICCProfile(
+ &accurate_parametric_color_space));
EXPECT_EQ(accurate_parametric_color_space, accurate);
// This ICC profile has only an A2B representation. We cannot create an
@@ -146,15 +136,12 @@
ICCProfile::FromData(bad_data.data(), bad_data.size());
EXPECT_FALSE(garbage_profile.IsValid());
EXPECT_FALSE(garbage_profile.GetColorSpace().IsValid());
- EXPECT_FALSE(
- garbage_profile.GetColorSpace().GetParametricApproximation().IsValid());
+ EXPECT_FALSE(garbage_profile.GetParametricColorSpace().IsValid());
ICCProfile default_ctor_profile;
EXPECT_FALSE(default_ctor_profile.IsValid());
EXPECT_FALSE(default_ctor_profile.GetColorSpace().IsValid());
- EXPECT_FALSE(default_ctor_profile.GetColorSpace()
- .GetParametricApproximation()
- .IsValid());
+ EXPECT_FALSE(default_ctor_profile.GetParametricColorSpace().IsValid());
}
TEST(ICCProfile, GenericRGB) {