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

Unified Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 2550443002: Fix a minor issue in OffscreenCanvas.drawImage (Closed)
Patch Set: address comments Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
index 7509d86c81e6e5077057d91abf0426c203f29d31..9dc16fe3792d4b26a1c98ef6d5cd7be7dc1425b0 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -93,7 +93,10 @@ PassRefPtr<Image> OffscreenCanvas::getSourceImageForCanvas(
const FloatSize& size) const {
if (!m_context) {
*status = InvalidSourceImageStatus;
- return nullptr;
+ sk_sp<SkSurface> surface =
+ SkSurface::MakeRasterN32Premul(m_size.width(), m_size.height());
+ return surface ? StaticBitmapImage::create(surface->makeImageSnapshot())
+ : nullptr;
}
if (!size.width() || !size.height()) {
*status = ZeroSizeCanvasSourceImageStatus;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698