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

Unified Diff: ui/gfx/color_space.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
Index: ui/gfx/color_space.cc
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
index 18a25adba49131b5d0da035a4e57b2e6f8d78614..0e4914d341df2b15804e080de81e535045685060 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -144,6 +144,15 @@ sk_sp<SkColorSpace> ColorSpace::ToSkColorSpace() const {
if (*this == gfx::ColorSpace())
return nullptr;
+ // Check for srgb and linear-srgb
+ if (primaries_ == PrimaryID::BT709 && matrix_ == MatrixID::RGB
+ && range_ == RangeID::FULL) {
+ if (transfer_ == TransferID::IEC61966_2_1)
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ else if (transfer_ == TransferID::BT709)
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named);
+ }
+
// TODO(crbug.com/634102): Support more than just ICC profile based color
// spaces. The DCHECK here is to ensure that callers that expect a valid
// result are notified of this incomplete functionality.

Powered by Google App Engine
This is Rietveld 408576698