Index: ui/gfx/color_transform.cc |
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc |
index 2c9bb4ed9816f112624e762869b5b421faedec9b..20a7d9d91b9fae43787b2e23aff8312d87d25be2 100644 |
--- a/ui/gfx/color_transform.cc |
+++ b/ui/gfx/color_transform.cc |
@@ -273,6 +273,11 @@ class GFX_EXPORT ColorTransformInternal : public ColorTransform { |
ColorTransform::Intent intent); |
void Simplify(); |
+ // Retrieve the ICC profile from which |color_space| was created, only if that |
+ // is a more precise representation of the color space than the primaries and |
+ // transfer function in |color_space|. |
+ ScopedQcmsProfile GetQCMSProfileIfNecessary(const ColorSpace& color_space); |
+ |
std::list<std::unique_ptr<ColorTransformStep>> steps_; |
}; |
@@ -650,9 +655,10 @@ class QCMSColorTransform : public ColorTransformStep { |
ScopedQcmsProfile to_; |
}; |
-ScopedQcmsProfile GetQCMSProfileIfAvailable(const ColorSpace& color_space) { |
- ICCProfile icc_profile = ICCProfile::FromColorSpace(color_space); |
- if (icc_profile.GetData().empty()) |
+ScopedQcmsProfile ColorTransformInternal::GetQCMSProfileIfNecessary( |
+ const ColorSpace& color_space) { |
+ ICCProfile icc_profile; |
+ if (!ICCProfile::FromId(color_space.icc_profile_id_, true, &icc_profile)) |
return nullptr; |
return ScopedQcmsProfile(qcms_profile_from_memory( |
icc_profile.GetData().data(), icc_profile.GetData().size())); |
@@ -682,8 +688,8 @@ ScopedQcmsProfile GetXYZD50Profile() { |
ColorTransformInternal::ColorTransformInternal(const ColorSpace& from, |
const ColorSpace& to, |
Intent intent) { |
- ScopedQcmsProfile from_profile = GetQCMSProfileIfAvailable(from); |
- ScopedQcmsProfile to_profile = GetQCMSProfileIfAvailable(to); |
+ ScopedQcmsProfile from_profile = GetQCMSProfileIfNecessary(from); |
+ ScopedQcmsProfile to_profile = GetQCMSProfileIfNecessary(to); |
bool has_from_profile = !!from_profile; |
bool has_to_profile = !!to_profile; |