| Index: cc/output/renderer_pixeltest.cc
|
| diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
|
| index 2bf5152d2139073110e480ba164ec9f9483062e1..0f0e7cd7064fcbafd5c475aa7f9f42d1cc3bd5da 100644
|
| --- a/cc/output/renderer_pixeltest.cc
|
| +++ b/cc/output/renderer_pixeltest.cc
|
| @@ -405,7 +405,13 @@ TEST_F(GLRendererPixelTest, NonPremultipliedTextureWithBackground) {
|
| class VideoGLRendererPixelTest : public GLRendererPixelTest {
|
| protected:
|
| scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad(
|
| - SharedQuadState* shared_state, bool with_alpha, bool is_transparent) {
|
| + SharedQuadState* shared_state,
|
| + bool with_alpha,
|
| + bool is_transparent,
|
| + bool has_jpeg_color_range,
|
| + uint8 y,
|
| + uint8 u,
|
| + uint8 v) {
|
| gfx::Rect rect(this->device_viewport_size_);
|
| gfx::Rect opaque_rect(0, 0, 0, 0);
|
|
|
| @@ -447,10 +453,10 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest {
|
| scoped_ptr<uint8_t[]> a_plane;
|
| if (with_alpha)
|
| a_plane.reset(new uint8_t[y_plane_size]);
|
| - // YUV values representing Green.
|
| - memset(y_plane.get(), 149, y_plane_size);
|
| - memset(u_plane.get(), 43, uv_plane_size);
|
| - memset(v_plane.get(), 21, uv_plane_size);
|
| + // YUV values from params.
|
| + memset(y_plane.get(), y, y_plane_size);
|
| + memset(u_plane.get(), u, uv_plane_size);
|
| + memset(v_plane.get(), v, uv_plane_size);
|
| if (with_alpha)
|
| memset(a_plane.get(), is_transparent ? 0 : 128, y_plane_size);
|
|
|
| @@ -466,8 +472,15 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest {
|
| }
|
|
|
| scoped_ptr<YUVVideoDrawQuad> yuv_quad = cc::YUVVideoDrawQuad::Create();
|
| - yuv_quad->SetNew(shared_state, rect, opaque_rect, gfx::Size(),
|
| - y_resource, u_resource, v_resource, a_resource);
|
| + yuv_quad->SetNew(shared_state,
|
| + rect,
|
| + opaque_rect,
|
| + gfx::Size(),
|
| + y_resource,
|
| + u_resource,
|
| + v_resource,
|
| + a_resource,
|
| + has_jpeg_color_range);
|
| return yuv_quad.Pass();
|
| }
|
| };
|
| @@ -481,8 +494,9 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) {
|
| scoped_ptr<SharedQuadState> shared_state =
|
| CreateTestSharedQuadState(gfx::Transform(), rect);
|
|
|
| - scoped_ptr<YUVVideoDrawQuad> yuv_quad =
|
| - CreateTestYUVVideoDrawQuad(shared_state.get(), false, false);
|
| + // YUV of (149,43,21) should be green (0,255,0) in RGB.
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), false, false, false, 149, 43, 21);
|
|
|
| pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
|
|
| @@ -496,6 +510,83 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) {
|
| ExactPixelComparator(true)));
|
| }
|
|
|
| +TEST_F(VideoGLRendererPixelTest, SimpleYUVRectBlack) {
|
| + gfx::Rect rect(this->device_viewport_size_);
|
| +
|
| + RenderPass::Id id(1, 1);
|
| + scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
|
| +
|
| + scoped_ptr<SharedQuadState> shared_state =
|
| + CreateTestSharedQuadState(gfx::Transform(), rect);
|
| +
|
| + // In MPEG color range YUV values of (15,128,128) should produce black.
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), false, false, false, 15, 128, 128);
|
| +
|
| + pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
| +
|
| + RenderPassList pass_list;
|
| + pass_list.push_back(pass.Pass());
|
| +
|
| + // If we didn't get black out of the YUV values above, then we probably have a
|
| + // color range issue.
|
| + EXPECT_TRUE(this->RunPixelTest(
|
| + &pass_list,
|
| + PixelTest::NoOffscreenContext,
|
| + base::FilePath(FILE_PATH_LITERAL("black.png")),
|
| + ExactPixelComparator(true)));
|
| +}
|
| +
|
| +TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) {
|
| + gfx::Rect rect(this->device_viewport_size_);
|
| +
|
| + RenderPass::Id id(1, 1);
|
| + scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
|
| +
|
| + scoped_ptr<SharedQuadState> shared_state =
|
| + CreateTestSharedQuadState(gfx::Transform(), rect);
|
| +
|
| + // YUV of (149,43,21) should be green (0,255,0) in RGB.
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), false, false, true, 149, 43, 21);
|
| +
|
| + pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
| +
|
| + RenderPassList pass_list;
|
| + pass_list.push_back(pass.Pass());
|
| +
|
| + EXPECT_TRUE(this->RunPixelTest(
|
| + &pass_list,
|
| + PixelTest::NoOffscreenContext,
|
| + base::FilePath(FILE_PATH_LITERAL("green.png")),
|
| + ExactPixelComparator(true)));
|
| +}
|
| +
|
| +TEST_F(VideoGLRendererPixelTest, SimpleYUVJRectGrey) {
|
| + gfx::Rect rect(this->device_viewport_size_);
|
| +
|
| + RenderPass::Id id(1, 1);
|
| + scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
|
| +
|
| + scoped_ptr<SharedQuadState> shared_state =
|
| + CreateTestSharedQuadState(gfx::Transform(), rect);
|
| +
|
| + // Dark grey in JPEG color range (in MPEG, this is black).
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), false, false, true, 15, 128, 128);
|
| +
|
| + pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
| +
|
| + RenderPassList pass_list;
|
| + pass_list.push_back(pass.Pass());
|
| +
|
| + EXPECT_TRUE(this->RunPixelTest(
|
| + &pass_list,
|
| + PixelTest::NoOffscreenContext,
|
| + base::FilePath(FILE_PATH_LITERAL("dark_grey.png")),
|
| + ExactPixelComparator(true)));
|
| +}
|
| +
|
| TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) {
|
| gfx::Rect rect(this->device_viewport_size_);
|
|
|
| @@ -505,8 +596,9 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) {
|
| scoped_ptr<SharedQuadState> shared_state =
|
| CreateTestSharedQuadState(gfx::Transform(), rect);
|
|
|
| - scoped_ptr<YUVVideoDrawQuad> yuv_quad =
|
| - CreateTestYUVVideoDrawQuad(shared_state.get(), true, false);
|
| + // YUV of (149,43,21) should be green (0,255,0) in RGB.
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), true, false, false, 149, 43, 21);
|
|
|
| pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
|
|
| @@ -534,8 +626,9 @@ TEST_F(VideoGLRendererPixelTest, FullyTransparentYUVARect) {
|
| scoped_ptr<SharedQuadState> shared_state =
|
| CreateTestSharedQuadState(gfx::Transform(), rect);
|
|
|
| - scoped_ptr<YUVVideoDrawQuad> yuv_quad =
|
| - CreateTestYUVVideoDrawQuad(shared_state.get(), true, true);
|
| + // YUV of (149,43,21) should be green (0,255,0) in RGB.
|
| + scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
|
| + shared_state.get(), true, true, false, 149, 43, 21);
|
|
|
| pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
|
|
|
|
|