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

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: DCHECK in ImageFrame::copy/take. 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
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 990fd97df9293e470145e6e37e5d0c9368ae8726..e239ae8a081e808a0bfbbadb356eaa5720b4295d 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -42,12 +42,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;
@@ -180,10 +174,10 @@ PassRefPtr<SkImage> ImageBitmap::getSkImageFromDecoder(std::unique_ptr<ImageDeco
ImageFrame* frame = decoder->frameBufferAtIndex(0);
if (!frame || frame->getStatus() != ImageFrame::FrameComplete)
return nullptr;
- SkBitmap bitmap = frame->bitmap();
- if (!frameIsValid(bitmap))
+ DCHECK(!frame->bitmap().isNull() && !frame->bitmap().empty());
+ if (frame->bitmap().colorType() != kN32_SkColorType)
Peter Kasting 2016/09/22 21:44:08 So, what I meant by "is this safe" was not so much
aleksandar.stojiljkovic 2016/09/27 18:08:28 I didn't see how it could happen with current set
return nullptr;
- return fromSkSp(SkImage::MakeFromBitmap(bitmap));
+ return fromSkSp(frame->finalizePixelsAndGetImage());
Peter Kasting 2016/09/22 21:44:08 Nit: Shorter: return (frame->bitmap().colorType
aleksandar.stojiljkovic 2016/09/27 18:08:28 Done.
}
bool ImageBitmap::isResizeOptionValid(const ImageBitmapOptions& options, ExceptionState& exceptionState)

Powered by Google App Engine
This is Rietveld 408576698