Chromium Code Reviews| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 { | 166 { |
| 167 ASSERT(!m_immutable); | 167 ASSERT(!m_immutable); |
| 168 | 168 |
| 169 if (!object() || !m_target) | 169 if (!object() || !m_target) |
| 170 return; | 170 return; |
| 171 // We assume level, internalFormat, width, height, depth, and type have all been | 171 // We assume level, internalFormat, width, height, depth, and type have all been |
| 172 // validated already. | 172 // validated already. |
| 173 int index = mapTargetToIndex(target); | 173 int index = mapTargetToIndex(target); |
| 174 if (index < 0) | 174 if (index < 0) |
| 175 return; | 175 return; |
| 176 | |
| 177 if (level < 0 || level >= static_cast<GLint>(m_info[index].size())) | |
| 178 return; | |
|
qiankun
2015/11/23 06:19:00
See the above comments. level should be validated
| |
| 179 | |
| 176 m_info[index][level].setInfo(internalFormat, width, height, depth, type); | 180 m_info[index][level].setInfo(internalFormat, width, height, depth, type); |
| 177 update(); | 181 update(); |
| 178 } | 182 } |
| 179 | 183 |
| 180 void WebGLTexture::setTexStorageInfo(GLenum target, GLint levels, GLenum interna lFormat, GLsizei width, GLsizei height, GLsizei depth) | 184 void WebGLTexture::setTexStorageInfo(GLenum target, GLint levels, GLenum interna lFormat, GLsizei width, GLsizei height, GLsizei depth) |
| 181 { | 185 { |
| 182 ASSERT(!m_immutable); | 186 ASSERT(!m_immutable); |
| 183 | 187 |
| 184 // We assume level, internalFormat, width, height, and depth have all been | 188 // We assume level, internalFormat, width, height, and depth have all been |
| 185 // validated already. | 189 // validated already. |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 598 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
| 595 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: | 599 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
| 596 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: | 600 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
| 597 return GL_UNSIGNED_BYTE; | 601 return GL_UNSIGNED_BYTE; |
| 598 default: | 602 default: |
| 599 return GL_NONE; | 603 return GL_NONE; |
| 600 } | 604 } |
| 601 } | 605 } |
| 602 | 606 |
| 603 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |