| 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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 bool validateTexImageSubRectangle(const char* functionName, | 1033 bool validateTexImageSubRectangle(const char* functionName, |
| 1034 TexImageFunctionID functionID, | 1034 TexImageFunctionID functionID, |
| 1035 T* image, | 1035 T* image, |
| 1036 const IntRect& subRect, | 1036 const IntRect& subRect, |
| 1037 GLsizei depth, | 1037 GLsizei depth, |
| 1038 GLint unpackImageHeight, | 1038 GLint unpackImageHeight, |
| 1039 bool* selectingSubRectangle) { | 1039 bool* selectingSubRectangle) { |
| 1040 DCHECK(functionName); | 1040 DCHECK(functionName); |
| 1041 DCHECK(selectingSubRectangle); | 1041 DCHECK(selectingSubRectangle); |
| 1042 DCHECK(image); | 1042 DCHECK(image); |
| 1043 *selectingSubRectangle = image && | 1043 int imageWidth = static_cast<int>(image->width()); |
| 1044 !(subRect.x() == 0 && subRect.y() == 0 && | 1044 int imageHeight = static_cast<int>(image->height()); |
| 1045 subRect.width() == image->width() && | 1045 *selectingSubRectangle = |
| 1046 subRect.height() == image->height()); | 1046 !(subRect.x() == 0 && subRect.y() == 0 && |
| 1047 subRect.width() == imageWidth && subRect.height() == imageHeight); |
| 1047 // If the source image rect selects anything except the entire | 1048 // If the source image rect selects anything except the entire |
| 1048 // contents of the image, assert that we're running WebGL 2.0 or | 1049 // contents of the image, assert that we're running WebGL 2.0 or |
| 1049 // higher, since this should never happen for WebGL 1.0 (even though | 1050 // higher, since this should never happen for WebGL 1.0 (even though |
| 1050 // the code could support it). If the image is null, that will be | 1051 // the code could support it). If the image is null, that will be |
| 1051 // signaled as an error later. | 1052 // signaled as an error later. |
| 1052 DCHECK(!*selectingSubRectangle || isWebGL2OrHigher()) | 1053 DCHECK(!*selectingSubRectangle || isWebGL2OrHigher()) |
| 1053 << "subRect = (" << subRect.width() << " x " << subRect.height() | 1054 << "subRect = (" << subRect.width() << " x " << subRect.height() |
| 1054 << ") @ (" << subRect.x() << ", " << subRect.y() << "), image = (" | 1055 << ") @ (" << subRect.x() << ", " << subRect.y() << "), image = (" |
| 1055 << (image ? image->width() : -1) << " x " | 1056 << imageWidth << " x " << imageHeight << ")"; |
| 1056 << (image ? image->height() : -1) << ")"; | |
| 1057 | 1057 |
| 1058 if (subRect.x() < 0 || subRect.y() < 0 || subRect.maxX() > image->width() || | 1058 if (subRect.x() < 0 || subRect.y() < 0 || subRect.maxX() > imageWidth || |
| 1059 subRect.maxY() > image->height() || subRect.width() < 0 || | 1059 subRect.maxY() > imageHeight || subRect.width() < 0 || |
| 1060 subRect.height() < 0) { | 1060 subRect.height() < 0) { |
| 1061 synthesizeGLError(GL_INVALID_OPERATION, functionName, | 1061 synthesizeGLError(GL_INVALID_OPERATION, functionName, |
| 1062 "source sub-rectangle specified via pixel unpack " | 1062 "source sub-rectangle specified via pixel unpack " |
| 1063 "parameters is invalid"); | 1063 "parameters is invalid"); |
| 1064 return false; | 1064 return false; |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 if (functionID == TexImage3D || functionID == TexSubImage3D) { | 1067 if (functionID == TexImage3D || functionID == TexSubImage3D) { |
| 1068 DCHECK_GE(unpackImageHeight, 0); | 1068 DCHECK_GE(unpackImageHeight, 0); |
| 1069 | 1069 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 void texImageHelperImageBitmap(TexImageFunctionID, | 1594 void texImageHelperImageBitmap(TexImageFunctionID, |
| 1595 GLenum, | 1595 GLenum, |
| 1596 GLint, | 1596 GLint, |
| 1597 GLint, | 1597 GLint, |
| 1598 GLenum, | 1598 GLenum, |
| 1599 GLenum, | 1599 GLenum, |
| 1600 GLint, | 1600 GLint, |
| 1601 GLint, | 1601 GLint, |
| 1602 GLint, | 1602 GLint, |
| 1603 ImageBitmap*, | 1603 ImageBitmap*, |
| 1604 const IntRect&, |
| 1605 GLsizei, |
| 1606 GLint, |
| 1604 ExceptionState&); | 1607 ExceptionState&); |
| 1605 static const char* getTexImageFunctionName(TexImageFunctionID); | 1608 static const char* getTexImageFunctionName(TexImageFunctionID); |
| 1606 IntRect sentinelEmptyRect(); | 1609 IntRect sentinelEmptyRect(); |
| 1607 IntRect safeGetImageSize(Image*); | 1610 IntRect safeGetImageSize(Image*); |
| 1608 IntRect getImageDataSize(ImageData*); | 1611 IntRect getImageDataSize(ImageData*); |
| 1609 | 1612 |
| 1610 // Helper implementing readPixels for WebGL 1.0 and 2.0. | 1613 // Helper implementing readPixels for WebGL 1.0 and 2.0. |
| 1611 void readPixelsHelper(GLint x, | 1614 void readPixelsHelper(GLint x, |
| 1612 GLint y, | 1615 GLint y, |
| 1613 GLsizei width, | 1616 GLsizei width, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 context, | 1651 context, |
| 1649 context->is3d(), | 1652 context->is3d(), |
| 1650 context.is3d()); | 1653 context.is3d()); |
| 1651 | 1654 |
| 1652 } // namespace blink | 1655 } // namespace blink |
| 1653 | 1656 |
| 1654 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( | 1657 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( |
| 1655 blink::WebGLRenderingContextBase::TextureUnitState); | 1658 blink::WebGLRenderingContextBase::TextureUnitState); |
| 1656 | 1659 |
| 1657 #endif // WebGLRenderingContextBase_h | 1660 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |