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

Unified Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 758493004: canvas: make a temporary buffer when a context doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't create temp imageBuffer again Created 6 years 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: Source/core/html/canvas/WebGLRenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
index efeab45ec32ed47ca0f9f0bfc08d92ad83c60ee4..225347c54b00a4511ea9fbc5c08882663d000e31 100644
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
@@ -3603,7 +3603,7 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
// If possible, copy from the canvas element directly to the texture
// via the GPU, without a read-back to system memory.
- if (GL_TEXTURE_2D == target && texture) {
+ if (canvas->renderingContext() && GL_TEXTURE_2D == target && texture) {
ScopedTexture2DRestorer restorer(this);
if (!canvas->is3D()) {
@@ -3616,7 +3616,7 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
} else {
WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->renderingContext());
ScopedTexture2DRestorer restorer(gl);
- if (gl && gl->drawingBuffer()->copyToPlatformTexture(webContext(), texture->object(), internalformat, type,
+ if (gl->drawingBuffer()->copyToPlatformTexture(webContext(), texture->object(), internalformat, type,
level, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) {
texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type);
return;
@@ -3624,7 +3624,7 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
}
}
- texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(BackBuffer), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
+ texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(BackBuffer).get(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
}
PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
@@ -3858,7 +3858,7 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
|| !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElement, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset))
return;
- texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(BackBuffer), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
+ texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(BackBuffer).get(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState);
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
@@ -5366,7 +5366,7 @@ bool WebGLRenderingContextBase::validateHTMLImageElement(const char* functionNam
bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& exceptionState)
{
- if (!canvas || !canvas->buffer()) {
+ if (!canvas || !canvas->isDrawable()) {
synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas");
return false;
}

Powered by Google App Engine
This is Rietveld 408576698