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/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 void* mappedData = contextGL()->MapBufferRange(target, static_cast<GLintptr>
(srcByteOffset), subByteLength, GL_MAP_READ_BIT); | 323 void* mappedData = contextGL()->MapBufferRange(target, static_cast<GLintptr>
(srcByteOffset), subByteLength, GL_MAP_READ_BIT); |
324 | 324 |
325 if (!mappedData) | 325 if (!mappedData) |
326 return; | 326 return; |
327 | 327 |
328 memcpy(subBaseAddress, mappedData, subByteLength); | 328 memcpy(subBaseAddress, mappedData, subByteLength); |
329 | 329 |
330 contextGL()->UnmapBuffer(target); | 330 contextGL()->UnmapBuffer(target); |
331 } | 331 } |
332 | 332 |
333 void WebGL2RenderingContextBase::getBufferSubData(GLenum target, long long srcBy
teOffset, DOMArrayBuffer* dstData) | |
334 { | |
335 const char* funcName = "getBufferSubData"; | |
336 if (isContextLost()) | |
337 return; | |
338 | |
339 if (!dstData) { | |
340 synthesizeGLError(GL_INVALID_VALUE, funcName, "ArrayBuffer can not be nu
ll"); | |
341 return; | |
342 } | |
343 if (!validateValueFitNonNegInt32(funcName, "srcByteOffset", srcByteOffset))
{ | |
344 return; | |
345 } | |
346 WebGLBuffer* buffer = validateBufferDataTarget(funcName, target); | |
347 if (!buffer) | |
348 return; | |
349 if (srcByteOffset + dstData->byteLength() > buffer->getSize()) { | |
350 synthesizeGLError(GL_INVALID_VALUE, funcName, "buffer overflow"); | |
351 return; | |
352 } | |
353 | |
354 void* mappedData = contextGL()->MapBufferRange(target, static_cast<GLintptr>
(srcByteOffset), dstData->byteLength(), GL_MAP_READ_BIT); | |
355 if (!mappedData) | |
356 return; | |
357 memcpy(dstData->data(), mappedData, dstData->byteLength()); | |
358 contextGL()->UnmapBuffer(target); | |
359 } | |
360 | |
361 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint
srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi
eld mask, GLenum filter) | 333 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint
srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi
eld mask, GLenum filter) |
362 { | 334 { |
363 if (isContextLost()) | 335 if (isContextLost()) |
364 return; | 336 return; |
365 | 337 |
366 contextGL()->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY
0, dstX1, dstY1, mask, filter); | 338 contextGL()->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY
0, dstX1, dstY1, mask, filter); |
367 } | 339 } |
368 | 340 |
369 bool WebGL2RenderingContextBase::validateTexFuncLayer(const char* functionName,
GLenum texTarget, GLint layer) | 341 bool WebGL2RenderingContextBase::validateTexFuncLayer(const char* functionName,
GLenum texTarget, GLint layer) |
370 { | 342 { |
(...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 params.skipPixels = m_unpackSkipPixels; | 3622 params.skipPixels = m_unpackSkipPixels; |
3651 params.skipRows = m_unpackSkipRows; | 3623 params.skipRows = m_unpackSkipRows; |
3652 if (dimension == Tex3D) { | 3624 if (dimension == Tex3D) { |
3653 params.imageHeight = m_unpackImageHeight; | 3625 params.imageHeight = m_unpackImageHeight; |
3654 params.skipImages = m_unpackSkipImages; | 3626 params.skipImages = m_unpackSkipImages; |
3655 } | 3627 } |
3656 return params; | 3628 return params; |
3657 } | 3629 } |
3658 | 3630 |
3659 } // namespace blink | 3631 } // namespace blink |
OLD | NEW |