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

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

Issue 2420203002: Implement convertToBlob() in OffscreenCanvas (Closed)
Patch Set: rebase and fix global-interface-listing-service-worker-expected.txt Created 4 years, 2 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 bd605b460e6e909af69feaa9b524191e9a78d91b..b30a2e61bb3e37bd646e8c8a3c44d64d748afe3b 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -737,6 +737,26 @@ PassRefPtr<Image> WebGLRenderingContextBase::getImage(
return buffer->newImageSnapshot(hint, reason);
}
+ImageData* WebGLRenderingContextBase::toImageData(SnapshotReason reason) const {
+ // TODO: Furnish toImageData in webgl renderingcontext for jpeg and webp
+ // images. See crbug.com/657531.
+ ImageData* imageData = nullptr;
+ if (this->drawingBuffer()) {
+ sk_sp<SkImage> snapshot = this->drawingBuffer()
+ ->transferToStaticBitmapImage()
+ ->imageForCurrentFrame();
+ if (snapshot) {
+ imageData = ImageData::create(this->getOffscreenCanvas()->size());
+ SkImageInfo imageInfo = SkImageInfo::Make(
+ this->drawingBufferWidth(), this->drawingBufferHeight(),
+ kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
+ snapshot->readPixels(imageInfo, imageData->data()->data(),
+ imageInfo.minRowBytes(), 0, 0);
+ }
+ }
+ return imageData;
+}
+
namespace {
// Exposed by GL_ANGLE_depth_texture
« 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