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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2335263002: Fix crash in canvas.toBlob caused by allocation failure (Closed)
Patch Set: fix++ Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('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 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4257 // TODO(crbug.com/622958): Implement GPU-to-GPU path for WebGL 2 and more in ternal formats. 4257 // TODO(crbug.com/622958): Implement GPU-to-GPU path for WebGL 2 and more in ternal formats.
4258 if (functionID == TexSubImage2D && (isWebGL2OrHigher() || extensionEnabled(O ESTextureFloatName) || extensionEnabled(OESTextureHalfFloatName) || extensionEna bled(EXTsRGBName))) 4258 if (functionID == TexSubImage2D && (isWebGL2OrHigher() || extensionEnabled(O ESTextureFloatName) || extensionEnabled(OESTextureHalfFloatName) || extensionEna bled(EXTsRGBName)))
4259 return false; 4259 return false;
4260 return true; 4260 return true;
4261 } 4261 }
4262 4262
4263 void WebGLRenderingContextBase::texImageCanvasByGPU(HTMLCanvasElement* canvas, G Luint targetTexture, GLenum targetInternalformat, GLenum targetType, GLint targe tLevel) 4263 void WebGLRenderingContextBase::texImageCanvasByGPU(HTMLCanvasElement* canvas, G Luint targetTexture, GLenum targetInternalformat, GLenum targetType, GLint targe tLevel)
4264 { 4264 {
4265 if (!canvas->is3D()) { 4265 if (!canvas->is3D()) {
4266 ImageBuffer* buffer = canvas->buffer(); 4266 ImageBuffer* buffer = canvas->buffer();
4267 if (!buffer->copyToPlatformTexture(contextGL(), targetTexture, targetInt ernalformat, targetType, 4267 if (buffer && !buffer->copyToPlatformTexture(contextGL(), targetTexture, targetInternalformat, targetType,
4268 targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 4268 targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
4269 NOTREACHED(); 4269 NOTREACHED();
4270 } 4270 }
4271 } else { 4271 } else {
4272 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->rend eringContext()); 4272 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->rend eringContext());
4273 ScopedTexture2DRestorer restorer(gl); 4273 ScopedTexture2DRestorer restorer(gl);
4274 if (!gl->drawingBuffer()->copyToPlatformTexture(contextGL(), targetTextu re, targetInternalformat, targetType, 4274 if (!gl->drawingBuffer()->copyToPlatformTexture(contextGL(), targetTextu re, targetInternalformat, targetType,
4275 targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) { 4275 targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) {
4276 NOTREACHED(); 4276 NOTREACHED();
4277 } 4277 }
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6454 6454
6455 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const 6455 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const
6456 { 6456 {
6457 if (canvas()) 6457 if (canvas())
6458 result.setHTMLCanvasElement(canvas()); 6458 result.setHTMLCanvasElement(canvas());
6459 else 6459 else
6460 result.setOffscreenCanvas(getOffscreenCanvas()); 6460 result.setOffscreenCanvas(getOffscreenCanvas());
6461 } 6461 }
6462 6462
6463 } // namespace blink 6463 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698