Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: ui/gl/test/gl_image_test_template.h

Issue 1421903006: ui/gl: Move GLImage into gl namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ozone demo Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/demo/surfaceless_gl_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 TYPED_TEST_CASE_P(GLImageTest); 52 TYPED_TEST_CASE_P(GLImageTest);
53 53
54 TYPED_TEST_P(GLImageTest, CreateAndDestroy) { 54 TYPED_TEST_P(GLImageTest, CreateAndDestroy) {
55 const Size small_image_size(4, 4); 55 const Size small_image_size(4, 4);
56 const Size large_image_size(512, 512); 56 const Size large_image_size(512, 512);
57 const uint8_t image_color[] = {0, 0xff, 0, 0xff}; 57 const uint8_t image_color[] = {0, 0xff, 0, 0xff};
58 58
59 // Create a small solid color green image of preferred format. This must 59 // Create a small solid color green image of preferred format. This must
60 // succeed in order for a GLImage to be conformant. 60 // succeed in order for a GLImage to be conformant.
61 scoped_refptr<GLImage> small_image = 61 scoped_refptr<gl::GLImage> small_image =
reveman 2015/10/29 19:46:42 All these tests classes will be moved to gl namesp
tfarina 2015/10/29 20:52:05 Correct.
62 this->delegate_.CreateSolidColorImage(small_image_size, image_color); 62 this->delegate_.CreateSolidColorImage(small_image_size, image_color);
63 ASSERT_TRUE(small_image); 63 ASSERT_TRUE(small_image);
64 64
65 // Create a large solid color green image of preferred format. This must 65 // Create a large solid color green image of preferred format. This must
66 // succeed in order for a GLImage to be conformant. 66 // succeed in order for a GLImage to be conformant.
67 scoped_refptr<GLImage> large_image = 67 scoped_refptr<gl::GLImage> large_image =
68 this->delegate_.CreateSolidColorImage(large_image_size, image_color); 68 this->delegate_.CreateSolidColorImage(large_image_size, image_color);
69 ASSERT_TRUE(large_image); 69 ASSERT_TRUE(large_image);
70 70
71 // Verify that image size is correct. 71 // Verify that image size is correct.
72 EXPECT_EQ(small_image->GetSize().ToString(), small_image_size.ToString()); 72 EXPECT_EQ(small_image->GetSize().ToString(), small_image_size.ToString());
73 EXPECT_EQ(large_image->GetSize().ToString(), large_image_size.ToString()); 73 EXPECT_EQ(large_image->GetSize().ToString(), large_image_size.ToString());
74 74
75 // Verify that destruction of images work correctly both when we have a 75 // Verify that destruction of images work correctly both when we have a
76 // context and when we don't. 76 // context and when we don't.
77 small_image->Destroy(true /* have_context */); 77 small_image->Destroy(true /* have_context */);
(...skipping 15 matching lines...) Expand all
93 const uint8_t texture_color[] = {0, 0, 0xff, 0xff}; 93 const uint8_t texture_color[] = {0, 0, 0xff, 0xff};
94 94
95 GLuint framebuffer = 95 GLuint framebuffer =
96 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height()); 96 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height());
97 ASSERT_TRUE(framebuffer); 97 ASSERT_TRUE(framebuffer);
98 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer); 98 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer);
99 glViewport(0, 0, image_size.width(), image_size.height()); 99 glViewport(0, 0, image_size.width(), image_size.height());
100 100
101 // Create a solid color green image of preferred format. This must succeed 101 // Create a solid color green image of preferred format. This must succeed
102 // in order for a GLImage to be conformant. 102 // in order for a GLImage to be conformant.
103 scoped_refptr<GLImage> image = 103 scoped_refptr<gl::GLImage> image =
104 this->delegate_.CreateSolidColorImage(image_size, image_color); 104 this->delegate_.CreateSolidColorImage(image_size, image_color);
105 ASSERT_TRUE(image); 105 ASSERT_TRUE(image);
106 106
107 // Create a solid color blue texture of the same size as |image|. 107 // Create a solid color blue texture of the same size as |image|.
108 GLuint texture = GLTestHelper::CreateTexture(GL_TEXTURE_2D); 108 GLuint texture = GLTestHelper::CreateTexture(GL_TEXTURE_2D);
109 scoped_ptr<uint8_t[]> pixels(new uint8_t[BufferSizeForBufferFormat( 109 scoped_ptr<uint8_t[]> pixels(new uint8_t[BufferSizeForBufferFormat(
110 image_size, BufferFormat::RGBA_8888)]); 110 image_size, BufferFormat::RGBA_8888)]);
111 GLImageTestSupport::SetBufferDataToColor( 111 GLImageTestSupport::SetBufferDataToColor(
112 image_size.width(), image_size.height(), 112 image_size.width(), image_size.height(),
113 static_cast<int>(RowSizeForBufferFormat(image_size.width(), 113 static_cast<int>(RowSizeForBufferFormat(image_size.width(),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 image->Destroy(true); 201 image->Destroy(true);
202 } 202 }
203 203
204 // The GLImageCopyTest test case verifies that the GLImage implementation 204 // The GLImageCopyTest test case verifies that the GLImage implementation
205 // handles CopyTexImage correctly. 205 // handles CopyTexImage correctly.
206 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); 206 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage);
207 207
208 } // namespace gfx 208 } // namespace gfx
209 209
210 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 210 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/demo/surfaceless_gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698