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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Created 4 years, 2 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
Index: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
index c397e7bcf1af164c711aaa7df78f4c5f4f835eef..cdb28a64501e1a552e3830c0779704d2a6fe7e4b 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -359,14 +359,22 @@ void ImageDecoder::setTargetColorProfile(const WebVector<char>& profile) {
}
void ImageDecoder::setColorSpaceAndComputeTransform(const char* iccData,
- unsigned iccLength,
- bool useSRGB) {
+ unsigned iccLength) {
// Sub-classes should not call this if they were instructed to ignore embedded
// color profiles.
- DCHECK(!m_ignoreGammaAndColorProfile);
+ DCHECK(!m_ignoreColorSpace);
- m_colorProfile.assign(iccData, iccLength);
- m_hasColorProfile = true;
+ sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(iccData, iccLength);
+ setColorSpaceAndComputeTransform(std::move(srcSpace));
+}
+
+void ImageDecoder::setColorSpaceAndComputeTransform(
+ sk_sp<SkColorSpace> srcSpace) {
+ if (!srcSpace) {
+ return;
+ }
+
+ m_srcSpace = srcSpace;
// With color correct rendering, we do not transform to the output color space
// at decode time. Instead, we tag the raw image pixels and pass the tagged
@@ -376,17 +384,6 @@ void ImageDecoder::setColorSpaceAndComputeTransform(const char* iccData,
m_sourceToOutputDeviceColorTransform = nullptr;
- // Create the input profile.
- sk_sp<SkColorSpace> srcSpace = nullptr;
- if (useSRGB) {
- srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
- } else {
- srcSpace = SkColorSpace::NewICC(iccData, iccLength);
- }
-
- if (!srcSpace)
- return;
-
// Take a lock around initializing and accessing the global device color
// profile.
SpinLock::Guard guard(gTargetColorSpaceLock);

Powered by Google App Engine
This is Rietveld 408576698