| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/video_layer_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/layers/video_frame_provider_client_impl.h" | 9 #include "cc/layers/video_frame_provider_client_impl.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); | 336 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); |
| 337 | 337 |
| 338 gpu::MailboxHolder mailbox_holder; | 338 gpu::MailboxHolder mailbox_holder; |
| 339 mailbox_holder.mailbox.name[0] = 1; | 339 mailbox_holder.mailbox.name[0] = 1; |
| 340 | 340 |
| 341 scoped_refptr<media::VideoFrame> video_frame = | 341 scoped_refptr<media::VideoFrame> video_frame = |
| 342 media::VideoFrame::WrapYUV420NativeTextures( | 342 media::VideoFrame::WrapYUV420NativeTextures( |
| 343 mailbox_holder, mailbox_holder, mailbox_holder, | 343 mailbox_holder, mailbox_holder, mailbox_holder, |
| 344 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10), | 344 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10), |
| 345 gfx::Size(10, 10), base::TimeDelta()); | 345 gfx::Size(10, 10), base::TimeDelta()); |
| 346 ASSERT_TRUE(video_frame); |
| 346 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, | 347 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, |
| 347 true); | 348 true); |
| 348 FakeVideoFrameProvider provider; | 349 FakeVideoFrameProvider provider; |
| 349 provider.set_frame(video_frame); | 350 provider.set_frame(video_frame); |
| 350 | 351 |
| 351 VideoLayerImpl* video_layer_impl = | 352 VideoLayerImpl* video_layer_impl = |
| 352 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); | 353 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); |
| 353 video_layer_impl->SetBounds(layer_size); | 354 video_layer_impl->SetBounds(layer_size); |
| 354 video_layer_impl->SetDrawsContent(true); | 355 video_layer_impl->SetDrawsContent(true); |
| 355 | 356 |
| 356 gfx::Rect occluded; | 357 gfx::Rect occluded; |
| 357 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 358 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
| 358 | 359 |
| 359 EXPECT_EQ(1u, impl.quad_list().size()); | 360 EXPECT_EQ(1u, impl.quad_list().size()); |
| 360 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); | 361 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); |
| 361 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); | 362 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); |
| 362 | 363 |
| 363 const YUVVideoDrawQuad* yuv_draw_quad = | 364 const YUVVideoDrawQuad* yuv_draw_quad = |
| 364 static_cast<const YUVVideoDrawQuad*>(draw_quad); | 365 static_cast<const YUVVideoDrawQuad*>(draw_quad); |
| 365 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), | 366 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), |
| 366 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); | 367 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); |
| 367 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), | 368 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), |
| 368 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 369 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace | 372 } // namespace |
| 372 } // namespace cc | 373 } // namespace cc |
| OLD | NEW |