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

Unified Diff: third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp

Issue 2630653002: Clean up ICC profile tracking (Closed)
Patch Set: Update ColorBehavior Created 3 years, 11 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 | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp b/third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp
index 67635875686d8640ce9b87e9d641c11c609650ef..81cb1eefd862696948af0bf9fe7532b0c0b4bfce 100644
--- a/third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp
@@ -20,9 +20,6 @@ SkColorSpace* gTargetColorSpace = nullptr;
// static
void ColorBehavior::setGlobalTargetColorProfile(
const WebVector<char>& profile) {
- if (profile.isEmpty())
- return;
-
// Take a lock around initializing and accessing the global device color
// profile.
SpinLock::Guard guard(gTargetColorSpaceLock);
@@ -31,8 +28,17 @@ void ColorBehavior::setGlobalTargetColorProfile(
if (gTargetColorSpace)
return;
- gTargetColorSpace =
- SkColorSpace::MakeICC(profile.data(), profile.size()).release();
+ // Attempt to convert the ICC profile to an SkColorSpace.
+ if (!profile.isEmpty()) {
+ gTargetColorSpace =
+ SkColorSpace::MakeICC(profile.data(), profile.size()).release();
+ }
+
+ // If we do not succeed, assume sRGB.
+ if (!gTargetColorSpace) {
+ gTargetColorSpace =
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named).release();
+ }
// UMA statistics.
BitmapImageMetrics::countOutputGammaAndGamut(gTargetColorSpace);
« no previous file with comments | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698