Chromium Code Reviews| Index: ui/gfx/color_transform.cc |
| diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc |
| index c87652b0c7f81669df4c4f6c05079196b881394c..5ce1abdac4b128a55c8c99d282d48aeb6e74c043 100644 |
| --- a/ui/gfx/color_transform.cc |
| +++ b/ui/gfx/color_transform.cc |
| @@ -788,9 +788,20 @@ class QCMSColorTransform : public ColorTransformStep { |
| ScopedQcmsProfile ColorTransformInternal::GetQCMSProfileIfNecessary( |
| const ColorSpace& color_space) { |
| - ICCProfile icc_profile; |
| - if (!ICCProfile::FromId(color_space.icc_profile_id_, true, &icc_profile)) |
| + if (color_space.primaries_ != ColorSpace::PrimaryID::ICC_PROFILE_REQUIRED || |
| + color_space.transfer_ != ColorSpace::TransferID::ICC_PROFILE_REQUIRED) { |
| return nullptr; |
| + } |
| + // TODO(ccameron): Use SkColorSpaceXform here to avoid looking up the |
| + // ICCProfile. |
| + ICCProfile icc_profile; |
| + if (!ICCProfile::FromId(color_space.icc_profile_id_, &icc_profile)) { |
| + // We needed the original ICC profile to construct this transform, but it |
|
hubbe
2017/03/13 17:59:09
This seems unacceptable to me.
In general, I don't
ccameron
2017/03/13 20:34:18
It denotes that the color space cannot be represen
hubbe
2017/03/13 20:38:56
I think we should have some sort of approximation
ccameron
2017/03/14 10:19:54
This is to ensure well-defined behavior in a vanis
hubbe
2017/03/14 18:26:46
I suppose we're never going to have non-RGB ICC pr
ccameron
2017/03/14 21:41:02
Done.
|
| + // has been flushed from our cache. Just make something up. This will be |
| + // inaccurate, so spam the console. |
| + LOG(ERROR) << "Failed to retrieve original ICC profile, using sRGB"; |
| + return ScopedQcmsProfile(qcms_profile_sRGB()); |
| + } |
| return ScopedQcmsProfile(qcms_profile_from_memory( |
| icc_profile.GetData().data(), icc_profile.GetData().size())); |
| } |