| 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 5576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5587 | 5587 |
| 5588 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 5588 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 5589 | 5589 |
| 5590 const gfx::Transform external_transform; | 5590 const gfx::Transform external_transform; |
| 5591 const gfx::Rect external_viewport; | 5591 const gfx::Rect external_viewport; |
| 5592 const gfx::Rect external_clip; | 5592 const gfx::Rect external_clip; |
| 5593 const bool resourceless_software_draw = true; | 5593 const bool resourceless_software_draw = true; |
| 5594 host_impl_->SetExternalDrawConstraints(external_transform, | 5594 host_impl_->SetExternalDrawConstraints(external_transform, |
| 5595 external_viewport, | 5595 external_viewport, |
| 5596 external_clip, | 5596 external_clip, |
| 5597 external_viewport, |
| 5598 external_transform, |
| 5597 resourceless_software_draw); | 5599 resourceless_software_draw); |
| 5598 | 5600 |
| 5599 EXPECT_EQ(0, software_device->frames_began_); | 5601 EXPECT_EQ(0, software_device->frames_began_); |
| 5600 EXPECT_EQ(0, software_device->frames_ended_); | 5602 EXPECT_EQ(0, software_device->frames_ended_); |
| 5601 | 5603 |
| 5602 DrawFrame(); | 5604 DrawFrame(); |
| 5603 | 5605 |
| 5604 EXPECT_EQ(1, software_device->frames_began_); | 5606 EXPECT_EQ(1, software_device->frames_began_); |
| 5605 EXPECT_EQ(1, software_device->frames_ended_); | 5607 EXPECT_EQ(1, software_device->frames_ended_); |
| 5606 | 5608 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5620 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), | 5622 EXPECT_TRUE(CreateHostImpl(DefaultSettings(), |
| 5621 scoped_ptr<OutputSurface>(output_surface))); | 5623 scoped_ptr<OutputSurface>(output_surface))); |
| 5622 | 5624 |
| 5623 const gfx::Transform external_transform; | 5625 const gfx::Transform external_transform; |
| 5624 const gfx::Rect external_viewport; | 5626 const gfx::Rect external_viewport; |
| 5625 const gfx::Rect external_clip; | 5627 const gfx::Rect external_clip; |
| 5626 const bool resourceless_software_draw = true; | 5628 const bool resourceless_software_draw = true; |
| 5627 host_impl_->SetExternalDrawConstraints(external_transform, | 5629 host_impl_->SetExternalDrawConstraints(external_transform, |
| 5628 external_viewport, | 5630 external_viewport, |
| 5629 external_clip, | 5631 external_clip, |
| 5632 external_viewport, |
| 5633 external_transform, |
| 5630 resourceless_software_draw); | 5634 resourceless_software_draw); |
| 5631 | 5635 |
| 5632 // SolidColorLayerImpl will be drawn. | 5636 // SolidColorLayerImpl will be drawn. |
| 5633 scoped_ptr<SolidColorLayerImpl> root_layer = | 5637 scoped_ptr<SolidColorLayerImpl> root_layer = |
| 5634 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 5638 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
| 5635 | 5639 |
| 5636 // VideoLayerImpl will not be drawn. | 5640 // VideoLayerImpl will not be drawn. |
| 5637 FakeVideoFrameProvider provider; | 5641 FakeVideoFrameProvider provider; |
| 5638 scoped_ptr<VideoLayerImpl> video_layer = | 5642 scoped_ptr<VideoLayerImpl> video_layer = |
| 5639 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); | 5643 VideoLayerImpl::Create(host_impl_->active_tree(), 2, &provider); |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6714 const gfx::Size layer_size(100, 100); | 6718 const gfx::Size layer_size(100, 100); |
| 6715 gfx::Transform external_transform; | 6719 gfx::Transform external_transform; |
| 6716 const gfx::Rect external_viewport(layer_size); | 6720 const gfx::Rect external_viewport(layer_size); |
| 6717 const gfx::Rect external_clip(layer_size); | 6721 const gfx::Rect external_clip(layer_size); |
| 6718 const bool resourceless_software_draw = false; | 6722 const bool resourceless_software_draw = false; |
| 6719 LayerImpl* layer = SetupScrollAndContentsLayers(layer_size); | 6723 LayerImpl* layer = SetupScrollAndContentsLayers(layer_size); |
| 6720 | 6724 |
| 6721 host_impl_->SetExternalDrawConstraints(external_transform, | 6725 host_impl_->SetExternalDrawConstraints(external_transform, |
| 6722 external_viewport, | 6726 external_viewport, |
| 6723 external_clip, | 6727 external_clip, |
| 6728 external_viewport, |
| 6729 external_transform, |
| 6724 resourceless_software_draw); | 6730 resourceless_software_draw); |
| 6725 DrawFrame(); | 6731 DrawFrame(); |
| 6726 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6732 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 6727 external_transform, layer->draw_properties().target_space_transform); | 6733 external_transform, layer->draw_properties().target_space_transform); |
| 6728 | 6734 |
| 6729 external_transform.Translate(20, 20); | 6735 external_transform.Translate(20, 20); |
| 6730 host_impl_->SetExternalDrawConstraints(external_transform, | 6736 host_impl_->SetExternalDrawConstraints(external_transform, |
| 6731 external_viewport, | 6737 external_viewport, |
| 6732 external_clip, | 6738 external_clip, |
| 6739 external_viewport, |
| 6740 external_transform, |
| 6733 resourceless_software_draw); | 6741 resourceless_software_draw); |
| 6734 DrawFrame(); | 6742 DrawFrame(); |
| 6735 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6743 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 6736 external_transform, layer->draw_properties().target_space_transform); | 6744 external_transform, layer->draw_properties().target_space_transform); |
| 6737 } | 6745 } |
| 6738 | 6746 |
| 6739 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { | 6747 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
| 6740 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 6748 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 6741 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 6749 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
| 6742 DrawFrame(); | 6750 DrawFrame(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6762 | 6770 |
| 6763 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); | 6771 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
| 6764 host_impl_->UpdateAnimationState(true); | 6772 host_impl_->UpdateAnimationState(true); |
| 6765 | 6773 |
| 6766 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); | 6774 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
| 6767 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 6775 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 6768 } | 6776 } |
| 6769 | 6777 |
| 6770 } // namespace | 6778 } // namespace |
| 6771 } // namespace cc | 6779 } // namespace cc |
| OLD | NEW |