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

Unified Diff: ui/gfx/color_space.cc

Issue 2950183002: color: Use ICCProfile from display::Display instead of FromBestMonitor (Closed)
Patch Set: Use forced color profile in display::Display ctor Created 3 years, 6 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.h ('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_space.cc
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
index 8cb06ac3831dda94df294c84024a3097a22d238e..2c0ae68284faeaf8b2906369d04318c66c52040b 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -158,6 +158,25 @@ bool ColorSpace::FullRangeEncodedValues() const {
transfer_ == TransferID::IEC61966_2_4;
}
+bool ColorSpace::IsParametric() const {
+ return primaries_ != PrimaryID::ICC_BASED &&
+ transfer_ != TransferID::ICC_BASED;
+}
+
+ColorSpace ColorSpace::GetParametricApproximation() const {
+ // If this is parametric already, return it directly.
+ if (IsParametric())
+ return *this;
+
+ // Query the ICC profile, if available, for the parametric approximation.
+ ICCProfile icc_profile;
+ if (GetICCProfile(&icc_profile))
+ return icc_profile.GetParametricColorSpace();
+
+ // Fall back to sRGB if the ICC profile is no longer cached.
+ return CreateSRGB();
+}
+
bool ColorSpace::operator!=(const ColorSpace& other) const {
return !(*this == other);
}
« no previous file with comments | « ui/gfx/color_space.h ('k') | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698