OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 static void RecursiveUpdateNumChildren(LayerType* layer) { | 169 static void RecursiveUpdateNumChildren(LayerType* layer) { |
170 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); | 170 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); |
171 } | 171 } |
172 }; | 172 }; |
173 | 173 |
174 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; | 174 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; |
175 | 175 |
176 template <typename Types> class OcclusionTrackerTest : public testing::Test { | 176 template <typename Types> class OcclusionTrackerTest : public testing::Test { |
177 protected: | 177 protected: |
178 explicit OcclusionTrackerTest(bool opaque_layers) | 178 explicit OcclusionTrackerTest(bool opaque_layers) |
179 : opaque_layers_(opaque_layers), | 179 : opaque_layers_(opaque_layers), host_(FakeLayerTreeHost::Create()) {} |
180 client_(FakeLayerTreeHostClient::DIRECT_3D), | |
181 host_(FakeLayerTreeHost::Create(&client_)) {} | |
182 | 180 |
183 virtual void RunMyTest() = 0; | 181 virtual void RunMyTest() = 0; |
184 | 182 |
185 virtual void TearDown() { DestroyLayers(); } | 183 virtual void TearDown() { DestroyLayers(); } |
186 | 184 |
187 typename Types::HostType* GetHost(); | 185 typename Types::HostType* GetHost(); |
188 | 186 |
189 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, | 187 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, |
190 const gfx::PointF& position, | 188 const gfx::PointF& position, |
191 const gfx::Size& bounds) { | 189 const gfx::Size& bounds) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { | 434 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { |
437 owning_layer->SetMaskLayer(layer.get()); | 435 owning_layer->SetMaskLayer(layer.get()); |
438 mask_layers_.push_back(layer); | 436 mask_layers_.push_back(layer); |
439 } | 437 } |
440 | 438 |
441 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 439 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
442 owning_layer->SetMaskLayer(layer.Pass()); | 440 owning_layer->SetMaskLayer(layer.Pass()); |
443 } | 441 } |
444 | 442 |
445 bool opaque_layers_; | 443 bool opaque_layers_; |
446 FakeLayerTreeHostClient client_; | |
447 scoped_ptr<FakeLayerTreeHost> host_; | 444 scoped_ptr<FakeLayerTreeHost> host_; |
448 // These hold ownership of the layers for the duration of the test. | 445 // These hold ownership of the layers for the duration of the test. |
449 typename Types::LayerPtrType root_; | 446 typename Types::LayerPtrType root_; |
450 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; | 447 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
451 LayerImplList render_surface_layer_list_impl_; | 448 LayerImplList render_surface_layer_list_impl_; |
452 typename Types::TestLayerIterator layer_iterator_begin_; | 449 typename Types::TestLayerIterator layer_iterator_begin_; |
453 typename Types::TestLayerIterator layer_iterator_; | 450 typename Types::TestLayerIterator layer_iterator_; |
454 typename Types::LayerType* last_layer_visited_; | 451 typename Types::LayerType* last_layer_visited_; |
455 LayerList replica_layers_; | 452 LayerList replica_layers_; |
456 LayerList mask_layers_; | 453 LayerList mask_layers_; |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 EXPECT_EQ(gfx::Rect(), | 3306 EXPECT_EQ(gfx::Rect(), |
3310 occlusion.UnoccludedSurfaceContentRect( | 3307 occlusion.UnoccludedSurfaceContentRect( |
3311 surface, gfx::Rect(80, 70, 50, 50))); | 3308 surface, gfx::Rect(80, 70, 50, 50))); |
3312 } | 3309 } |
3313 }; | 3310 }; |
3314 | 3311 |
3315 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3312 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3316 | 3313 |
3317 } // namespace | 3314 } // namespace |
3318 } // namespace cc | 3315 } // namespace cc |
OLD | NEW |