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/debug/overdraw_metrics.h" | 9 #include "cc/debug/overdraw_metrics.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 typename Types::ContentLayerPtrType layer( | 255 typename Types::ContentLayerPtrType layer( |
256 Types::CreateContentLayer(GetHost())); | 256 Types::CreateContentLayer(GetHost())); |
257 typename Types::ContentLayerType* layer_ptr = layer.get(); | 257 typename Types::ContentLayerType* layer_ptr = layer.get(); |
258 SetProperties(layer_ptr, transform, position, bounds); | 258 SetProperties(layer_ptr, transform, position, bounds); |
259 | 259 |
260 if (opaque_layers_) { | 260 if (opaque_layers_) { |
261 layer_ptr->SetContentsOpaque(opaque); | 261 layer_ptr->SetContentsOpaque(opaque); |
262 } else { | 262 } else { |
263 layer_ptr->SetContentsOpaque(false); | 263 layer_ptr->SetContentsOpaque(false); |
264 if (opaque) | 264 if (opaque) |
265 layer_ptr->SetOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds)); | 265 layer_ptr->SetOpaqueContentsRect(gfx::Rect(bounds)); |
266 else | 266 else |
267 layer_ptr->SetOpaqueContentsRect(gfx::Rect()); | 267 layer_ptr->SetOpaqueContentsRect(gfx::Rect()); |
268 } | 268 } |
269 | 269 |
270 parent->AddChild(Types::PassLayerPtr(&layer)); | 270 parent->AddChild(Types::PassLayerPtr(&layer)); |
271 return layer_ptr; | 271 return layer_ptr; |
272 } | 272 } |
273 | 273 |
274 typename Types::LayerType* CreateReplicaLayer( | 274 typename Types::LayerType* CreateReplicaLayer( |
275 typename Types::LayerType* owning_layer, | 275 typename Types::LayerType* owning_layer, |
(...skipping 4055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 EXPECT_EQ(gfx::Rect().ToString(), | 4331 EXPECT_EQ(gfx::Rect().ToString(), |
4332 occlusion.occlusion_from_outside_target().ToString()); | 4332 occlusion.occlusion_from_outside_target().ToString()); |
4333 EXPECT_EQ(gfx::Rect().ToString(), | 4333 EXPECT_EQ(gfx::Rect().ToString(), |
4334 occlusion.occlusion_from_inside_target().ToString()); | 4334 occlusion.occlusion_from_inside_target().ToString()); |
4335 | 4335 |
4336 // The large layer is tracked as it is large enough. | 4336 // The large layer is tracked as it is large enough. |
4337 this->VisitLayer(large, occlusion); | 4337 this->VisitLayer(large, occlusion); |
4338 | 4338 |
4339 EXPECT_EQ(gfx::Rect().ToString(), | 4339 EXPECT_EQ(gfx::Rect().ToString(), |
4340 occlusion.occlusion_from_outside_target().ToString()); | 4340 occlusion.occlusion_from_outside_target().ToString()); |
4341 EXPECT_EQ(gfx::Rect(gfx::Point(), tracking_size).ToString(), | 4341 EXPECT_EQ(gfx::Rect(tracking_size).ToString(), |
4342 occlusion.occlusion_from_inside_target().ToString()); | 4342 occlusion.occlusion_from_inside_target().ToString()); |
4343 } | 4343 } |
4344 }; | 4344 }; |
4345 | 4345 |
4346 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 4346 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
4347 | 4347 |
4348 template <class Types> | 4348 template <class Types> |
4349 class OcclusionTrackerTestViewportClipIsExternalOcclusion : | 4349 class OcclusionTrackerTestViewportClipIsExternalOcclusion : |
4350 public OcclusionTrackerTest<Types> { | 4350 public OcclusionTrackerTest<Types> { |
4351 protected: | 4351 protected: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4522 gfx::Rect(0, 0, 100, 100), | 4522 gfx::Rect(0, 0, 100, 100), |
4523 &has_occlusion_from_outside_target_surface)); | 4523 &has_occlusion_from_outside_target_surface)); |
4524 EXPECT_FALSE(has_occlusion_from_outside_target_surface); | 4524 EXPECT_FALSE(has_occlusion_from_outside_target_surface); |
4525 } | 4525 } |
4526 }; | 4526 }; |
4527 | 4527 |
4528 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) | 4528 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) |
4529 | 4529 |
4530 } // namespace | 4530 } // namespace |
4531 } // namespace cc | 4531 } // namespace cc |
OLD | NEW |