| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines tests that implementations of GLImage should pass in order | 5 // This file defines tests that implementations of GLImage should pass in order |
| 6 // to be conformant. | 6 // to be conformant. |
| 7 | 7 |
| 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 10 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 // Create an uninitialized image of preferred format. | 264 // Create an uninitialized image of preferred format. |
| 265 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size); | 265 scoped_refptr<GLImage> image = this->delegate_.CreateImage(image_size); |
| 266 | 266 |
| 267 // Create a texture that |image| will be bound to. | 267 // Create a texture that |image| will be bound to. |
| 268 GLenum target = this->delegate_.GetTextureTarget(); | 268 GLenum target = this->delegate_.GetTextureTarget(); |
| 269 GLuint texture = GLTestHelper::CreateTexture(target); | 269 GLuint texture = GLTestHelper::CreateTexture(target); |
| 270 glBindTexture(target, texture); | 270 glBindTexture(target, texture); |
| 271 | 271 |
| 272 // Bind |image| to |texture|. | 272 // Bind |image| to |texture|. |
| 273 bool rv = image->BindTexImage(target); | 273 bool rv = image->BindTexImage(target, nullptr); |
| 274 EXPECT_TRUE(rv); | 274 EXPECT_TRUE(rv); |
| 275 | 275 |
| 276 // Draw |texture| to viewport. | 276 // Draw |texture| to viewport. |
| 277 DrawTextureQuad(target, image_size); | 277 DrawTextureQuad(target, image_size); |
| 278 | 278 |
| 279 // Release |image| from |texture|. | 279 // Release |image| from |texture|. |
| 280 image->ReleaseTexImage(target); | 280 image->ReleaseTexImage(target); |
| 281 | 281 |
| 282 // Read back pixels to check expectations. | 282 // Read back pixels to check expectations. |
| 283 const uint8_t zero_color[] = {0, 0, 0, 0}; | 283 const uint8_t zero_color[] = {0, 0, 0, 0}; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 311 scoped_refptr<GLImage> image = | 311 scoped_refptr<GLImage> image = |
| 312 this->delegate_.CreateSolidColorImage(image_size, image_color); | 312 this->delegate_.CreateSolidColorImage(image_size, image_color); |
| 313 ASSERT_TRUE(image); | 313 ASSERT_TRUE(image); |
| 314 | 314 |
| 315 // Initialize a blue texture of the same size as |image|. | 315 // Initialize a blue texture of the same size as |image|. |
| 316 unsigned target = this->delegate_.GetTextureTarget(); | 316 unsigned target = this->delegate_.GetTextureTarget(); |
| 317 GLuint texture = GLTestHelper::CreateTexture(target); | 317 GLuint texture = GLTestHelper::CreateTexture(target); |
| 318 glBindTexture(target, texture); | 318 glBindTexture(target, texture); |
| 319 | 319 |
| 320 // Bind |image| to |texture|. | 320 // Bind |image| to |texture|. |
| 321 bool rv = image->BindTexImage(target); | 321 bool rv = image->BindTexImage(target, nullptr); |
| 322 EXPECT_TRUE(rv); | 322 EXPECT_TRUE(rv); |
| 323 | 323 |
| 324 glClearColor(0.0f, 0.0f, 1.0f, 1.0f); | 324 glClearColor(0.0f, 0.0f, 1.0f, 1.0f); |
| 325 glClear(GL_COLOR_BUFFER_BIT); | 325 glClear(GL_COLOR_BUFFER_BIT); |
| 326 // Draw |texture| to viewport. | 326 // Draw |texture| to viewport. |
| 327 DrawTextureQuad(target, image_size); | 327 DrawTextureQuad(target, image_size); |
| 328 | 328 |
| 329 // Read back pixels to check expectations. | 329 // Read back pixels to check expectations. |
| 330 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(), | 330 GLTestHelper::CheckPixels(0, 0, image_size.width(), image_size.height(), |
| 331 image_color); | 331 image_color); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 // The GLImageCopyTest test case verifies that the GLImage implementation | 402 // The GLImageCopyTest test case verifies that the GLImage implementation |
| 403 // handles CopyTexImage correctly. | 403 // handles CopyTexImage correctly. |
| 404 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); | 404 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); |
| 405 | 405 |
| 406 } // namespace gl | 406 } // namespace gl |
| 407 | 407 |
| 408 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 408 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| OLD | NEW |