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

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

Issue 2523943002: Explicitly specify target color space to ImageDecoder at creation (Closed)
Patch Set: Rebase 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: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
index 847c246d3f240bc0caca62f0ffca1762fe48ee6d..d7dbfaf45e177d3fcda55f3919df724fc973384c 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -61,12 +61,13 @@ std::unique_ptr<DeferredImageDecoder> DeferredImageDecoder::create(
PassRefPtr<SharedBuffer> passData,
bool dataComplete,
ImageDecoder::AlphaOption alphaOption,
- ImageDecoder::ColorSpaceOption colorOptions) {
+ ImageDecoder::ColorSpaceOption colorOptions,
+ sk_sp<SkColorSpace> targetColorSpace) {
RefPtr<SharedBuffer> data = passData;
std::unique_ptr<ImageDecoder> actualDecoder =
- ImageDecoder::create(data, dataComplete, alphaOption, colorOptions);
-
+ ImageDecoder::create(data, dataComplete, alphaOption, colorOptions,
+ std::move(targetColorSpace));
if (!actualDecoder)
return nullptr;
@@ -267,6 +268,7 @@ void DeferredImageDecoder::activateLazyDecoding() {
m_canYUVDecode = RuntimeEnabledFeatures::decodeToYUVEnabled() &&
(m_filenameExtension == "jpg");
m_hasEmbeddedColorSpace = m_actualDecoder->hasEmbeddedColorSpace();
+ m_colorSpaceForSkImages = m_actualDecoder->colorSpaceForSkImages();
const bool isSingleFrame =
m_actualDecoder->repetitionCount() == cAnimationNone ||
@@ -275,7 +277,8 @@ void DeferredImageDecoder::activateLazyDecoding() {
SkISize::Make(m_actualDecoder->decodedSize().width(),
m_actualDecoder->decodedSize().height());
m_frameGenerator = ImageFrameGenerator::create(
- decodedSize, m_actualDecoder->colorSpace(), !isSingleFrame);
+ decodedSize, !isSingleFrame, m_actualDecoder->colorSpaceOption(),
+ m_actualDecoder->targetColorSpace());
}
void DeferredImageDecoder::prepareLazyDecodedFrames() {
@@ -326,7 +329,7 @@ sk_sp<SkImage> DeferredImageDecoder::createFrameImageAtIndex(
SkImageInfo info = SkImageInfo::MakeN32(
decodedSize.width(), decodedSize.height(),
knownToBeOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
- m_frameGenerator->getColorSpace());
+ m_colorSpaceForSkImages);
DecodingImageGenerator* generator = new DecodingImageGenerator(
m_frameGenerator, info, segmentReader.release(), m_allDataReceived, index,

Powered by Google App Engine
This is Rietveld 408576698