| 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 "cc/layers/video_frame_provider_client_impl.h" | 7 #include "cc/layers/video_frame_provider_client_impl.h" |
| 8 #include "cc/output/context_provider.h" | 8 #include "cc/output/context_provider.h" |
| 9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
| 10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); | 334 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); |
| 335 | 335 |
| 336 gpu::MailboxHolder mailbox_holder; | 336 gpu::MailboxHolder mailbox_holder; |
| 337 mailbox_holder.mailbox.name[0] = 1; | 337 mailbox_holder.mailbox.name[0] = 1; |
| 338 | 338 |
| 339 scoped_refptr<media::VideoFrame> video_frame = | 339 scoped_refptr<media::VideoFrame> video_frame = |
| 340 media::VideoFrame::WrapYUV420NativeTextures( | 340 media::VideoFrame::WrapYUV420NativeTextures( |
| 341 mailbox_holder, mailbox_holder, mailbox_holder, | 341 mailbox_holder, mailbox_holder, mailbox_holder, |
| 342 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10), | 342 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10), |
| 343 gfx::Size(10, 10), base::TimeDelta()); | 343 gfx::Size(10, 10), base::TimeDelta()); |
| 344 CHECK(video_frame); |
| 344 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, | 345 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, |
| 345 true); | 346 true); |
| 346 FakeVideoFrameProvider provider; | 347 FakeVideoFrameProvider provider; |
| 347 provider.set_frame(video_frame); | 348 provider.set_frame(video_frame); |
| 348 | 349 |
| 349 VideoLayerImpl* video_layer_impl = | 350 VideoLayerImpl* video_layer_impl = |
| 350 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); | 351 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); |
| 351 video_layer_impl->SetBounds(layer_size); | 352 video_layer_impl->SetBounds(layer_size); |
| 352 video_layer_impl->SetDrawsContent(true); | 353 video_layer_impl->SetDrawsContent(true); |
| 353 | 354 |
| 354 gfx::Rect occluded; | 355 gfx::Rect occluded; |
| 355 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 356 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
| 356 | 357 |
| 357 EXPECT_EQ(1u, impl.quad_list().size()); | 358 EXPECT_EQ(1u, impl.quad_list().size()); |
| 358 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); | 359 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); |
| 359 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); | 360 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); |
| 360 | 361 |
| 361 const YUVVideoDrawQuad* yuv_draw_quad = | 362 const YUVVideoDrawQuad* yuv_draw_quad = |
| 362 static_cast<const YUVVideoDrawQuad*>(draw_quad); | 363 static_cast<const YUVVideoDrawQuad*>(draw_quad); |
| 363 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), | 364 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), |
| 364 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); | 365 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); |
| 365 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), | 366 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), |
| 366 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 367 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); |
| 367 } | 368 } |
| 368 | 369 |
| 369 } // namespace | 370 } // namespace |
| 370 } // namespace cc | 371 } // namespace cc |
| OLD | NEW |