Index: gpu/command_buffer/tests/gl_test_utils.cc |
diff --git a/gpu/command_buffer/tests/gl_test_utils.cc b/gpu/command_buffer/tests/gl_test_utils.cc |
index 5917bfe6c8e2d843fae1e39836fd388b85356e74..2a76cb9b23f99a259af54330df514e892f9b1fb8 100644 |
--- a/gpu/command_buffer/tests/gl_test_utils.cc |
+++ b/gpu/command_buffer/tests/gl_test_utils.cc |
@@ -209,16 +209,18 @@ bool GLTestHelper::CheckPixels(GLint x, |
GLsizei width, |
GLsizei height, |
GLint tolerance, |
- const uint8_t* color) { |
+ const uint8_t* color, |
+ int channel_count) { |
GLsizei size = width * height * 4; |
std::unique_ptr<uint8_t[]> pixels(new uint8_t[size]); |
memset(pixels.get(), kCheckClearValue, size); |
glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); |
int bad_count = 0; |
+ channel_count = channel_count > 4 ? 4 : channel_count; |
for (GLint yy = 0; yy < height; ++yy) { |
for (GLint xx = 0; xx < width; ++xx) { |
int offset = yy * width * 4 + xx * 4; |
- for (int jj = 0; jj < 4; ++jj) { |
+ for (int jj = 0; jj < channel_count; ++jj) { |
uint8_t actual = pixels[offset + jj]; |
uint8_t expected = color[jj]; |
int diff = actual - expected; |