Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp

Issue 2257513002: Refactor ImageDecoder factories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f7be7c977446fab5a519fe9d9d098f8febe88f3c..c9fa7320db496293edb802643f51e506da718de3 100644
--- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
+++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -60,14 +60,13 @@ PictureSnapshot::PictureSnapshot(PassRefPtr<const SkPicture> picture)
static bool decodeBitmap(const void* data, size_t length, SkBitmap* result)
{
- std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(ImageDecoder::determineImageType(static_cast<const char*>(data), length),
+ // No need to copy the data; this decodes immediately.
+ RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkData(SkData::MakeWithoutCopy(data, length));
+ std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(segmentReader.release(), true,
ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored);
if (!imageDecoder)
return false;
- // No need to copy the data; this decodes immediately.
- RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkData(SkData::MakeWithoutCopy(data, length));
- imageDecoder->setData(segmentReader.release(), true);
ImageFrame* frame = imageDecoder->frameBufferAtIndex(0);
if (!frame)
return true;

Powered by Google App Engine
This is Rietveld 408576698