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

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

Issue 1962413002: Implement transferToImageBitmap() in WebGLRenderingContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test fails Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('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/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 ceb485bdbf6c7e4ddd84cb242e0e556ae3c88ebf..47e96325c52731497901e656d540dff5ef0ba307 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -633,6 +633,22 @@ void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail()
shouldFailContextCreationForTesting = true;
}
+ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase()
+{
+ if (!drawingBuffer())
+ return nullptr;
+ GrContext* grContext = drawingBuffer()->contextProvider()->grContext();
+ if (!grContext)
+ return nullptr;
+ SkAlphaType alphaType = (m_requestedAttributes.premultipliedAlpha()) ? kPremul_SkAlphaType : kOpaque_SkAlphaType;
+ SkImageInfo info = SkImageInfo::MakeN32(drawingBufferWidth(), drawingBufferHeight(), alphaType);
+ SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry);
+ sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info, 0, (m_requestedAttributes.premultipliedAlpha()) ? &disableLCDProps : nullptr);
xidachen 2016/05/13 18:56:08 junov@: could you take a look? I am not sure what
Ken Russell (switch to Gerrit) 2016/05/13 20:08:30 The code above is referencing the Ganesh context f
Justin Novosad 2016/05/13 20:36:27 I agree with what Ken wrote. Sorry for the bad pa
+ RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(surface->makeImageSnapshot(SkBudgeted::kNo).release());
+ ImageBitmap* imageBitmap = ImageBitmap::create(image.release());
+ return imageBitmap;
+}
+
namespace {
// ES2 enums
@@ -1164,6 +1180,9 @@ void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType)
drawingBuffer()->markContentsChanged();
+ if (!canvas())
+ return;
+
LayoutBox* layoutBox = canvas()->layoutBox();
if (layoutBox && layoutBox->hasAcceleratedCompositing()) {
m_markedCanvasDirty = true;
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698