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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 9837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9848 test_layer->SetTransform(perspective_transform); | 9848 test_layer->SetTransform(perspective_transform); |
9849 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9849 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
9850 | 9850 |
9851 bool update_lcd_text = false; | 9851 bool update_lcd_text = false; |
9852 | 9852 |
9853 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 9853 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
9854 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); | 9854 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); |
9855 TransformNode* node = | 9855 TransformNode* node = |
9856 host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9856 host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9857 test_layer->transform_tree_index()); | 9857 test_layer->transform_tree_index()); |
9858 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 9858 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); |
9859 | 9859 |
9860 gfx::Transform external_transform; | 9860 gfx::Transform external_transform; |
9861 external_transform.Translate(10, 10); | 9861 external_transform.Translate(10, 10); |
9862 external_transform.Scale(2, 2); | 9862 external_transform.Scale(2, 2); |
9863 gfx::Rect external_viewport; | 9863 gfx::Rect external_viewport; |
9864 gfx::Rect external_clip(layer_size); | 9864 gfx::Rect external_clip(layer_size); |
9865 bool resourceless_software_draw = false; | 9865 bool resourceless_software_draw = false; |
9866 host_impl_->SetExternalTilePriorityConstraints(external_viewport, | 9866 host_impl_->SetExternalTilePriorityConstraints(external_viewport, |
9867 external_transform); | 9867 external_transform); |
9868 | 9868 |
9869 // Transform node's sublayer scale should include the device transform scale. | 9869 // Transform node's sublayer scale should include the device transform scale. |
9870 host_impl_->OnDraw(external_transform, external_viewport, external_clip, | 9870 host_impl_->OnDraw(external_transform, external_viewport, external_clip, |
9871 resourceless_software_draw); | 9871 resourceless_software_draw); |
9872 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9872 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9873 test_layer->transform_tree_index()); | 9873 test_layer->transform_tree_index()); |
9874 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9874 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); |
9875 | 9875 |
9876 // Clear the external transform. | 9876 // Clear the external transform. |
9877 external_transform = gfx::Transform(); | 9877 external_transform = gfx::Transform(); |
9878 host_impl_->SetExternalTilePriorityConstraints(external_viewport, | 9878 host_impl_->SetExternalTilePriorityConstraints(external_viewport, |
9879 external_transform); | 9879 external_transform); |
9880 | 9880 |
9881 host_impl_->OnDraw(external_transform, external_viewport, external_clip, | 9881 host_impl_->OnDraw(external_transform, external_viewport, external_clip, |
9882 resourceless_software_draw); | 9882 resourceless_software_draw); |
9883 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9883 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9884 test_layer->transform_tree_index()); | 9884 test_layer->transform_tree_index()); |
9885 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 9885 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); |
9886 } | 9886 } |
9887 | 9887 |
9888 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { | 9888 TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
9889 const gfx::Size content_size(1000, 1000); | 9889 const gfx::Size content_size(1000, 1000); |
9890 const gfx::Size viewport_size(50, 100); | 9890 const gfx::Size viewport_size(50, 100); |
9891 CreateBasicVirtualViewportLayers(viewport_size, content_size); | 9891 CreateBasicVirtualViewportLayers(viewport_size, content_size); |
9892 | 9892 |
9893 DrawFrame(); | 9893 DrawFrame(); |
9894 | 9894 |
9895 base::TimeTicks start_time = | 9895 base::TimeTicks start_time = |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10934 host_impl_->active_tree()->LayerById(100); | 10934 host_impl_->active_tree()->LayerById(100); |
10935 in_subtree_of_page_scale_layer->test_properties()->force_render_surface = | 10935 in_subtree_of_page_scale_layer->test_properties()->force_render_surface = |
10936 true; | 10936 true; |
10937 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 10937 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
10938 | 10938 |
10939 DrawFrame(); | 10939 DrawFrame(); |
10940 | 10940 |
10941 TransformNode* node = | 10941 TransformNode* node = |
10942 host_impl_->active_tree()->property_trees()->transform_tree.Node( | 10942 host_impl_->active_tree()->property_trees()->transform_tree.Node( |
10943 in_subtree_of_page_scale_layer->transform_tree_index()); | 10943 in_subtree_of_page_scale_layer->transform_tree_index()); |
10944 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 10944 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(1.f, 1.f)); |
10945 | 10945 |
10946 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); | 10946 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); |
10947 | 10947 |
10948 DrawFrame(); | 10948 DrawFrame(); |
10949 | 10949 |
10950 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); | 10950 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); |
10951 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( | 10951 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( |
10952 in_subtree_of_page_scale_layer->transform_tree_index()); | 10952 in_subtree_of_page_scale_layer->transform_tree_index()); |
10953 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 10953 EXPECT_EQ(node->surface_contents_scale, gfx::Vector2dF(2.f, 2.f)); |
10954 } | 10954 } |
10955 | 10955 |
10956 TEST_F(LayerTreeHostImplTest, JitterTest) { | 10956 TEST_F(LayerTreeHostImplTest, JitterTest) { |
10957 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 10957 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
10958 | 10958 |
10959 host_impl_->CreatePendingTree(); | 10959 host_impl_->CreatePendingTree(); |
10960 CreateScrollAndContentsLayers(host_impl_->pending_tree(), | 10960 CreateScrollAndContentsLayers(host_impl_->pending_tree(), |
10961 gfx::Size(100, 100)); | 10961 gfx::Size(100, 100)); |
10962 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 10962 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
10963 | 10963 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11045 | 11045 |
11046 // Re-initialize with a software output surface. | 11046 // Re-initialize with a software output surface. |
11047 output_surface_ = FakeOutputSurface::CreateSoftware( | 11047 output_surface_ = FakeOutputSurface::CreateSoftware( |
11048 base::WrapUnique(new SoftwareOutputDevice)); | 11048 base::WrapUnique(new SoftwareOutputDevice)); |
11049 host_impl_->InitializeRenderer(output_surface_.get()); | 11049 host_impl_->InitializeRenderer(output_surface_.get()); |
11050 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); | 11050 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); |
11051 } | 11051 } |
11052 | 11052 |
11053 } // namespace | 11053 } // namespace |
11054 } // namespace cc | 11054 } // namespace cc |
OLD | NEW |