| Index: third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| index 7d322be9caf0a951dca06ff01ad53ab621f3833f..2264648c8a3f0f4a60ed7faa9139d86058c1775e 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| @@ -38,7 +38,9 @@
|
| #include "platform/graphics/skia/ImagePixelLocker.h"
|
| #include "platform/image-decoders/ImageDecoder.h"
|
| #include "platform/image-decoders/ImageFrame.h"
|
| +#include "platform/image-decoders/SegmentReader.h"
|
| #include "platform/image-encoders/skia/PNGImageEncoder.h"
|
| +#include "third_party/skia/include/core/SkData.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| #include "third_party/skia/include/core/SkPictureRecorder.h"
|
| #include "third_party/skia/include/core/SkStream.h"
|
| @@ -56,11 +58,14 @@ PictureSnapshot::PictureSnapshot(PassRefPtr<const SkPicture> picture)
|
|
|
| static bool decodeBitmap(const void* data, size_t length, SkBitmap* result)
|
| {
|
| - RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<const char*>(data), length);
|
| - OwnPtr<ImageDecoder> imageDecoder = ImageDecoder::create(*buffer, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored);
|
| + OwnPtr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cast<const char*>(data), length,
|
| + ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored);
|
| if (!imageDecoder)
|
| return false;
|
| - imageDecoder->setData(buffer.get(), true);
|
| +
|
| + // No need to copy the data; this decodes immediately.
|
| + RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkData(adoptRef(SkData::NewWithoutCopy(data, length)));
|
| + imageDecoder->setData(segmentReader.release(), true);
|
| ImageFrame* frame = imageDecoder->frameBufferAtIndex(0);
|
| if (!frame)
|
| return true;
|
|
|