Chromium Code Reviews| Index: Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| diff --git a/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| index 672270918c6d75a9ccdd2152dd3c76bb7ab830f9..15ec73125804878d3db407bf9b01277ca080c594 100644 |
| --- a/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| +++ b/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| @@ -244,6 +244,39 @@ void WebGL2RenderingContextBase::readBuffer(GLenum mode) |
| webContext()->readBuffer(mode); |
| } |
| +void WebGL2RenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels) |
| +{ |
| + if (isContextLost()) |
| + return; |
| + if (m_boundPixelPackBuffer.get()) { |
| + synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "PIXEL_PACK buffer should not bound"); |
|
Ken Russell (switch to Gerrit)
2015/08/19 23:42:52
nit: "should not be bound"
yunchao
2015/08/20 08:16:38
Done.
|
| + return; |
| + } |
| + |
| + WebGLRenderingContextBase::readPixels(x, y, width, height, format, type, pixels); |
| +} |
| + |
| +void WebGL2RenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, long long offset) |
| +{ |
| + if (isContextLost()) |
| + return; |
| + |
| + if (!validateValueFitNonNegInt32("readPixels", "offset", offset)) |
| + return; |
| + |
| + WebGLBuffer* buffer = m_boundPixelPackBuffer.get(); |
| + if (!buffer) { |
| + synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "no PIXEL_PACK buffer bound"); |
| + return; |
| + } |
| + |
| + // Need to validate whether the pixel pack buffer is mapped, |
| + // if we decide to expose mapBufferRange() to web developers. |
| + |
| + long long size = buffer->getSize() - offset; |
|
Zhenyao Mo
2015/08/19 17:20:23
nit: add a note if offset is larger than buffer si
yunchao
2015/08/20 08:16:38
Done.
|
| + WebGLRenderingContextBase::readPixelsImpl(x, y, width, height, format, type, reinterpret_cast<void*>(offset), size); |
| +} |
| + |
| void WebGL2RenderingContextBase::renderbufferStorageImpl( |
| GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, |
| const char* functionName) |