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

Unified Diff: ui/gfx/icc_profile.cc

Issue 2496913003: Display linear-srgb color managed canvas (Closed)
Patch Set: Created 4 years, 1 month 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
« cc/resources/resource.h ('K') | « ui/gfx/icc_profile.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/icc_profile.cc
diff --git a/ui/gfx/icc_profile.cc b/ui/gfx/icc_profile.cc
index 118a071124a06c7c064c1f5f20bf596429affda3..88cf912c080aa40cd94a48bb078c4652fae762a1 100644
--- a/ui/gfx/icc_profile.cc
+++ b/ui/gfx/icc_profile.cc
@@ -42,6 +42,9 @@ ICCProfile& ICCProfile::operator=(ICCProfile&& other) = default;
ICCProfile& ICCProfile::operator=(const ICCProfile& other) = default;
ICCProfile::~ICCProfile() = default;
+// Turn off color correct rendering by default.
+bool ICCProfile::color_correct_rendering_ = false;
+
bool ICCProfile::operator==(const ICCProfile& other) const {
return valid_ == other.valid_ && data_ == other.data_;
}
@@ -79,6 +82,8 @@ ICCProfile ICCProfile::FromData(const char* data, size_t size) {
#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(USE_X11)
// static
ICCProfile ICCProfile::FromBestMonitor() {
+ if (color_correct_rendering_)
+ return gfx::ICCProfile::FromColorSpace(gfx::ColorSpace::CreateSRGB());
return ICCProfile();
}
#endif
@@ -105,8 +110,11 @@ const std::vector<char>& ICCProfile::GetData() const {
}
ColorSpace ICCProfile::GetColorSpace() const {
- if (!valid_)
+ if (!valid_) {
+ if (color_correct_rendering_)
+ return gfx::ColorSpace::CreateSRGB();
return gfx::ColorSpace();
+ }
ColorSpace color_space(ColorSpace::PrimaryID::CUSTOM,
ColorSpace::TransferID::CUSTOM,
@@ -174,4 +182,8 @@ bool ICCProfile::IsValidProfileLength(size_t length) {
return length >= kMinProfileLength && length <= kMaxProfileLength;
}
+void ICCProfile::SetColorCorrectRendering(bool color_correct_rendering) {
+ color_correct_rendering_ = color_correct_rendering;
+}
+
} // namespace gfx
« cc/resources/resource.h ('K') | « ui/gfx/icc_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698