| 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 2746fbf217dcf0933e2abbe00ccbf2fbd48a1e52..ea1fadbefad91a4cead0cf93785cbad22ae84376 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
|
| @@ -36,9 +36,11 @@
|
| #include "platform/graphics/ProfilingCanvas.h"
|
| #include "platform/graphics/ReplayingCanvas.h"
|
| #include "platform/graphics/skia/ImagePixelLocker.h"
|
| +#include "platform/image-decoders/DataSegmentReader.h"
|
| #include "platform/image-decoders/ImageDecoder.h"
|
| #include "platform/image-decoders/ImageFrame.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"
|
| @@ -55,11 +57,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 = adoptRef(new DataSegmentReader(adoptRef(SkData::NewWithoutCopy(data, length))));
|
| + imageDecoder->setData(segmentReader.release(), true);
|
| ImageFrame* frame = imageDecoder->frameBufferAtIndex(0);
|
| if (!frame)
|
| return true;
|
|
|