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

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: Fix legacy ImageFrame 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..92bb9b06880f739a6f47ea05b5396c20521d464e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -71,7 +71,7 @@ std::unique_ptr<ImageDecoder> ImageDecoder::create(
PassRefPtr<SegmentReader> passData,
bool dataComplete,
AlphaOption alphaOption,
- GammaAndColorProfileOption colorOptions) {
+ ColorSpaceOption colorOptions) {
RefPtr<SegmentReader> data = passData;
// We need at least kLongestSignatureLength bytes to run the signature
@@ -359,14 +359,16 @@ void ImageDecoder::setTargetColorProfile(const WebVector<char>& profile) {
}
void ImageDecoder::setColorSpaceAndComputeTransform(const char* iccData,
- unsigned iccLength,
- bool useSRGB) {
- // Sub-classes should not call this if they were instructed to ignore embedded
- // color profiles.
- DCHECK(!m_ignoreGammaAndColorProfile);
+ unsigned iccLength) {
+ setColorSpaceAndComputeTransform(SkColorSpace::NewICC(iccData, iccLength));
+}
+
+void ImageDecoder::setColorSpaceAndComputeTransform(
+ sk_sp<SkColorSpace> srcSpace) {
+ DCHECK(!m_ignoreColorSpace);
- m_colorProfile.assign(iccData, iccLength);
- m_hasColorProfile = true;
+ m_srcSpace = srcSpace;
+ m_sourceToOutputDeviceColorTransform = nullptr;
// 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
@@ -374,17 +376,7 @@ void ImageDecoder::setColorSpaceAndComputeTransform(const char* iccData,
if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
return;
- 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)
+ if (!m_srcSpace)
return;
// Take a lock around initializing and accessing the global device color

Powered by Google App Engine
This is Rietveld 408576698