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

Unified Diff: ui/gfx/color_transform.cc

Issue 2742613002: color: Always use parametric color spaces for raster (Closed)
Patch Set: Incorporate review feedback 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
« no previous file with comments | « ui/gfx/color_space_win.cc ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_transform.cc
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc
index c87652b0c7f81669df4c4f6c05079196b881394c..d47c5bfb10d0345fe5b583420f719bb916c70f34 100644
--- a/ui/gfx/color_transform.cc
+++ b/ui/gfx/color_transform.cc
@@ -746,6 +746,7 @@ void ColorTransformInternal::AppendColorSpaceToColorSpaceTransform(
base::MakeUnique<ColorTransformMatrix>(Invert(GetRangeAdjustMatrix(to))));
}
+// TODO(ccameron): Change this to SkColorSpaceXform.
class QCMSColorTransform : public ColorTransformStep {
public:
// Takes ownership of the profiles
@@ -788,9 +789,21 @@ 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_BASED &&
+ color_space.transfer_ != ColorSpace::TransferID::ICC_BASED) {
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
+ // has been flushed from our cache. Fall back to using the ICC profile's
+ // inaccurate, so spam the console.
+ // TODO(ccameron): This will go away when we switch to SkColorSpaceXform.
+ 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()));
}
« no previous file with comments | « 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