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: 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: fixing some logic 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 639 }
640 640
641 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState) 641 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLCanvasEl ement* canvas, ExceptionState& exceptionState)
642 { 642 {
643 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState)) 643 if (isContextLost() || !validateHTMLCanvasElement("texSubImage3D", canvas, e xceptionState))
644 return; 644 return;
645 645
646 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) { 646 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccelerate d()) {
647 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() ); 647 ASSERT(!canvas->renderingContext() || canvas->renderingContext()->is2d() );
648 // 2D canvas has only FrontBuffer. 648 // 2D canvas has only FrontBuffer.
649 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer).get(), 649 texSubImage3DImpl(target, level, xoffset, yoffset, zoffset, format, type , canvas->copiedImage(FrontBuffer, PreferAcceleration).get(),
650 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha); 650 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti plyAlpha);
651 return; 651 return;
652 } 652 }
653 653
654 // FIXME: Can we do an accelerated copy in this case? 654 // FIXME: Can we do an accelerated copy in this case?
655 notImplemented(); 655 notImplemented();
656 } 656 }
657 657
658 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState) 658 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, HTMLVideoEle ment* video, ExceptionState& exceptionState)
659 { 659 {
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 2743 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
2744 { 2744 {
2745 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 2745 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
2746 return m_readFramebufferBinding->colorBufferFormat(); 2746 return m_readFramebufferBinding->colorBufferFormat();
2747 if (m_requestedAttributes.alpha()) 2747 if (m_requestedAttributes.alpha())
2748 return GL_RGBA; 2748 return GL_RGBA;
2749 return GL_RGB; 2749 return GL_RGB;
2750 } 2750 }
2751 2751
2752 } // namespace blink 2752 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698