OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 4559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4570 | 4570 |
4571 scoped_ptr<LayerImpl> root_layer = | 4571 scoped_ptr<LayerImpl> root_layer = |
4572 LayerImpl::Create(host_impl_->active_tree(), 1); | 4572 LayerImpl::Create(host_impl_->active_tree(), 1); |
4573 root_layer->SetBounds(gfx::Size(10, 10)); | 4573 root_layer->SetBounds(gfx::Size(10, 10)); |
4574 | 4574 |
4575 scoped_refptr<VideoFrame> softwareFrame = | 4575 scoped_refptr<VideoFrame> softwareFrame = |
4576 media::VideoFrame::CreateColorFrame( | 4576 media::VideoFrame::CreateColorFrame( |
4577 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 4577 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
4578 FakeVideoFrameProvider provider; | 4578 FakeVideoFrameProvider provider; |
4579 provider.set_frame(softwareFrame); | 4579 provider.set_frame(softwareFrame); |
4580 scoped_ptr<VideoLayerImpl> video_layer = | 4580 scoped_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( |
4581 VideoLayerImpl::Create(host_impl_->active_tree(), 4, &provider); | 4581 host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0); |
4582 video_layer->SetBounds(gfx::Size(10, 10)); | 4582 video_layer->SetBounds(gfx::Size(10, 10)); |
4583 video_layer->SetContentBounds(gfx::Size(10, 10)); | 4583 video_layer->SetContentBounds(gfx::Size(10, 10)); |
4584 video_layer->SetDrawsContent(true); | 4584 video_layer->SetDrawsContent(true); |
4585 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); | 4585 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); |
4586 | 4586 |
4587 scoped_ptr<IOSurfaceLayerImpl> io_surface_layer = | 4587 scoped_ptr<IOSurfaceLayerImpl> io_surface_layer = |
4588 IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); | 4588 IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); |
4589 io_surface_layer->SetBounds(gfx::Size(10, 10)); | 4589 io_surface_layer->SetBounds(gfx::Size(10, 10)); |
4590 io_surface_layer->SetContentBounds(gfx::Size(10, 10)); | 4590 io_surface_layer->SetContentBounds(gfx::Size(10, 10)); |
4591 io_surface_layer->SetDrawsContent(true); | 4591 io_surface_layer->SetDrawsContent(true); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5611 external_viewport, | 5611 external_viewport, |
5612 external_clip, | 5612 external_clip, |
5613 resourceless_software_draw); | 5613 resourceless_software_draw); |
5614 | 5614 |
5615 // SolidColorLayerImpl will be drawn. | 5615 // SolidColorLayerImpl will be drawn. |
5616 scoped_ptr<SolidColorLayerImpl> root_layer = | 5616 scoped_ptr<SolidColorLayerImpl> root_layer = |
5617 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 5617 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
5618 | 5618 |
5619 // VideoLayerImpl will not be drawn. | 5619 // VideoLayerImpl will not be drawn. |
5620 FakeVideoFrameProvider provider; | 5620 FakeVideoFrameProvider provider; |
5621 scoped_ptr<VideoLayerImpl> video_layer = | 5621 scoped_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( |
5622 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); | 5622 host_impl_->active_tree(), 2, &provider, media::VIDEO_ROTATION_0); |
5623 video_layer->SetBounds(gfx::Size(10, 10)); | 5623 video_layer->SetBounds(gfx::Size(10, 10)); |
5624 video_layer->SetContentBounds(gfx::Size(10, 10)); | 5624 video_layer->SetContentBounds(gfx::Size(10, 10)); |
5625 video_layer->SetDrawsContent(true); | 5625 video_layer->SetDrawsContent(true); |
5626 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); | 5626 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); |
5627 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); | 5627 SetupRootLayerImpl(root_layer.PassAs<LayerImpl>()); |
5628 | 5628 |
5629 LayerTreeHostImpl::FrameData frame; | 5629 LayerTreeHostImpl::FrameData frame; |
5630 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5630 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
5631 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 5631 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
5632 host_impl_->DidDrawAllLayers(frame); | 5632 host_impl_->DidDrawAllLayers(frame); |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6706 | 6706 |
6707 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(250)); | 6707 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(250)); |
6708 host_impl_->UpdateAnimationState(true); | 6708 host_impl_->UpdateAnimationState(true); |
6709 | 6709 |
6710 EXPECT_EQ(gfx::Vector2dF(0, 100), scrolling_layer->TotalScrollOffset()); | 6710 EXPECT_EQ(gfx::Vector2dF(0, 100), scrolling_layer->TotalScrollOffset()); |
6711 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 6711 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
6712 } | 6712 } |
6713 | 6713 |
6714 } // namespace | 6714 } // namespace |
6715 } // namespace cc | 6715 } // namespace cc |
OLD | NEW |