Chromium Code Reviews| Index: gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc |
| =================================================================== |
| --- gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc (revision 141671) |
| +++ gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc (working copy) |
| @@ -116,6 +116,29 @@ |
| EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| } |
| +// Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM |
| +// storage setting. |
| +TEST_F(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { |
|
apatrick_chromium
2012/06/14 21:06:29
How about the unpremultiply flip y variant as well
Jeff Timanus
2012/06/14 22:54:14
Done.
|
| + uint8 pixels[1 * 4] = { 16, 16, 16, 128 }; |
| + |
| + glBindTexture(GL_TEXTURE_2D, textures_[0]); |
| + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| + pixels); |
| + |
| + glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); |
| + glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, GL_RGBA); |
| + EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| + |
| + uint8 copied_pixels[1 * 4]; |
| + glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels); |
| + EXPECT_EQ(32u, copied_pixels[0]); |
| + EXPECT_EQ(32u, copied_pixels[1]); |
| + EXPECT_EQ(32u, copied_pixels[2]); |
| + EXPECT_EQ(128u, copied_pixels[3]); |
| + |
| + EXPECT_TRUE(GL_NO_ERROR == glGetError()); |
| +} |
| + |
| TEST_F(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) { |
| uint8 pixels[2][2][4]; |
| for (int x = 0; x < 2; ++x) { |