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

Unified Diff: ui/gfx/color_space.cc

Issue 2502703002: Add more robust gfx::ColorSpace<->gfx::ICCProfile conversion (Closed)
Patch Set: Clean up includes 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
« no previous file with comments | « no previous file | 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 18a25adba49131b5d0da035a4e57b2e6f8d78614..849d2201fc949e04b4fe87994917e245dc772725 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -143,6 +143,8 @@ sk_sp<SkColorSpace> ColorSpace::ToSkColorSpace() const {
// Unspecified color spaces are represented as nullptr SkColorSpaces.
if (*this == gfx::ColorSpace())
return nullptr;
+ if (*this == gfx::ColorSpace::CreateSRGB())
+ return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_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
@@ -158,6 +160,10 @@ ColorSpace ColorSpace::FromSkColorSpace(
const sk_sp<SkColorSpace>& sk_color_space) {
if (!sk_color_space)
return gfx::ColorSpace();
+ if (SkColorSpace::Equals(
+ sk_color_space.get(),
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).get()))
+ return gfx::ColorSpace::CreateSRGB();
// TODO(crbug.com/634102): Add conversion to gfx::ColorSpace.
return gfx::ColorSpace();
« no previous file with comments | « no previous file | ui/gfx/icc_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698