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 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 // preserveObjectWrapper work in this case. | 1581 // preserveObjectWrapper work in this case. |
1582 v8::Local<v8::String> hiddenValueName; | 1582 v8::Local<v8::String> hiddenValueName; |
1583 ScopedPersistent<v8::Array>* persistentCache = nullptr; | 1583 ScopedPersistent<v8::Array>* persistentCache = nullptr; |
1584 if (target == GL_TEXTURE_2D) { | 1584 if (target == GL_TEXTURE_2D) { |
1585 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; | 1585 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; |
1586 | 1586 |
1587 if (!m_activeTextureUnit) | 1587 if (!m_activeTextureUnit) |
1588 drawingBuffer()->setTexture2DBinding(objectOrZero(texture)); | 1588 drawingBuffer()->setTexture2DBinding(objectOrZero(texture)); |
1589 if (scriptState) { | 1589 if (scriptState) { |
1590 hiddenValueName = V8HiddenValue::webgl2DTextures(scriptState->isolat
e()); | 1590 hiddenValueName = V8HiddenValue::webgl2DTextures(scriptState->isolat
e()); |
1591 persistentCache = &m_2DTextureWrappers; | 1591 persistentCache = &m_wrappersOf2DTextures; |
1592 } | 1592 } |
1593 } else if (target == GL_TEXTURE_CUBE_MAP) { | 1593 } else if (target == GL_TEXTURE_CUBE_MAP) { |
1594 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; | 1594 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; |
1595 if (scriptState) { | 1595 if (scriptState) { |
1596 hiddenValueName = V8HiddenValue::webglCubeMapTextures(scriptState->i
solate()); | 1596 hiddenValueName = V8HiddenValue::webglCubeMapTextures(scriptState->i
solate()); |
1597 persistentCache = &m_cubeMapTextureWrappers; | 1597 persistentCache = &m_cubeMapTextureWrappers; |
1598 } | 1598 } |
1599 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) { | 1599 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) { |
1600 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture; | 1600 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture; |
1601 if (scriptState) { | 1601 if (scriptState) { |
1602 hiddenValueName = V8HiddenValue::webgl2DArrayTextures(scriptState->i
solate()); | 1602 hiddenValueName = V8HiddenValue::webgl2DArrayTextures(scriptState->i
solate()); |
1603 persistentCache = &m_2DArrayTextureWrappers; | 1603 persistentCache = &m_wrappersOf2DArrayTextures; |
1604 } | 1604 } |
1605 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) { | 1605 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) { |
1606 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture; | 1606 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture; |
1607 if (scriptState) { | 1607 if (scriptState) { |
1608 hiddenValueName = V8HiddenValue::webgl3DTextures(scriptState->isolat
e()); | 1608 hiddenValueName = V8HiddenValue::webgl3DTextures(scriptState->isolat
e()); |
1609 persistentCache = &m_3DTextureWrappers; | 1609 persistentCache = &m_wrappersOf3DTextures; |
1610 } | 1610 } |
1611 } else { | 1611 } else { |
1612 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target"); | 1612 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target"); |
1613 return; | 1613 return; |
1614 } | 1614 } |
1615 | 1615 |
1616 contextGL()->BindTexture(target, objectOrZero(texture)); | 1616 contextGL()->BindTexture(target, objectOrZero(texture)); |
1617 // This is called both internally and externally (from JavaScript). We only
update which wrapper | 1617 // This is called both internally and externally (from JavaScript). We only
update which wrapper |
1618 // is preserved when it's called from JavaScript. | 1618 // is preserved when it's called from JavaScript. |
1619 if (scriptState) { | 1619 if (scriptState) { |
(...skipping 4872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6492 | 6492 |
6493 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6493 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
6494 { | 6494 { |
6495 if (canvas()) | 6495 if (canvas()) |
6496 result.setHTMLCanvasElement(canvas()); | 6496 result.setHTMLCanvasElement(canvas()); |
6497 else | 6497 else |
6498 result.setOffscreenCanvas(getOffscreenCanvas()); | 6498 result.setOffscreenCanvas(getOffscreenCanvas()); |
6499 } | 6499 } |
6500 | 6500 |
6501 } // namespace blink | 6501 } // namespace blink |
OLD | NEW |