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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 BackBuffer)) { 730 BackBuffer)) {
731 // copyRenderingResultsFromDrawingBuffer is expected to always succeed 731 // copyRenderingResultsFromDrawingBuffer is expected to always succeed
732 // because we've explicitly created an Accelerated surface and have already 732 // because we've explicitly created an Accelerated surface and have already
733 // validated it. 733 // validated it.
734 NOTREACHED(); 734 NOTREACHED();
735 return nullptr; 735 return nullptr;
736 } 736 }
737 return buffer->newImageSnapshot(hint, reason); 737 return buffer->newImageSnapshot(hint, reason);
738 } 738 }
739 739
740 ImageData* WebGLRenderingContextBase::toImageData(SnapshotReason reason) const {
741 // TODO: Furnish toImageData in webgl renderingcontext for jpeg and webp
742 // images. See crbug.com/657531.
743 ImageData* imageData = nullptr;
744 if (this->drawingBuffer()) {
745 sk_sp<SkImage> snapshot = this->drawingBuffer()
746 ->transferToStaticBitmapImage()
747 ->imageForCurrentFrame();
748 if (snapshot) {
749 imageData = ImageData::create(this->getOffscreenCanvas()->size());
750 SkImageInfo imageInfo = SkImageInfo::Make(
751 this->drawingBufferWidth(), this->drawingBufferHeight(),
752 kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
753 snapshot->readPixels(imageInfo, imageData->data()->data(),
754 imageInfo.minRowBytes(), 0, 0);
755 }
756 }
757 return imageData;
758 }
759
740 namespace { 760 namespace {
741 761
742 // Exposed by GL_ANGLE_depth_texture 762 // Exposed by GL_ANGLE_depth_texture
743 static const GLenum kSupportedInternalFormatsOESDepthTex[] = { 763 static const GLenum kSupportedInternalFormatsOESDepthTex[] = {
744 GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL, 764 GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL,
745 }; 765 };
746 766
747 // Exposed by GL_EXT_sRGB 767 // Exposed by GL_EXT_sRGB
748 static const GLenum kSupportedInternalFormatsEXTsRGB[] = { 768 static const GLenum kSupportedInternalFormatsEXTsRGB[] = {
749 GL_SRGB, GL_SRGB_ALPHA_EXT, 769 GL_SRGB, GL_SRGB_ALPHA_EXT,
(...skipping 6795 matching lines...) Expand 10 before | Expand all | Expand 10 after
7545 7565
7546 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7566 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7547 HTMLCanvasElementOrOffscreenCanvas& result) const { 7567 HTMLCanvasElementOrOffscreenCanvas& result) const {
7548 if (canvas()) 7568 if (canvas())
7549 result.setHTMLCanvasElement(canvas()); 7569 result.setHTMLCanvasElement(canvas());
7550 else 7570 else
7551 result.setOffscreenCanvas(getOffscreenCanvas()); 7571 result.setOffscreenCanvas(getOffscreenCanvas());
7552 } 7572 }
7553 7573
7554 } // namespace blink 7574 } // namespace blink
OLDNEW
« 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