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

Unified Diff: ui/gl/test/gl_image_test_support.cc

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.h ('k') | ui/gl/test/gl_image_test_template.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/test/gl_image_test_support.cc
diff --git a/ui/gl/test/gl_image_test_support.cc b/ui/gl/test/gl_image_test_support.cc
index c6f5bf3db2a3a00e13769ffc1da5a76a3514a319..587d13952388c8c89f6b4cfd869d89dd012d348f 100644
--- a/ui/gl/test/gl_image_test_support.cc
+++ b/ui/gl/test/gl_image_test_support.cc
@@ -6,10 +6,7 @@
#include <vector>
-#include "third_party/skia/include/core/SkTypes.h"
-#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_version_info.h"
#include "ui/gl/test/gl_surface_test_support.h"
#if defined(USE_OZONE)
@@ -39,22 +36,6 @@ void GLImageTestSupport::CleanupGL() {
}
// static
-GLenum GLImageTestSupport::GetPreferredInternalFormat() {
- bool has_texture_format_bgra8888 =
- GLContext::GetCurrent()->HasExtension(
- "GL_APPLE_texture_format_BGRA8888") ||
- GLContext::GetCurrent()->HasExtension("GL_EXT_texture_format_BGRA8888") ||
- !GLContext::GetCurrent()->GetVersionInfo()->is_es;
- return (!SK_B32_SHIFT && has_texture_format_bgra8888) ? GL_BGRA_EXT : GL_RGBA;
-}
-
-// static
-BufferFormat GLImageTestSupport::GetPreferredBufferFormat() {
- return GetPreferredInternalFormat() == GL_BGRA_EXT ? BufferFormat::BGRA_8888
- : BufferFormat::RGBA_8888;
-}
-
-// static
void GLImageTestSupport::SetBufferDataToColor(int width,
int height,
int stride,
@@ -62,6 +43,16 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
const uint8_t color[4],
uint8_t* data) {
switch (format) {
+ case BufferFormat::RGBX_8888:
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ data[y * stride + x * 4 + 0] = color[0];
+ data[y * stride + x * 4 + 1] = color[1];
+ data[y * stride + x * 4 + 2] = color[2];
+ data[y * stride + x * 4 + 3] = 0xaa; // unused
+ }
+ }
+ return;
case BufferFormat::RGBA_8888:
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
@@ -72,6 +63,16 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
}
return;
+ case BufferFormat::BGRX_8888:
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ data[y * stride + x * 4 + 0] = color[2];
+ data[y * stride + x * 4 + 1] = color[1];
+ data[y * stride + x * 4 + 2] = color[0];
+ data[y * stride + x * 4 + 3] = 0xaa; // unused
+ }
+ }
+ return;
case BufferFormat::BGRA_8888:
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
@@ -89,7 +90,6 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
case BufferFormat::ETC1:
case BufferFormat::R_8:
case BufferFormat::RGBA_4444:
- case BufferFormat::BGRX_8888:
case BufferFormat::UYVY_422:
case BufferFormat::YUV_420_BIPLANAR:
case BufferFormat::YUV_420:
« no previous file with comments | « ui/gl/test/gl_image_test_support.h ('k') | ui/gl/test/gl_image_test_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698