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