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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2267653005: Resolving drawImage issue with canvases that contain bitmap images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving the conflict with DCHECK on canvas type. Created 4 years, 4 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/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 24b72195720eaa34ec09856fda4664c1c58a1923..4064422b5f601b9d0f805419cce5ec67ad3bd9e1 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -257,6 +257,8 @@ bool HTMLCanvasElement::isPaintable() const
{
if (!m_context)
return ImageBuffer::canCreateImageBuffer(size());
+ if (renderingContext()->getImage())
+ return true;
return buffer();
}
@@ -1102,10 +1104,17 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
m_context->paintRenderingResultsToCanvas(BackBuffer);
}
- RefPtr<SkImage> image = buffer()->newSkImageSnapshot(hint, reason);
- if (image) {
+ RefPtr<SkImage> skImage;
+ RefPtr<blink::Image> image = renderingContext()->getImage();
+
+ if (image)
+ skImage = image->imageForCurrentFrame();
+ else
+ skImage = hasImageBuffer() ? buffer()->newSkImageSnapshot(hint, reason) : createTransparentImage(size())->imageForCurrentFrame();
+
+ if (skImage) {
*status = NormalSourceImageStatus;
- return StaticBitmapImage::create(image.release());
+ return StaticBitmapImage::create(skImage.release());
}
*status = InvalidSourceImageStatus;

Powered by Google App Engine
This is Rietveld 408576698