| 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 2fbb2f15ee6b009d41118f71cf7f92b71b1ad1c3..505022fe1e86fd9c42f979c8ba72f8b8a97b521b 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
|
| @@ -28,6 +28,7 @@
|
| #include "config.h"
|
| #include "platform/graphics/ImageSource.h"
|
|
|
| +#include "platform/graphics/ColorSpaceProfile.h"
|
| #include "platform/graphics/DeferredImageDecoder.h"
|
| #include "platform/image-decoders/ImageDecoder.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| @@ -47,12 +48,22 @@ size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame)
|
| return m_decoder ? m_decoder->clearCacheExceptFrame(clearExceptFrame) : 0;
|
| }
|
|
|
| +void ImageSource::resetDecoder()
|
| +{
|
| + m_decoder.clear();
|
| +}
|
| +
|
| void ImageSource::setData(SharedBuffer& data, bool allDataReceived)
|
| {
|
| // Create a decoder by sniffing the encoded data. If insufficient data bytes are available to
|
| // determine the encoded image type, no decoder is created.
|
| - if (!m_decoder)
|
| + if (!m_decoder) {
|
| m_decoder = DeferredImageDecoder::create(data, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
|
| + if (m_decoder) {
|
| + fprintf(stderr, "ImageSource: %p created decoder device profile %p\n", this, m_deviceProfile.get());
|
| + m_decoder->setDeviceProfile(m_deviceProfile.get());
|
| + }
|
| + }
|
|
|
| if (m_decoder)
|
| m_decoder->setData(data, allDataReceived);
|
| @@ -73,6 +84,19 @@ bool ImageSource::hasColorProfile() const
|
| return m_decoder && m_decoder->hasColorProfile();
|
| }
|
|
|
| +PassRefPtr<ColorSpaceProfile> ImageSource::colorProfile() const
|
| +{
|
| + return m_decoder ? m_decoder->colorProfile() : nullptr;
|
| +}
|
| +
|
| +void ImageSource::setDeviceProfile(ColorSpaceProfile* profile)
|
| +{
|
| + m_deviceProfile = profile;
|
| +
|
| + if (m_decoder)
|
| + m_decoder->setDeviceProfile(profile);
|
| +}
|
| +
|
| IntSize ImageSource::size(RespectImageOrientationEnum shouldRespectOrientation) const
|
| {
|
| return frameSizeAtIndex(0, shouldRespectOrientation);
|
| @@ -110,6 +134,8 @@ PassRefPtr<SkImage> ImageSource::createFrameAtIndex(size_t index)
|
| if (!m_decoder)
|
| return nullptr;
|
|
|
| + fprintf(stderr, "ImageSource %p createFrameAtIndex(index=%d)\n", this, (int)index);
|
| +
|
| return m_decoder->createFrameAtIndex(index);
|
| }
|
|
|
|
|