| OLD | NEW |
| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 | 656 |
| 657 if (!validateTexFuncParameters(functionName, NotTexSubImage2D, target, level
, internalformat, width, height, depth, border, format, type)) | 657 if (!validateTexFuncParameters(functionName, NotTexSubImage2D, target, level
, internalformat, width, height, depth, border, format, type)) |
| 658 return false; | 658 return false; |
| 659 | 659 |
| 660 return true; | 660 return true; |
| 661 } | 661 } |
| 662 | 662 |
| 663 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in
ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum
format, GLenum type, DOMArrayBufferView* pixels) | 663 void WebGL2RenderingContextBase::texImage3D(GLenum target, GLint level, GLint in
ternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum
format, GLenum type, DOMArrayBufferView* pixels) |
| 664 { | 664 { |
| 665 if (isContextLost() || !validateTexImage3D("texImage3D", target, level, inte
rnalformat, width, height, depth, border, format, type) | 665 if (isContextLost() || !validateTexImage3D("texImage3D", target, level, inte
rnalformat, width, height, depth, border, format, type) |
| 666 || !validateTexFuncData("texImage3D", level, width, height, format, type
, pixels, NullAllowed)) | 666 || !validateTexFuncData("texImage3D", level, width, height, depth, forma
t, type, pixels, NullAllowed)) |
| 667 return; | 667 return; |
| 668 | 668 |
| 669 void* data = pixels ? pixels->baseAddress() : 0; | 669 void* data = pixels ? pixels->baseAddress() : 0; |
| 670 Vector<uint8_t> tempData; | 670 Vector<uint8_t> tempData; |
| 671 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 671 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
| 672 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. | 672 // FIXME: WebGLImageConversion needs to be updated to accept image depth
. |
| 673 notImplemented(); | 673 notImplemented(); |
| 674 return; | 674 return; |
| 675 } | 675 } |
| 676 | 676 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 if (m_unpackAlignment != 1) | 760 if (m_unpackAlignment != 1) |
| 761 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 761 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 762 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, imageE
xtractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConver
sion ? data.data() : imagePixelData); | 762 webContext()->texSubImage3D(target, level, xoffset, yoffset, zoffset, imageE
xtractor.imageWidth(), imageExtractor.imageHeight(), 1, format, type, needConver
sion ? data.data() : imagePixelData); |
| 763 if (m_unpackAlignment != 1) | 763 if (m_unpackAlignment != 1) |
| 764 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 764 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 765 } | 765 } |
| 766 | 766 |
| 767 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d
epth, GLenum format, GLenum type, DOMArrayBufferView* pixels) | 767 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei d
epth, GLenum format, GLenum type, DOMArrayBufferView* pixels) |
| 768 { | 768 { |
| 769 if (isContextLost() || !pixels || !validateTexSubImage3D("texSubImage3D", ta
rget, level, xoffset, yoffset, zoffset, format, type, width, height, depth) | 769 if (isContextLost() || !pixels || !validateTexSubImage3D("texSubImage3D", ta
rget, level, xoffset, yoffset, zoffset, format, type, width, height, depth) |
| 770 || !validateTexFuncData("texSubImage3D", level, width, height, format, t
ype, pixels, NullAllowed)) | 770 || !validateTexFuncData("texSubImage3D", level, width, height, depth, fo
rmat, type, pixels, NullAllowed)) |
| 771 return; | 771 return; |
| 772 | 772 |
| 773 // FIXME: Ensure pixels is large enough to contain the desired texture dimen
sions. | 773 // FIXME: Ensure pixels is large enough to contain the desired texture dimen
sions. |
| 774 | 774 |
| 775 void* data = pixels->baseAddress(); | 775 void* data = pixels->baseAddress(); |
| 776 Vector<uint8_t> tempData; | 776 Vector<uint8_t> tempData; |
| 777 bool changeUnpackAlignment = false; | 777 bool changeUnpackAlignment = false; |
| 778 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 778 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
| 779 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, | 779 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, |
| 780 m_unpackAlignment, | 780 m_unpackAlignment, |
| (...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 3078 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
| 3079 { | 3079 { |
| 3080 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 3080 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
| 3081 return m_readFramebufferBinding->colorBufferFormat(); | 3081 return m_readFramebufferBinding->colorBufferFormat(); |
| 3082 if (m_requestedAttributes.alpha()) | 3082 if (m_requestedAttributes.alpha()) |
| 3083 return GL_RGBA; | 3083 return GL_RGBA; |
| 3084 return GL_RGB; | 3084 return GL_RGB; |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 } // namespace blink | 3087 } // namespace blink |
| OLD | NEW |