| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 ScopedTexture2DRestorer restorer(this); | 1538 ScopedTexture2DRestorer restorer(this); |
| 1539 ScopedFramebufferRestorer fbo_restorer(this); | 1539 ScopedFramebufferRestorer fbo_restorer(this); |
| 1540 | 1540 |
| 1541 GetDrawingBuffer()->ResolveAndBindForReadAndDraw(); | 1541 GetDrawingBuffer()->ResolveAndBindForReadAndDraw(); |
| 1542 if (!canvas()->Buffer()->CopyRenderingResultsFromDrawingBuffer( | 1542 if (!canvas()->Buffer()->CopyRenderingResultsFromDrawingBuffer( |
| 1543 GetDrawingBuffer(), source_buffer)) { | 1543 GetDrawingBuffer(), source_buffer)) { |
| 1544 // Currently, copyRenderingResultsFromDrawingBuffer is expected to always | 1544 // Currently, copyRenderingResultsFromDrawingBuffer is expected to always |
| 1545 // succeed because cases where canvas()-buffer() is not accelerated are | 1545 // succeed because cases where canvas()-buffer() is not accelerated are |
| 1546 // handle before reaching this point. If that assumption ever stops holding | 1546 // handle before reaching this point. If that assumption ever stops holding |
| 1547 // true, we may need to implement a fallback right here. | 1547 // true, we may need to implement a fallback right here. |
| 1548 ASSERT_NOT_REACHED(); | 1548 NOTREACHED(); |
| 1549 return false; | 1549 return false; |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 return true; | 1552 return true; |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 ImageData* WebGLRenderingContextBase::PaintRenderingResultsToImageData( | 1555 ImageData* WebGLRenderingContextBase::PaintRenderingResultsToImageData( |
| 1556 SourceDrawingBuffer source_buffer) { | 1556 SourceDrawingBuffer source_buffer) { |
| 1557 if (isContextLost()) | 1557 if (isContextLost()) |
| 1558 return nullptr; | 1558 return nullptr; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 switch (target) { | 1706 switch (target) { |
| 1707 case GL_ARRAY_BUFFER: | 1707 case GL_ARRAY_BUFFER: |
| 1708 bound_array_buffer_ = buffer; | 1708 bound_array_buffer_ = buffer; |
| 1709 break; | 1709 break; |
| 1710 case GL_ELEMENT_ARRAY_BUFFER: | 1710 case GL_ELEMENT_ARRAY_BUFFER: |
| 1711 bound_vertex_array_object_->SetElementArrayBuffer(buffer); | 1711 bound_vertex_array_object_->SetElementArrayBuffer(buffer); |
| 1712 break; | 1712 break; |
| 1713 default: | 1713 default: |
| 1714 ASSERT_NOT_REACHED(); | 1714 NOTREACHED(); |
| 1715 return false; | 1715 return false; |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 if (buffer && !buffer->GetInitialTarget()) | 1718 if (buffer && !buffer->GetInitialTarget()) |
| 1719 buffer->SetInitialTarget(target); | 1719 buffer->SetInitialTarget(target); |
| 1720 return true; | 1720 return true; |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) { | 1723 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) { |
| 1724 bool deleted; | 1724 bool deleted; |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3792 GLint int_value[4]; | 3792 GLint int_value[4]; |
| 3793 ContextGL()->GetVertexAttribIiv(index, pname, int_value); | 3793 ContextGL()->GetVertexAttribIiv(index, pname, int_value); |
| 3794 return WebGLAny(script_state, DOMInt32Array::Create(int_value, 4)); | 3794 return WebGLAny(script_state, DOMInt32Array::Create(int_value, 4)); |
| 3795 } | 3795 } |
| 3796 case kUint32ArrayType: { | 3796 case kUint32ArrayType: { |
| 3797 GLuint uint_value[4]; | 3797 GLuint uint_value[4]; |
| 3798 ContextGL()->GetVertexAttribIuiv(index, pname, uint_value); | 3798 ContextGL()->GetVertexAttribIuiv(index, pname, uint_value); |
| 3799 return WebGLAny(script_state, DOMUint32Array::Create(uint_value, 4)); | 3799 return WebGLAny(script_state, DOMUint32Array::Create(uint_value, 4)); |
| 3800 } | 3800 } |
| 3801 default: | 3801 default: |
| 3802 ASSERT_NOT_REACHED(); | 3802 NOTREACHED(); |
| 3803 break; | 3803 break; |
| 3804 } | 3804 } |
| 3805 return ScriptValue::CreateNull(script_state); | 3805 return ScriptValue::CreateNull(script_state); |
| 3806 } | 3806 } |
| 3807 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: | 3807 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: |
| 3808 if (IsWebGL2OrHigher()) { | 3808 if (IsWebGL2OrHigher()) { |
| 3809 GLint value = 0; | 3809 GLint value = 0; |
| 3810 ContextGL()->GetVertexAttribiv(index, pname, &value); | 3810 ContextGL()->GetVertexAttribiv(index, pname, &value); |
| 3811 return WebGLAny(script_state, static_cast<bool>(value)); | 3811 return WebGLAny(script_state, static_cast<bool>(value)); |
| 3812 } | 3812 } |
| (...skipping 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7060 "and not Uint16Array"); | 7060 "and not Uint16Array"); |
| 7061 return false; | 7061 return false; |
| 7062 } | 7062 } |
| 7063 break; | 7063 break; |
| 7064 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: | 7064 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: |
| 7065 SynthesizeGLError(GL_INVALID_OPERATION, function_name, | 7065 SynthesizeGLError(GL_INVALID_OPERATION, function_name, |
| 7066 "type FLOAT_32_UNSIGNED_INT_24_8_REV but " | 7066 "type FLOAT_32_UNSIGNED_INT_24_8_REV but " |
| 7067 "ArrayBufferView is not NULL"); | 7067 "ArrayBufferView is not NULL"); |
| 7068 return false; | 7068 return false; |
| 7069 default: | 7069 default: |
| 7070 ASSERT_NOT_REACHED(); | 7070 NOTREACHED(); |
| 7071 } | 7071 } |
| 7072 | 7072 |
| 7073 unsigned total_bytes_required, skip_bytes; | 7073 unsigned total_bytes_required, skip_bytes; |
| 7074 GLenum error = WebGLImageConversion::ComputeImageSizeInBytes( | 7074 GLenum error = WebGLImageConversion::ComputeImageSizeInBytes( |
| 7075 format, type, width, height, depth, | 7075 format, type, width, height, depth, |
| 7076 GetUnpackPixelStoreParams(tex_dimension), &total_bytes_required, 0, | 7076 GetUnpackPixelStoreParams(tex_dimension), &total_bytes_required, 0, |
| 7077 &skip_bytes); | 7077 &skip_bytes); |
| 7078 if (error != GL_NO_ERROR) { | 7078 if (error != GL_NO_ERROR) { |
| 7079 SynthesizeGLError(error, function_name, "invalid texture dimensions"); | 7079 SynthesizeGLError(error, function_name, "invalid texture dimensions"); |
| 7080 return false; | 7080 return false; |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7876 | 7876 |
| 7877 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7877 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7878 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7878 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7879 if (canvas()) | 7879 if (canvas()) |
| 7880 result.setHTMLCanvasElement(canvas()); | 7880 result.setHTMLCanvasElement(canvas()); |
| 7881 else | 7881 else |
| 7882 result.setOffscreenCanvas(offscreenCanvas()); | 7882 result.setOffscreenCanvas(offscreenCanvas()); |
| 7883 } | 7883 } |
| 7884 | 7884 |
| 7885 } // namespace blink | 7885 } // namespace blink |
| OLD | NEW |