Index: Source/platform/graphics/gpu/WebGLImageConversion.cpp |
diff --git a/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
index 0a22029c7c0c8f4fa5911a451acface5abd97638..82c6c4037e2175f94b014942490d8f4cc83a628b 100644 |
--- a/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
+++ b/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
@@ -1539,18 +1539,18 @@ WebGLImageConversion::ImageExtractor::ImageExtractor(Image* image, ImageHtmlDomS |
WebGLImageConversion::ImageExtractor::~ImageExtractor() |
{ |
- if (m_skiaImage) |
- m_skiaImage->bitmap().unlockPixels(); |
+ if (!m_skiaBitmap.isNull()) |
+ m_skiaBitmap.unlockPixels(); |
} |
bool WebGLImageConversion::ImageExtractor::extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile) |
{ |
if (!m_image) |
return false; |
- m_skiaImage = m_image->nativeImageForCurrentFrame(); |
+ bool success = m_image->bitmapForCurrentFrame(&m_skiaBitmap); |
m_alphaOp = AlphaDoNothing; |
- bool hasAlpha = m_skiaImage ? !m_skiaImage->bitmap().isOpaque() : true; |
- if ((!m_skiaImage || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && m_image->data()) { |
+ bool hasAlpha = success ? !m_skiaBitmap.isOpaque() : true; |
+ if ((!success || ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && m_image->data()) { |
// Attempt to get raw unpremultiplied image data. |
OwnPtr<ImageDecoder> decoder(ImageDecoder::create( |
*(m_image->data()), ImageSource::AlphaNotPremultiplied, |
@@ -1564,12 +1564,12 @@ bool WebGLImageConversion::ImageExtractor::extractImage(bool premultiplyAlpha, b |
if (!frame || frame->status() != ImageFrame::FrameComplete) |
return false; |
hasAlpha = frame->hasAlpha(); |
- m_nativeImage = frame->asNewNativeImage(); |
- if (!m_nativeImage.get() || !m_nativeImage->isDataComplete() || !m_nativeImage->bitmap().width() || !m_nativeImage->bitmap().height()) |
+ m_bitmap = frame->bitmap(); |
+ if (m_bitmap.isNull() || !m_bitmap.isImmutable() || !m_bitmap.width() || !m_bitmap.height()) |
return false; |
- if (m_nativeImage->bitmap().colorType() != kN32_SkColorType) |
+ if (m_bitmap.colorType() != kN32_SkColorType) |
return false; |
- m_skiaImage = m_nativeImage.get(); |
+ m_skiaBitmap = m_bitmap; |
if (hasAlpha && premultiplyAlpha) |
m_alphaOp = AlphaDoPremultiply; |
} else if (!premultiplyAlpha && hasAlpha) { |
@@ -1580,24 +1580,24 @@ bool WebGLImageConversion::ImageExtractor::extractImage(bool premultiplyAlpha, b |
if (m_imageHtmlDomSource != HtmlDomVideo) |
m_alphaOp = AlphaDoUnmultiply; |
} |
- if (!m_skiaImage) |
+ if (!success) |
return false; |
m_imageSourceFormat = SK_B32_SHIFT ? DataFormatRGBA8 : DataFormatBGRA8; |
- m_imageWidth = m_skiaImage->bitmap().width(); |
- m_imageHeight = m_skiaImage->bitmap().height(); |
+ m_imageWidth = m_skiaBitmap.width(); |
+ m_imageHeight = m_skiaBitmap.height(); |
if (!m_imageWidth || !m_imageHeight) { |
- m_skiaImage.clear(); |
+ m_skiaBitmap.reset(); |
return false; |
} |
// Fail if the image was downsampled because of memory limits. |
if (m_imageWidth != (unsigned)m_image->size().width() || m_imageHeight != (unsigned)m_image->size().height()) { |
- m_skiaImage.clear(); |
+ m_skiaBitmap.reset(); |
return false; |
} |
m_imageSourceUnpackAlignment = 0; |
- m_skiaImage->bitmap().lockPixels(); |
- m_imagePixelData = m_skiaImage->bitmap().getPixels(); |
+ m_skiaBitmap.lockPixels(); |
+ m_imagePixelData = m_skiaBitmap.getPixels(); |
return true; |
} |