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

Unified Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 2155973002: Save a bitmap copy when advancing to dependent GIF and WebP animation frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Thanks pkasting@. Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/exported/WebImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/ImageBitmap.cpp
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index 279710f53f8f36905f798bef2fd58c65b554b5a7..93bd12baf8a8b0c184262671a5a71365091842a2 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -45,12 +45,6 @@ static inline IntRect normalizeRect(const IntRect& rect)
std::max(rect.height(), -rect.height()));
}
-static bool frameIsValid(const SkBitmap& frameBitmap)
-{
- ASSERT(!frameBitmap.isNull() && !frameBitmap.empty() && frameBitmap.isImmutable());
- return frameBitmap.colorType() == kN32_SkColorType;
-}
-
ParsedOptions parseOptions(const ImageBitmapOptions& options, Optional<IntRect> cropRect, IntSize sourceSize)
{
ParsedOptions parsedOptions;
@@ -215,10 +209,8 @@ sk_sp<SkImage> ImageBitmap::getSkImageFromDecoder(std::unique_ptr<ImageDecoder>
ImageFrame* frame = decoder->frameBufferAtIndex(0);
if (!frame || frame->getStatus() != ImageFrame::FrameComplete)
return nullptr;
- SkBitmap bitmap = frame->bitmap();
- if (!frameIsValid(bitmap))
- return nullptr;
- return SkImage::MakeFromBitmap(bitmap);
+ DCHECK(!frame->bitmap().isNull() && !frame->bitmap().empty());
+ return (frame->bitmap().colorType() == kN32_SkColorType) ? frame->finalizePixelsAndGetImage() : nullptr;
dcheng 2016/09/27 22:44:15 Just curious: what does that mean if we get here a
aleksandar.stojiljkovic 2016/09/28 18:51:24 kUnknown_SkColorType: In initial state, SkBitmap h
dcheng 2016/09/28 21:16:52 I understand that this is a refactoring only chang
aleksandar.stojiljkovic 2016/09/28 22:10:22 Yes, given the explanation I provided above, there
}
bool ImageBitmap::isResizeOptionValid(const ImageBitmapOptions& options, ExceptionState& exceptionState)
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/exported/WebImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698