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) |