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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2139353003: Return a transparent black ImageBitmap when mailbox is invalid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index ebed1a63bf97b77e8b8df2cf6e7183f5125193fd..6b92594436ae742bbde7ed2d3dfe4c1091119ee7 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -642,7 +642,14 @@ ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase()
return nullptr;
WebExternalTextureMailbox mailbox;
drawingBuffer()->prepareMailbox(&mailbox, 0);
- ImageBitmap* imageBitmap = ImageBitmap::create(mailbox);
+ ImageBitmap* imageBitmap;
+ // If the mailbox is invalid, return an transparent black ImageBitmap
Ken Russell (switch to Gerrit) 2016/07/12 22:52:04 Could you add a comment saying that the only situa
+ if (mailbox.textureSize.width == 0 && mailbox.textureSize.height == 0) {
+ sk_sp<SkSurface>surface = SkSurface::MakeRasterN32Premul(drawingBuffer()->size().width(), drawingBuffer()->size().height());
+ imageBitmap = ImageBitmap::create(StaticBitmapImage::create(fromSkSp(surface->makeImageSnapshot())));
+ } else {
+ imageBitmap = ImageBitmap::create(mailbox);
+ }
// TODO(xidachen): Create a small pool of recycled textures from ImageBitmapRenderingContext's
// transferFromImageBitmap, and try to use them in DrawingBuffer.
return imageBitmap;

Powered by Google App Engine
This is Rietveld 408576698