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" |
11 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.h" |
12 #include "cc/output/copy_output_result.h" | 12 #include "cc/output/copy_output_result.h" |
13 #include "cc/output/filter_operation.h" | 13 #include "cc/output/filter_operation.h" |
14 #include "cc/output/filter_operations.h" | 14 #include "cc/output/filter_operations.h" |
15 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
16 #include "cc/test/fake_impl_proxy.h" | 16 #include "cc/test/fake_impl_proxy.h" |
17 #include "cc/test/fake_layer_tree_host.h" | 17 #include "cc/test/fake_layer_tree_host.h" |
18 #include "cc/test/fake_layer_tree_host_impl.h" | 18 #include "cc/test/fake_layer_tree_host_impl.h" |
19 #include "cc/test/geometry_test_utils.h" | 19 #include "cc/test/geometry_test_utils.h" |
20 #include "cc/test/test_occlusion_tracker.h" | 20 #include "cc/test/test_occlusion_tracker.h" |
21 #include "cc/trees/layer_tree_host_common.h" | 21 #include "cc/trees/layer_tree_host_common.h" |
22 #include "cc/trees/single_thread_proxy.h" | 22 #include "cc/trees/single_thread_proxy.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/gfx/geometry/size_conversions.h" | |
26 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
27 | 26 |
28 namespace cc { | 27 namespace cc { |
29 namespace { | 28 namespace { |
30 | 29 |
31 class TestContentLayer : public Layer { | 30 class TestContentLayer : public Layer { |
32 public: | 31 public: |
33 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { | 32 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { |
34 SetIsDrawable(true); | 33 SetIsDrawable(true); |
35 } | 34 } |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 base::Unretained(this)))); | 302 base::Unretained(this)))); |
304 layer->PassCopyRequests(&requests); | 303 layer->PassCopyRequests(&requests); |
305 } | 304 } |
306 | 305 |
307 void CalcDrawEtc(TestContentLayerImpl* root) { | 306 void CalcDrawEtc(TestContentLayerImpl* root) { |
308 DCHECK(root == root_.get()); | 307 DCHECK(root == root_.get()); |
309 DCHECK(!root->render_surface()); | 308 DCHECK(!root->render_surface()); |
310 | 309 |
311 Types::RecursiveUpdateNumChildren(root); | 310 Types::RecursiveUpdateNumChildren(root); |
312 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 311 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
313 root, | 312 root, root->bounds(), &render_surface_layer_list_impl_); |
314 gfx::ToCeiledSize(root->bounds()), | |
315 &render_surface_layer_list_impl_); | |
316 inputs.can_adjust_raster_scales = true; | 313 inputs.can_adjust_raster_scales = true; |
317 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 314 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
318 | 315 |
319 layer_iterator_ = layer_iterator_begin_ = | 316 layer_iterator_ = layer_iterator_begin_ = |
320 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); | 317 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); |
321 } | 318 } |
322 | 319 |
323 void CalcDrawEtc(TestContentLayer* root) { | 320 void CalcDrawEtc(TestContentLayer* root) { |
324 DCHECK(root == root_.get()); | 321 DCHECK(root == root_.get()); |
325 DCHECK(!root->render_surface()); | 322 DCHECK(!root->render_surface()); |
326 | 323 |
327 render_surface_layer_list_.reset(new RenderSurfaceLayerList); | 324 render_surface_layer_list_.reset(new RenderSurfaceLayerList); |
328 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 325 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
329 root, | 326 root, root->bounds(), render_surface_layer_list_.get()); |
330 gfx::ToCeiledSize(root->bounds()), | |
331 render_surface_layer_list_.get()); | |
332 inputs.can_adjust_raster_scales = true; | 327 inputs.can_adjust_raster_scales = true; |
333 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 328 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
334 | 329 |
335 layer_iterator_ = layer_iterator_begin_ = | 330 layer_iterator_ = layer_iterator_begin_ = |
336 Types::TestLayerIterator::Begin(render_surface_layer_list_.get()); | 331 Types::TestLayerIterator::Begin(render_surface_layer_list_.get()); |
337 } | 332 } |
338 | 333 |
339 void EnterLayer(typename Types::LayerType* layer, | 334 void EnterLayer(typename Types::LayerType* layer, |
340 typename Types::OcclusionTrackerType* occlusion) { | 335 typename Types::OcclusionTrackerType* occlusion) { |
341 ASSERT_EQ(*layer_iterator_, layer); | 336 ASSERT_EQ(*layer_iterator_, layer); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 const gfx::Size& bounds) { | 406 const gfx::Size& bounds) { |
412 SetBaseProperties(layer, transform, position, bounds); | 407 SetBaseProperties(layer, transform, position, bounds); |
413 } | 408 } |
414 | 409 |
415 void SetProperties(LayerImpl* layer, | 410 void SetProperties(LayerImpl* layer, |
416 const gfx::Transform& transform, | 411 const gfx::Transform& transform, |
417 const gfx::PointF& position, | 412 const gfx::PointF& position, |
418 const gfx::Size& bounds) { | 413 const gfx::Size& bounds) { |
419 SetBaseProperties(layer, transform, position, bounds); | 414 SetBaseProperties(layer, transform, position, bounds); |
420 | 415 |
421 layer->SetContentBounds(gfx::ToCeiledSize(layer->bounds())); | 416 layer->SetContentBounds(layer->bounds()); |
422 } | 417 } |
423 | 418 |
424 void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) { | 419 void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) { |
425 owning_layer->SetReplicaLayer(layer.get()); | 420 owning_layer->SetReplicaLayer(layer.get()); |
426 replica_layers_.push_back(layer); | 421 replica_layers_.push_back(layer); |
427 } | 422 } |
428 | 423 |
429 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 424 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
430 owning_layer->SetReplicaLayer(layer.Pass()); | 425 owning_layer->SetReplicaLayer(layer.Pass()); |
431 } | 426 } |
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3306 EXPECT_EQ(gfx::Rect(), | 3301 EXPECT_EQ(gfx::Rect(), |
3307 occlusion.UnoccludedSurfaceContentRect( | 3302 occlusion.UnoccludedSurfaceContentRect( |
3308 surface, gfx::Rect(80, 70, 50, 50))); | 3303 surface, gfx::Rect(80, 70, 50, 50))); |
3309 } | 3304 } |
3310 }; | 3305 }; |
3311 | 3306 |
3312 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3313 | 3308 |
3314 } // namespace | 3309 } // namespace |
3315 } // namespace cc | 3310 } // namespace cc |
OLD | NEW |