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

Unified Diff: ui/gfx/color_transform.cc

Issue 2742613002: color: Always use parametric color spaces for raster (Closed)
Patch Set: More comment cleanup Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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()));
}
« ui/gfx/color_space.h ('K') | « ui/gfx/color_space_win.cc ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698