| 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 cb996b47e263afd9ed8e68f432954a526b908ca7..460f48a5673bcaf0f456c78bc0ba3962d4ade228 100644
|
| --- a/ui/gl/test/gl_image_test_support.cc
|
| +++ b/ui/gl/test/gl_image_test_support.cc
|
| @@ -104,6 +104,32 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
|
| }
|
| }
|
| return;
|
| + case gfx::BufferFormat::YVU_420: {
|
| + DCHECK_LT(plane, 3);
|
| + 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 yvu[] = {
|
| + (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16,
|
| + (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128,
|
| + -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128};
|
| + if (plane == 0) {
|
| + for (int y = 0; y < height; ++y) {
|
| + for (int x = 0; x < width; ++x) {
|
| + data[stride * y + x] = yvu[0];
|
| + }
|
| + }
|
| + } else {
|
| + for (int y = 0; y < height / 2; ++y) {
|
| + for (int x = 0; x < width / 2; ++x) {
|
| + data[stride * y + x] = yvu[plane];
|
| + }
|
| + }
|
| + }
|
| + return;
|
| + }
|
| case gfx::BufferFormat::YUV_420_BIPLANAR: {
|
| DCHECK_LT(plane, 2);
|
| DCHECK_EQ(0, height % 2);
|
| @@ -138,7 +164,6 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
|
| case gfx::BufferFormat::ETC1:
|
| case gfx::BufferFormat::RGBA_4444:
|
| case gfx::BufferFormat::UYVY_422:
|
| - case gfx::BufferFormat::YVU_420:
|
| NOTREACHED();
|
| return;
|
| }
|
|
|