| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool WebGLTexture::isValid(GLenum target, GLint level) const | 281 bool WebGLTexture::isValid(GLenum target, GLint level) const |
| 282 { | 282 { |
| 283 const LevelInfo* info = getLevelInfo(target, level); | 283 const LevelInfo* info = getLevelInfo(target, level); |
| 284 if (!info) | 284 if (!info) |
| 285 return 0; | 285 return 0; |
| 286 return info->valid; | 286 return info->valid; |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool WebGLTexture::isValidLevel(GLenum target, GLint level) const |
| 290 { |
| 291 if (!object() || !m_target) |
| 292 return false; |
| 293 int targetIndex = mapTargetToIndex(target); |
| 294 if (targetIndex < 0 || targetIndex >= static_cast<int>(m_info.size())) |
| 295 return false; |
| 296 if (level < 0 || level >= static_cast<GLint>(m_info[targetIndex].size())) |
| 297 return false; |
| 298 return true; |
| 299 } |
| 300 |
| 289 bool WebGLTexture::isNPOT(GLsizei width, GLsizei height) | 301 bool WebGLTexture::isNPOT(GLsizei width, GLsizei height) |
| 290 { | 302 { |
| 291 ASSERT(width >= 0 && height >= 0); | 303 ASSERT(width >= 0 && height >= 0); |
| 292 if (!width || !height) | 304 if (!width || !height) |
| 293 return false; | 305 return false; |
| 294 if ((width & (width - 1)) || (height & (height - 1))) | 306 if ((width & (width - 1)) || (height & (height - 1))) |
| 295 return true; | 307 return true; |
| 296 return false; | 308 return false; |
| 297 } | 309 } |
| 298 | 310 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: | 606 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
| 595 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: | 607 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
| 596 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: | 608 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: |
| 597 return GL_UNSIGNED_BYTE; | 609 return GL_UNSIGNED_BYTE; |
| 598 default: | 610 default: |
| 599 return GL_NONE; | 611 return GL_NONE; |
| 600 } | 612 } |
| 601 } | 613 } |
| 602 | 614 |
| 603 } // namespace blink | 615 } // namespace blink |
| OLD | NEW |