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

Unified Diff: ui/gl/test/gl_image_test_template.h

Issue 1415723006: ui: Add RGBX_8888 buffer format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gles but no conversion needed case Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/test/gl_image_test_support.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/test/gl_image_test_template.h
diff --git a/ui/gl/test/gl_image_test_template.h b/ui/gl/test/gl_image_test_template.h
index e7b685d5700cd5338f4895540e98e6b4c4a2d97a..9bee385a9f87db5de8211d5562b3993701420e6a 100644
--- a/ui/gl/test/gl_image_test_template.h
+++ b/ui/gl/test/gl_image_test_template.h
@@ -58,28 +58,20 @@ TYPED_TEST_P(GLImageTest, CreateAndDestroy) {
// Create a small solid color green image of preferred format. This must
// succeed in order for a GLImage to be conformant.
- scoped_refptr<GLImage> small_image = this->delegate_.CreateSolidColorImage(
- small_image_size, GLImageTestSupport::GetPreferredInternalFormat(),
- GLImageTestSupport::GetPreferredBufferFormat(), image_color);
+ scoped_refptr<GLImage> small_image =
+ this->delegate_.CreateSolidColorImage(small_image_size, image_color);
ASSERT_TRUE(small_image);
// Create a large solid color green image of preferred format. This must
// succeed in order for a GLImage to be conformant.
- scoped_refptr<GLImage> large_image = this->delegate_.CreateSolidColorImage(
- large_image_size, GLImageTestSupport::GetPreferredInternalFormat(),
- GLImageTestSupport::GetPreferredBufferFormat(), image_color);
+ scoped_refptr<GLImage> large_image =
+ this->delegate_.CreateSolidColorImage(large_image_size, image_color);
ASSERT_TRUE(large_image);
// Verify that image size is correct.
EXPECT_EQ(small_image->GetSize().ToString(), small_image_size.ToString());
EXPECT_EQ(large_image->GetSize().ToString(), large_image_size.ToString());
- // Verify that internal format is correct.
- EXPECT_EQ(small_image->GetInternalFormat(),
- GLImageTestSupport::GetPreferredInternalFormat());
- EXPECT_EQ(large_image->GetInternalFormat(),
- GLImageTestSupport::GetPreferredInternalFormat());
-
// Verify that destruction of images work correctly both when we have a
// context and when we don't.
small_image->Destroy(true /* have_context */);
@@ -97,7 +89,7 @@ TYPED_TEST_CASE_P(GLImageCopyTest);
TYPED_TEST_P(GLImageCopyTest, CopyTexImage) {
const Size image_size(256, 256);
- const uint8_t image_color[] = {0, 0xff, 0, 0xff};
+ const uint8_t image_color[] = {0xff, 0xff, 0, 0xff};
const uint8_t texture_color[] = {0, 0, 0xff, 0xff};
GLuint framebuffer =
@@ -108,30 +100,24 @@ TYPED_TEST_P(GLImageCopyTest, CopyTexImage) {
// Create a solid color green image of preferred format. This must succeed
// in order for a GLImage to be conformant.
- scoped_refptr<GLImage> image = this->delegate_.CreateSolidColorImage(
- image_size, GLImageTestSupport::GetPreferredInternalFormat(),
- GLImageTestSupport::GetPreferredBufferFormat(), image_color);
+ scoped_refptr<GLImage> image =
+ this->delegate_.CreateSolidColorImage(image_size, image_color);
ASSERT_TRUE(image);
// Create a solid color blue texture of the same size as |image|.
GLuint texture = GLTestHelper::CreateTexture(GL_TEXTURE_2D);
scoped_ptr<uint8_t[]> pixels(new uint8_t[BufferSizeForBufferFormat(
- image_size, GLImageTestSupport::GetPreferredBufferFormat())]);
+ image_size, BufferFormat::RGBA_8888)]);
GLImageTestSupport::SetBufferDataToColor(
image_size.width(), image_size.height(),
- static_cast<int>(RowSizeForBufferFormat(
- image_size.width(), GLImageTestSupport::GetPreferredBufferFormat(),
- 0)),
- GLImageTestSupport::GetPreferredBufferFormat(), texture_color,
- pixels.get());
+ static_cast<int>(RowSizeForBufferFormat(image_size.width(),
+ BufferFormat::RGBA_8888, 0)),
+ BufferFormat::RGBA_8888, texture_color, pixels.get());
// Note: This test assume that |image| can be used with GL_TEXTURE_2D but
// that might not be the case for some GLImage implementations.
glBindTexture(GL_TEXTURE_2D, texture);
- glTexImage2D(GL_TEXTURE_2D, 0,
- GLImageTestSupport::GetPreferredInternalFormat(),
- image_size.width(), image_size.height(), 0,
- GLImageTestSupport::GetPreferredInternalFormat(),
- GL_UNSIGNED_BYTE, pixels.get());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_size.width(),
+ image_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
// Copy |image| to |texture|.
bool rv = image->CopyTexImage(GL_TEXTURE_2D);
« no previous file with comments | « ui/gl/test/gl_image_test_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698