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

Side by Side Diff: Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 1307143005: Make 2D canvas smarter about chosing whether or not to use GPU acceleration (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/webgl/WebGL2RenderingContextBase.h" 6 #include "modules/webgl/WebGL2RenderingContextBase.h"
7 7
8 #include "bindings/modules/v8/WebGLAny.h" 8 #include "bindings/modules/v8/WebGLAny.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } 739 }
740 740
741 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) 741 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState)
742 { 742 {
743 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState)) 743 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState))
744 return; 744 return;
745 745
746 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) { 746 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) {
747 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() ); 747 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() );
748 // 2D canvas has only FrontBuffer. 748 // 2D canvas has only FrontBuffer.
749 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer).get(), 749 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
750 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); 750 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha);
751 return; 751 return;
752 } 752 }
753 753
754 // FIXME: Can we do an accelerated copy in this case? 754 // FIXME: Can we do an accelerated copy in this case?
755 notImplemented(); 755 notImplemented();
756 } 756 }
757 757
758 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) 758 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState)
759 { 759 {
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2861 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 2861 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
2862 { 2862 {
2863 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 2863 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
2864 return m_readFramebufferBinding->colorBufferFormat(); 2864 return m_readFramebufferBinding->colorBufferFormat();
2865 if (m_requestedAttributes.alpha()) 2865 if (m_requestedAttributes.alpha())
2866 return GL_RGBA; 2866 return GL_RGBA;
2867 return GL_RGB; 2867 return GL_RGB;
2868 } 2868 }
2869 2869
2870 } // namespace blink 2870 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698