| 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), host_(FakeLayerTreeHost::Create()) {} | 179 : opaque_layers_(opaque_layers), |
| 180 client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 181 host_(FakeLayerTreeHost::Create(&client_)) {} |
| 180 | 182 |
| 181 virtual void RunMyTest() = 0; | 183 virtual void RunMyTest() = 0; |
| 182 | 184 |
| 183 virtual void TearDown() { DestroyLayers(); } | 185 virtual void TearDown() { DestroyLayers(); } |
| 184 | 186 |
| 185 typename Types::HostType* GetHost(); | 187 typename Types::HostType* GetHost(); |
| 186 | 188 |
| 187 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, | 189 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, |
| 188 const gfx::PointF& position, | 190 const gfx::PointF& position, |
| 189 const gfx::Size& bounds) { | 191 const gfx::Size& bounds) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { | 436 void SetMask(Layer* owning_layer, scoped_refptr<Layer> layer) { |
| 435 owning_layer->SetMaskLayer(layer.get()); | 437 owning_layer->SetMaskLayer(layer.get()); |
| 436 mask_layers_.push_back(layer); | 438 mask_layers_.push_back(layer); |
| 437 } | 439 } |
| 438 | 440 |
| 439 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 441 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
| 440 owning_layer->SetMaskLayer(layer.Pass()); | 442 owning_layer->SetMaskLayer(layer.Pass()); |
| 441 } | 443 } |
| 442 | 444 |
| 443 bool opaque_layers_; | 445 bool opaque_layers_; |
| 446 FakeLayerTreeHostClient client_; |
| 444 scoped_ptr<FakeLayerTreeHost> host_; | 447 scoped_ptr<FakeLayerTreeHost> host_; |
| 445 // These hold ownership of the layers for the duration of the test. | 448 // These hold ownership of the layers for the duration of the test. |
| 446 typename Types::LayerPtrType root_; | 449 typename Types::LayerPtrType root_; |
| 447 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; | 450 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
| 448 LayerImplList render_surface_layer_list_impl_; | 451 LayerImplList render_surface_layer_list_impl_; |
| 449 typename Types::TestLayerIterator layer_iterator_begin_; | 452 typename Types::TestLayerIterator layer_iterator_begin_; |
| 450 typename Types::TestLayerIterator layer_iterator_; | 453 typename Types::TestLayerIterator layer_iterator_; |
| 451 typename Types::LayerType* last_layer_visited_; | 454 typename Types::LayerType* last_layer_visited_; |
| 452 LayerList replica_layers_; | 455 LayerList replica_layers_; |
| 453 LayerList mask_layers_; | 456 LayerList mask_layers_; |
| (...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 EXPECT_EQ(gfx::Rect(), | 3309 EXPECT_EQ(gfx::Rect(), |
| 3307 occlusion.UnoccludedSurfaceContentRect( | 3310 occlusion.UnoccludedSurfaceContentRect( |
| 3308 surface, gfx::Rect(80, 70, 50, 50))); | 3311 surface, gfx::Rect(80, 70, 50, 50))); |
| 3309 } | 3312 } |
| 3310 }; | 3313 }; |
| 3311 | 3314 |
| 3312 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3315 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
| 3313 | 3316 |
| 3314 } // namespace | 3317 } // namespace |
| 3315 } // namespace cc | 3318 } // namespace cc |
| OLD | NEW |