| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 342   mailbox_holders[2].mailbox.name[0] = 1; | 342   mailbox_holders[2].mailbox.name[0] = 1; | 
| 343 | 343 | 
| 344   scoped_refptr<media::VideoFrame> video_frame = | 344   scoped_refptr<media::VideoFrame> video_frame = | 
| 345       media::VideoFrame::WrapNativeTextures( | 345       media::VideoFrame::WrapNativeTextures( | 
| 346           media::PIXEL_FORMAT_I420, mailbox_holders, base::Bind(EmptyCallback), | 346           media::PIXEL_FORMAT_I420, mailbox_holders, base::Bind(EmptyCallback), | 
| 347           gfx::Size(10, 10), gfx::Rect(10, 10), gfx::Size(10, 10), | 347           gfx::Size(10, 10), gfx::Rect(10, 10), gfx::Size(10, 10), | 
| 348           base::TimeDelta()); | 348           base::TimeDelta()); | 
| 349   ASSERT_TRUE(video_frame); | 349   ASSERT_TRUE(video_frame); | 
| 350   video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, | 350   video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, | 
| 351                                       true); | 351                                       true); | 
|  | 352   video_frame->metadata()->SetBoolean( | 
|  | 353       media::VideoFrameMetadata::REQUIRE_OVERLAY, true); | 
| 352   FakeVideoFrameProvider provider; | 354   FakeVideoFrameProvider provider; | 
| 353   provider.set_frame(video_frame); | 355   provider.set_frame(video_frame); | 
| 354 | 356 | 
| 355   VideoLayerImpl* video_layer_impl = | 357   VideoLayerImpl* video_layer_impl = | 
| 356       impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); | 358       impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); | 
| 357   video_layer_impl->SetBounds(layer_size); | 359   video_layer_impl->SetBounds(layer_size); | 
| 358   video_layer_impl->SetDrawsContent(true); | 360   video_layer_impl->SetDrawsContent(true); | 
| 359   impl.host_impl()->active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 361   impl.host_impl()->active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 
| 360 | 362 | 
| 361   gfx::Rect occluded; | 363   gfx::Rect occluded; | 
| 362   impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 364   impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 
| 363 | 365 | 
| 364   EXPECT_EQ(1u, impl.quad_list().size()); | 366   EXPECT_EQ(1u, impl.quad_list().size()); | 
| 365   const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); | 367   const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); | 
| 366   ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); | 368   ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); | 
| 367 | 369 | 
| 368   const YUVVideoDrawQuad* yuv_draw_quad = | 370   const YUVVideoDrawQuad* yuv_draw_quad = | 
| 369       static_cast<const YUVVideoDrawQuad*>(draw_quad); | 371       static_cast<const YUVVideoDrawQuad*>(draw_quad); | 
| 370   EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), | 372   EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), | 
| 371             (yuv_draw_quad->ya_tex_size.height() + 1) / 2); | 373             (yuv_draw_quad->ya_tex_size.height() + 1) / 2); | 
| 372   EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), | 374   EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), | 
| 373             (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 375             (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 
|  | 376   EXPECT_TRUE(yuv_draw_quad->require_overlay); | 
| 374 } | 377 } | 
| 375 | 378 | 
| 376 }  // namespace | 379 }  // namespace | 
| 377 }  // namespace cc | 380 }  // namespace cc | 
| OLD | NEW | 
|---|