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

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

Issue 1372463002: Re-land: Make 2D canvas smarter about chosing whether or not to use GPU acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed assert Created 5 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 unified diff | Download patch
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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 786 }
787 787
788 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) 788 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState)
789 { 789 {
790 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState)) 790 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState))
791 return; 791 return;
792 792
793 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) { 793 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) {
794 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() ); 794 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() );
795 // 2D canvas has only FrontBuffer. 795 // 2D canvas has only FrontBuffer.
796 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer).get(), 796 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
797 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); 797 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha);
798 return; 798 return;
799 } 799 }
800 800
801 // FIXME: Can we do an accelerated copy in this case? 801 // FIXME: Can we do an accelerated copy in this case?
802 notImplemented(); 802 notImplemented();
803 } 803 }
804 804
805 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) 805 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState)
806 { 806 {
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 2908 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
2909 { 2909 {
2910 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 2910 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
2911 return m_readFramebufferBinding->colorBufferFormat(); 2911 return m_readFramebufferBinding->colorBufferFormat();
2912 if (m_requestedAttributes.alpha()) 2912 if (m_requestedAttributes.alpha())
2913 return GL_RGBA; 2913 return GL_RGBA;
2914 return GL_RGB; 2914 return GL_RGB;
2915 } 2915 }
2916 2916
2917 } // namespace blink 2917 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698