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