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

Unified Diff: third_party/WebKit/Source/platform/exported/WebImage.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/exported/WebImage.cpp
diff --git a/third_party/WebKit/Source/platform/exported/WebImage.cpp b/third_party/WebKit/Source/platform/exported/WebImage.cpp
index d4b14e300c3491b823cb21bf9e03749feae2f3f4..202e5f227fb1c9054e4957fa78904638bac20a68 100644
--- a/third_party/WebKit/Source/platform/exported/WebImage.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebImage.cpp
@@ -46,12 +46,9 @@ namespace blink {
WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize)
{
RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data);
- std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(ImageDecoder::determineImageType(*buffer.get()), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored));
- if (!decoder)
- return WebImage();
-
- decoder->setData(buffer.get(), true);
- if (!decoder->isSizeAvailable())
+ std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(buffer, true,
+ ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored));
+ if (!decoder || !decoder->isSizeAvailable())
return WebImage();
// Frames are arranged by decreasing size, then decreasing bit depth.
@@ -90,12 +87,9 @@ WebVector<WebImage> WebImage::framesFromData(const WebData& data)
const size_t maxFrameCount = 8;
RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data);
- std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(ImageDecoder::determineImageType(*buffer.get()), ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored));
- if (!decoder)
- return WebVector<WebImage>();
-
- decoder->setData(buffer.get(), true);
- if (!decoder->isSizeAvailable())
+ std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create(buffer, true,
+ ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgnored));
+ if (!decoder || !decoder->isSizeAvailable())
return WebVector<WebImage>();
// Frames are arranged by decreasing size, then decreasing bit depth.

Powered by Google App Engine
This is Rietveld 408576698