| Index: third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| index 17ba96b7a0acc478ca833fec0d0e250c724290e9..1aa797fd9ca4d7163c10f0810d3d5498dd345672 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| @@ -51,6 +51,8 @@ bool ImageSource::setData(PassRefPtr<SharedBuffer> passData,
|
| RefPtr<SharedBuffer> data = passData;
|
|
|
| if (m_decoder) {
|
| + m_data = data;
|
| + m_allDataReceived = allDataReceived;
|
| m_decoder->setData(data.release(), allDataReceived);
|
| // If the decoder is pre-instantiated, it means we've already validated the
|
| // data/signature at some point.
|
| @@ -69,7 +71,14 @@ bool ImageSource::setData(PassRefPtr<SharedBuffer> passData,
|
| }
|
|
|
| // Insufficient data is not a failure.
|
| - return m_decoder || !ImageDecoder::hasSufficientDataToSniffImageType(*data);
|
| + if (m_decoder || !ImageDecoder::hasSufficientDataToSniffImageType(*data)) {
|
| + m_data = data;
|
| + m_allDataReceived = allDataReceived;
|
| + return true;
|
| + }
|
| + m_data = nullptr;
|
| + m_allDataReceived = false;
|
| + return false;
|
| }
|
|
|
| String ImageSource::filenameExtension() const {
|
| @@ -115,10 +124,22 @@ size_t ImageSource::frameCount() const {
|
| return m_decoder ? m_decoder->frameCount() : 0;
|
| }
|
|
|
| -sk_sp<SkImage> ImageSource::createFrameAtIndex(size_t index) {
|
| +sk_sp<SkImage> ImageSource::createFrameAtIndex(
|
| + size_t index,
|
| + sk_sp<SkColorSpace> targetColorSpace) {
|
| + DCHECK(targetColorSpace);
|
| if (!m_decoder)
|
| return nullptr;
|
|
|
| + if (!SkColorSpace::Equals(m_decoder->targetColorSpace().get(),
|
| + targetColorSpace.get())) {
|
| + std::unique_ptr<DeferredImageDecoder> newColorSpaceDecoder =
|
| + DeferredImageDecoder::create(
|
| + m_data, m_allDataReceived, ImageDecoder::AlphaPremultiplied,
|
| + ImageDecoder::ColorSpaceTransformed, targetColorSpace);
|
| + std::swap(m_decoder, newColorSpaceDecoder);
|
| + }
|
| +
|
| return m_decoder->createFrameAtIndex(index);
|
| }
|
|
|
|
|