Chromium Code Reviews| 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2086 | 2086 |
| 2087 TEST_F(LayerTreeImplTest, NumLayersSmallTree) { | 2087 TEST_F(LayerTreeImplTest, NumLayersSmallTree) { |
| 2088 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2088 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
| 2089 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2089 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 2090 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2090 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
| 2091 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2091 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
| 2092 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2092 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
| 2093 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2093 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
| 2094 } | 2094 } |
| 2095 | 2095 |
| 2096 TEST_F(LayerTreeImplTest, ViewportRectForTilePriorityIsCached) { | |
| 2097 bool resourceless_software_draw = false; | |
| 2098 | |
| 2099 gfx::Transform transform, transform_for_tile_priority; | |
|
vmpstr
2015/01/16 19:14:00
One variable per statement, please.
| |
| 2100 gfx::Point3F transform_origin; | |
| 2101 gfx::PointF position; | |
| 2102 gfx::Size bounds(100, 100); | |
| 2103 gfx::Rect viewport = gfx::Rect(0, 0, 200, 200), | |
|
vmpstr
2015/01/16 19:14:01
Same here.
| |
| 2104 rect1 = gfx::Rect(0, 0, 100, 100), | |
|
vmpstr
2015/01/16 19:14:00
If you name these something like "viewport_rect_fo
| |
| 2105 rect2 = gfx::Rect(10, 10, 123, 123); | |
| 2106 | |
| 2107 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | |
| 2108 SetLayerPropertiesForTesting(root.get(), transform, transform_origin, | |
| 2109 position, bounds, true, false, true); | |
| 2110 root->SetDrawsContent(true); | |
| 2111 host_impl().SetViewportSize(root->bounds()); | |
| 2112 host_impl().active_tree()->SetRootLayer(root.Pass()); | |
| 2113 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | |
| 2114 | |
| 2115 host_impl().SetExternalDrawConstraints( | |
| 2116 transform, viewport, viewport, | |
| 2117 rect1, /* viewport_rect_for_tile_priority */ | |
| 2118 transform_for_tile_priority, resourceless_software_draw); | |
| 2119 host_impl().active_tree()->UpdateDrawProperties(); | |
| 2120 EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1); | |
| 2121 | |
| 2122 host_impl().SetExternalDrawConstraints( | |
| 2123 transform, viewport, viewport, | |
| 2124 rect2, /* viewport_rect_for_tile_priority */ | |
| 2125 transform_for_tile_priority, resourceless_software_draw); | |
| 2126 | |
| 2127 // Test that even when the LTHI's viewport rect for tile priority has | |
| 2128 // changed, the ViewportRectForTilePriority will not change to most recent | |
| 2129 // value until UpdateDrawProperties is called. | |
| 2130 EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1); | |
| 2131 host_impl().active_tree()->UpdateDrawProperties(); | |
| 2132 EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect2); | |
| 2133 } | |
| 2134 | |
| 2096 } // namespace | 2135 } // namespace |
| 2097 } // namespace cc | 2136 } // namespace cc |
| OLD | NEW |