Index: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
index 9a30edeb4a32ce1c57f6c44b02ba43fb17be4690..c2788856703d5d6f14241af9aa2ab22cbea144da 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp |
@@ -1976,16 +1976,16 @@ bool WebGLImageConversion::computeFormatAndTypeParameters(GLenum format, GLenum |
return true; |
} |
-GLenum WebGLImageConversion::computeImageSizeInBytes(GLenum format, GLenum type, GLsizei width, GLsizei height, GLint alignment, unsigned* imageSizeInBytes, unsigned* paddingInBytes) |
+GLenum WebGLImageConversion::computeImageSizeInBytes(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, GLint alignment, unsigned* imageSizeInBytes, unsigned* paddingInBytes) |
{ |
ASSERT(imageSizeInBytes); |
ASSERT(alignment == 1 || alignment == 2 || alignment == 4 || alignment == 8); |
- if (width < 0 || height < 0) |
+ if (width < 0 || height < 0 || depth < 0) |
return GL_INVALID_VALUE; |
unsigned bytesPerComponent, componentsPerPixel; |
if (!computeFormatAndTypeParameters(format, type, &bytesPerComponent, &componentsPerPixel)) |
return GL_INVALID_ENUM; |
- if (!width || !height) { |
+ if (!width || !height || !depth) { |
*imageSizeInBytes = 0; |
if (paddingInBytes) |
*paddingInBytes = 0; |
@@ -2007,6 +2007,9 @@ GLenum WebGLImageConversion::computeImageSizeInBytes(GLenum format, GLenum type, |
checkedValue += validRowSize; |
if (!checkedValue.isValid()) |
return GL_INVALID_VALUE; |
+ checkedValue *= depth; |
+ if (!checkedValue.isValid()) |
+ return GL_INVALID_VALUE; |
Zhenyao Mo
2015/11/12 11:31:52
Another issue: see above, "last row needs no paddi
qiankun
2015/11/13 08:29:59
Done.
|
*imageSizeInBytes = checkedValue.value(); |
if (paddingInBytes) |
*paddingInBytes = padding; |
@@ -2206,7 +2209,7 @@ bool WebGLImageConversion::packImageData( |
unsigned packedSize; |
// Output data is tightly packed (alignment == 1). |
- if (computeImageSizeInBytes(format, type, width, height, 1, &packedSize, 0) != GL_NO_ERROR) |
+ if (computeImageSizeInBytes(format, type, width, height, 1, 1, &packedSize, 0) != GL_NO_ERROR) |
return false; |
data.resize(packedSize); |
@@ -2233,7 +2236,7 @@ bool WebGLImageConversion::extractImageData( |
unsigned packedSize; |
// Output data is tightly packed (alignment == 1). |
- if (computeImageSizeInBytes(format, type, width, height, 1, &packedSize, 0) != GL_NO_ERROR) |
+ if (computeImageSizeInBytes(format, type, width, height, 1, 1, &packedSize, 0) != GL_NO_ERROR) |
return false; |
data.resize(packedSize); |