| Index: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
|
| index caff5e4cca0f89744ffc0e7a61b000555e3b248f..533ee5c33047ff0fa1714b504dab9aa3830dc652 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
|
| @@ -117,12 +117,14 @@ ImageFrameGenerator::~ImageFrameGenerator() {
|
| ImageDecodingStore::instance().removeCacheIndexedByGenerator(this);
|
| }
|
|
|
| -bool ImageFrameGenerator::decodeAndScale(SegmentReader* data,
|
| - bool allDataReceived,
|
| - size_t index,
|
| - const SkImageInfo& info,
|
| - void* pixels,
|
| - size_t rowBytes) {
|
| +bool ImageFrameGenerator::decodeAndScale(
|
| + SegmentReader* data,
|
| + bool allDataReceived,
|
| + size_t index,
|
| + const SkImageInfo& info,
|
| + void* pixels,
|
| + size_t rowBytes,
|
| + ImageDecoder::AlphaOption alphaOption) {
|
| if (m_decodeFailed)
|
| return false;
|
|
|
| @@ -139,7 +141,7 @@ bool ImageFrameGenerator::decodeAndScale(SegmentReader* data,
|
| // longer than the call to the current method.
|
| ExternalMemoryAllocator externalAllocator(info, pixels, rowBytes);
|
| SkBitmap bitmap = tryToResumeDecode(data, allDataReceived, index, scaledSize,
|
| - &externalAllocator);
|
| + &externalAllocator, alphaOption);
|
| DCHECK(externalAllocator.unique()); // Verify we have the only ref-count.
|
|
|
| if (bitmap.isNull())
|
| @@ -201,7 +203,8 @@ SkBitmap ImageFrameGenerator::tryToResumeDecode(
|
| bool allDataReceived,
|
| size_t index,
|
| const SkISize& scaledSize,
|
| - SkBitmap::Allocator* allocator) {
|
| + SkBitmap::Allocator* allocator,
|
| + ImageDecoder::AlphaOption alphaOption) {
|
| TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index",
|
| static_cast<int>(index));
|
|
|
| @@ -209,13 +212,13 @@ SkBitmap ImageFrameGenerator::tryToResumeDecode(
|
|
|
| // Lock the mutex, so only one thread can use the decoder at once.
|
| MutexLocker lock(m_decodeMutex);
|
| - const bool resumeDecoding =
|
| - ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder);
|
| + const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(
|
| + this, m_fullSize, alphaOption, &decoder);
|
| ASSERT(!resumeDecoding || decoder);
|
|
|
| SkBitmap fullSizeImage;
|
| - bool complete =
|
| - decode(data, allDataReceived, index, &decoder, &fullSizeImage, allocator);
|
| + bool complete = decode(data, allDataReceived, index, &decoder, &fullSizeImage,
|
| + allocator, alphaOption);
|
|
|
| if (!decoder)
|
| return SkBitmap();
|
| @@ -280,7 +283,8 @@ bool ImageFrameGenerator::decode(SegmentReader* data,
|
| size_t index,
|
| ImageDecoder** decoder,
|
| SkBitmap* bitmap,
|
| - SkBitmap::Allocator* allocator) {
|
| + SkBitmap::Allocator* allocator,
|
| + ImageDecoder::AlphaOption alphaOption) {
|
| ASSERT(m_decodeMutex.locked());
|
| TRACE_EVENT2("blink", "ImageFrameGenerator::decode", "width",
|
| m_fullSize.width(), "height", m_fullSize.height());
|
| @@ -295,8 +299,7 @@ bool ImageFrameGenerator::decode(SegmentReader* data,
|
| *decoder = m_imageDecoderFactory->create().release();
|
|
|
| if (!*decoder) {
|
| - *decoder = ImageDecoder::create(data, allDataReceived,
|
| - ImageDecoder::AlphaPremultiplied,
|
| + *decoder = ImageDecoder::create(data, allDataReceived, alphaOption,
|
| m_decoderColorBehavior)
|
| .release();
|
| // The newly created decoder just grabbed the data. No need to reset it.
|
| @@ -307,7 +310,6 @@ bool ImageFrameGenerator::decode(SegmentReader* data,
|
| return false;
|
| }
|
|
|
| -
|
| if (shouldCallSetData)
|
| (*decoder)->setData(data, allDataReceived);
|
|
|
|
|