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 "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
6 | 6 |
7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 HTMLImageElement* image, | 1324 HTMLImageElement* image, |
1325 ExceptionState& exceptionState) { | 1325 ExceptionState& exceptionState) { |
1326 IntRect sourceImageRect; | 1326 IntRect sourceImageRect; |
1327 if (image) { | 1327 if (image) { |
1328 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); | 1328 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); |
1329 sourceImageRect.setSize(IntSize(width, height)); | 1329 sourceImageRect.setSize(IntSize(width, height)); |
1330 } | 1330 } |
1331 | 1331 |
1332 texImageHelperHTMLImageElement(TexImage2D, target, level, internalformat, | 1332 texImageHelperHTMLImageElement(TexImage2D, target, level, internalformat, |
1333 format, type, 0, 0, 0, image, sourceImageRect, | 1333 format, type, 0, 0, 0, image, sourceImageRect, |
1334 exceptionState); | 1334 1, m_unpackImageHeight, exceptionState); |
1335 } | 1335 } |
1336 | 1336 |
1337 void WebGL2RenderingContextBase::texImage2D(GLenum target, | 1337 void WebGL2RenderingContextBase::texImage2D(GLenum target, |
1338 GLint level, | 1338 GLint level, |
1339 GLint internalformat, | 1339 GLint internalformat, |
1340 GLsizei width, | 1340 GLsizei width, |
1341 GLsizei height, | 1341 GLsizei height, |
1342 GLint border, | 1342 GLint border, |
1343 GLenum format, | 1343 GLenum format, |
1344 GLenum type, | 1344 GLenum type, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 GLenum type, | 1477 GLenum type, |
1478 HTMLImageElement* image, | 1478 HTMLImageElement* image, |
1479 ExceptionState& exceptionState) { | 1479 ExceptionState& exceptionState) { |
1480 IntRect sourceImageRect; | 1480 IntRect sourceImageRect; |
1481 if (image) { | 1481 if (image) { |
1482 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); | 1482 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); |
1483 sourceImageRect.setSize(IntSize(width, height)); | 1483 sourceImageRect.setSize(IntSize(width, height)); |
1484 } | 1484 } |
1485 | 1485 |
1486 texImageHelperHTMLImageElement(TexSubImage2D, target, level, 0, format, type, | 1486 texImageHelperHTMLImageElement(TexSubImage2D, target, level, 0, format, type, |
1487 xoffset, yoffset, 0, image, sourceImageRect, | 1487 xoffset, yoffset, 0, image, sourceImageRect, 1, |
1488 exceptionState); | 1488 m_unpackImageHeight, exceptionState); |
1489 } | 1489 } |
1490 | 1490 |
1491 void WebGL2RenderingContextBase::texSubImage2D(GLenum target, | 1491 void WebGL2RenderingContextBase::texSubImage2D(GLenum target, |
1492 GLint level, | 1492 GLint level, |
1493 GLint xoffset, | 1493 GLint xoffset, |
1494 GLint yoffset, | 1494 GLint yoffset, |
1495 GLsizei width, | 1495 GLsizei width, |
1496 GLsizei height, | 1496 GLsizei height, |
1497 GLenum format, | 1497 GLenum format, |
1498 GLenum type, | 1498 GLenum type, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 GLint level, | 1694 GLint level, |
1695 GLint internalformat, | 1695 GLint internalformat, |
1696 GLsizei width, | 1696 GLsizei width, |
1697 GLsizei height, | 1697 GLsizei height, |
1698 GLsizei depth, | 1698 GLsizei depth, |
1699 GLint border, | 1699 GLint border, |
1700 GLenum format, | 1700 GLenum format, |
1701 GLenum type, | 1701 GLenum type, |
1702 HTMLImageElement* image, | 1702 HTMLImageElement* image, |
1703 ExceptionState& exceptionState) { | 1703 ExceptionState& exceptionState) { |
1704 // TODO(zmo): To be implemented. | 1704 IntRect sourceImageRect; |
| 1705 if (image) { |
| 1706 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); |
| 1707 sourceImageRect.setSize(IntSize(width, height)); |
| 1708 } |
| 1709 |
| 1710 texImageHelperHTMLImageElement(TexImage3D, target, level, internalformat, |
| 1711 format, type, 0, 0, 0, image, sourceImageRect, |
| 1712 depth, m_unpackImageHeight, exceptionState); |
1705 } | 1713 } |
1706 | 1714 |
1707 void WebGL2RenderingContextBase::texImage3D(GLenum target, | 1715 void WebGL2RenderingContextBase::texImage3D(GLenum target, |
1708 GLint level, | 1716 GLint level, |
1709 GLint internalformat, | 1717 GLint internalformat, |
1710 GLsizei width, | 1718 GLsizei width, |
1711 GLsizei height, | 1719 GLsizei height, |
1712 GLsizei depth, | 1720 GLsizei depth, |
1713 GLint border, | 1721 GLint border, |
1714 GLenum format, | 1722 GLenum format, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 GLint xoffset, | 1822 GLint xoffset, |
1815 GLint yoffset, | 1823 GLint yoffset, |
1816 GLint zoffset, | 1824 GLint zoffset, |
1817 GLsizei width, | 1825 GLsizei width, |
1818 GLsizei height, | 1826 GLsizei height, |
1819 GLsizei depth, | 1827 GLsizei depth, |
1820 GLenum format, | 1828 GLenum format, |
1821 GLenum type, | 1829 GLenum type, |
1822 HTMLImageElement* image, | 1830 HTMLImageElement* image, |
1823 ExceptionState& exceptionState) { | 1831 ExceptionState& exceptionState) { |
1824 // TODO(zmo): To be implemented. | 1832 IntRect sourceImageRect; |
| 1833 if (image) { |
| 1834 sourceImageRect.setLocation(IntPoint(m_unpackSkipPixels, m_unpackSkipRows)); |
| 1835 sourceImageRect.setSize(IntSize(width, height)); |
| 1836 } |
| 1837 |
| 1838 texImageHelperHTMLImageElement( |
| 1839 TexSubImage3D, target, level, 0, format, type, xoffset, yoffset, zoffset, |
| 1840 image, sourceImageRect, depth, m_unpackImageHeight, exceptionState); |
1825 } | 1841 } |
1826 | 1842 |
1827 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, | 1843 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, |
1828 GLint level, | 1844 GLint level, |
1829 GLint xoffset, | 1845 GLint xoffset, |
1830 GLint yoffset, | 1846 GLint yoffset, |
1831 GLint zoffset, | 1847 GLint zoffset, |
1832 GLsizei width, | 1848 GLsizei width, |
1833 GLsizei height, | 1849 GLsizei height, |
1834 GLsizei depth, | 1850 GLsizei depth, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 xoffset, yoffset, zoffset, pixels); | 1897 xoffset, yoffset, zoffset, pixels); |
1882 } | 1898 } |
1883 | 1899 |
1884 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, | 1900 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, |
1885 GLint level, | 1901 GLint level, |
1886 GLint xoffset, | 1902 GLint xoffset, |
1887 GLint yoffset, | 1903 GLint yoffset, |
1888 GLint zoffset, | 1904 GLint zoffset, |
1889 GLenum format, | 1905 GLenum format, |
1890 GLenum type, | 1906 GLenum type, |
1891 HTMLImageElement* image, | |
1892 ExceptionState& exceptionState) { | |
1893 texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type, | |
1894 xoffset, yoffset, zoffset, image, | |
1895 sentinelEmptyRect(), exceptionState); | |
1896 } | |
1897 | |
1898 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, | |
1899 GLint level, | |
1900 GLint xoffset, | |
1901 GLint yoffset, | |
1902 GLint zoffset, | |
1903 GLenum format, | |
1904 GLenum type, | |
1905 HTMLCanvasElement* canvas, | 1907 HTMLCanvasElement* canvas, |
1906 ExceptionState& exceptionState) { | 1908 ExceptionState& exceptionState) { |
1907 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, type, | 1909 texImageHelperHTMLCanvasElement(TexSubImage3D, target, level, 0, format, type, |
1908 xoffset, yoffset, zoffset, canvas, | 1910 xoffset, yoffset, zoffset, canvas, |
1909 exceptionState); | 1911 exceptionState); |
1910 } | 1912 } |
1911 | 1913 |
1912 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, | 1914 void WebGL2RenderingContextBase::texSubImage3D(GLenum target, |
1913 GLint level, | 1915 GLint level, |
1914 GLint xoffset, | 1916 GLint xoffset, |
(...skipping 3037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4952 | 4954 |
4953 void WebGL2RenderingContextBase:: | 4955 void WebGL2RenderingContextBase:: |
4954 DrawingBufferClientRestorePixelUnpackBufferBinding() { | 4956 DrawingBufferClientRestorePixelUnpackBufferBinding() { |
4955 if (!contextGL()) | 4957 if (!contextGL()) |
4956 return; | 4958 return; |
4957 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, | 4959 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
4958 objectOrZero(m_boundPixelUnpackBuffer.get())); | 4960 objectOrZero(m_boundPixelUnpackBuffer.get())); |
4959 } | 4961 } |
4960 | 4962 |
4961 } // namespace blink | 4963 } // namespace blink |
OLD | NEW |