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

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

Issue 1419733005: gpu: Add YCbCr 420v extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually enable/disable capabilities. Typo. Created 5 years 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 7c964d3f2165f553439b0a52520c044e1c695f52..79996d5edf11fc86a70cb6675bcef1de2bd4e3b4 100644
--- a/ui/gl/test/gl_image_test_support.cc
+++ b/ui/gl/test/gl_image_test_support.cc
@@ -39,11 +39,13 @@ void GLImageTestSupport::CleanupGL() {
void GLImageTestSupport::SetBufferDataToColor(int width,
int height,
int stride,
+ int plane,
gfx::BufferFormat format,
const uint8_t color[4],
uint8_t* data) {
switch (format) {
case gfx::BufferFormat::RGBX_8888:
+ DCHECK_EQ(0, plane);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
data[y * stride + x * 4 + 0] = color[0];
@@ -54,6 +56,7 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
return;
case gfx::BufferFormat::RGBA_8888:
+ DCHECK_EQ(0, plane);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
data[y * stride + x * 4 + 0] = color[0];
@@ -64,6 +67,7 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
return;
case gfx::BufferFormat::BGRX_8888:
+ DCHECK_EQ(0, plane);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
data[y * stride + x * 4 + 0] = color[2];
@@ -74,6 +78,7 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
return;
case gfx::BufferFormat::BGRA_8888:
+ DCHECK_EQ(0, plane);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
data[y * stride + x * 4 + 0] = color[2];
@@ -83,6 +88,33 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
}
return;
+ case gfx::BufferFormat::YUV_420_BIPLANAR: {
+ DCHECK_LT(plane, 2);
+ DCHECK_EQ(0, height % 2);
+ DCHECK_EQ(0, width % 2);
+ // These values are used in the transformation from YUV to RGB color
+ // values. They are taken from the following webpage:
+ // http://www.fourcc.org/fccyvrgb.php
+ uint8_t yuv[] = {
+ (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16,
+ -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128,
+ (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128};
+ if (plane == 0) {
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ data[stride * y + x] = yuv[0];
+ }
+ }
+ } else {
+ for (int y = 0; y < height / 2; ++y) {
+ for (int x = 0; x < width / 2; ++x) {
+ data[stride * y + x * 2] = yuv[1];
+ data[stride * y + x * 2 + 1] = yuv[2];
+ }
+ }
+ }
+ return;
+ }
case gfx::BufferFormat::ATC:
case gfx::BufferFormat::ATCIA:
case gfx::BufferFormat::DXT1:
@@ -91,7 +123,6 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
case gfx::BufferFormat::R_8:
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::UYVY_422:
- case gfx::BufferFormat::YUV_420_BIPLANAR:
case gfx::BufferFormat::YUV_420:
NOTREACHED();
return;
« 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