| 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 587d13952388c8c89f6b4cfd869d89dd012d348f..4b8f5eb5f5de685e502210ba1695dd563a2db8c1 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,
|
| BufferFormat format,
|
| const uint8_t color[4],
|
| uint8_t* data) {
|
| switch (format) {
|
| case 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 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 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 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 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 BufferFormat::ATC:
|
| case BufferFormat::ATCIA:
|
| case BufferFormat::DXT1:
|
| @@ -91,7 +123,6 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
|
| case BufferFormat::R_8:
|
| case BufferFormat::RGBA_4444:
|
| case BufferFormat::UYVY_422:
|
| - case BufferFormat::YUV_420_BIPLANAR:
|
| case BufferFormat::YUV_420:
|
| NOTREACHED();
|
| return;
|
|
|