Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: cc/trees/occlusion_tracker_unittest.cc

Issue 634683003: Converted LayerImpl::bounds() to return SizeF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
25 #include "ui/gfx/transform.h" 26 #include "ui/gfx/transform.h"
26 27
27 namespace cc { 28 namespace cc {
28 namespace { 29 namespace {
29 30
30 class TestContentLayer : public Layer { 31 class TestContentLayer : public Layer {
31 public: 32 public:
32 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { 33 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) {
33 SetIsDrawable(true); 34 SetIsDrawable(true);
34 } 35 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 base::Unretained(this)))); 303 base::Unretained(this))));
303 layer->PassCopyRequests(&requests); 304 layer->PassCopyRequests(&requests);
304 } 305 }
305 306
306 void CalcDrawEtc(TestContentLayerImpl* root) { 307 void CalcDrawEtc(TestContentLayerImpl* root) {
307 DCHECK(root == root_.get()); 308 DCHECK(root == root_.get());
308 DCHECK(!root->render_surface()); 309 DCHECK(!root->render_surface());
309 310
310 Types::RecursiveUpdateNumChildren(root); 311 Types::RecursiveUpdateNumChildren(root);
311 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 312 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
312 root, root->bounds(), &render_surface_layer_list_impl_); 313 root,
314 gfx::ToCeiledSize(root->bounds()),
315 &render_surface_layer_list_impl_);
313 inputs.can_adjust_raster_scales = true; 316 inputs.can_adjust_raster_scales = true;
314 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 317 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
315 318
316 layer_iterator_ = layer_iterator_begin_ = 319 layer_iterator_ = layer_iterator_begin_ =
317 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); 320 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_);
318 } 321 }
319 322
320 void CalcDrawEtc(TestContentLayer* root) { 323 void CalcDrawEtc(TestContentLayer* root) {
321 DCHECK(root == root_.get()); 324 DCHECK(root == root_.get());
322 DCHECK(!root->render_surface()); 325 DCHECK(!root->render_surface());
323 326
324 render_surface_layer_list_.reset(new RenderSurfaceLayerList); 327 render_surface_layer_list_.reset(new RenderSurfaceLayerList);
325 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 328 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
326 root, root->bounds(), render_surface_layer_list_.get()); 329 root,
330 gfx::ToCeiledSize(root->bounds()),
331 render_surface_layer_list_.get());
327 inputs.can_adjust_raster_scales = true; 332 inputs.can_adjust_raster_scales = true;
328 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 333 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
329 334
330 layer_iterator_ = layer_iterator_begin_ = 335 layer_iterator_ = layer_iterator_begin_ =
331 Types::TestLayerIterator::Begin(render_surface_layer_list_.get()); 336 Types::TestLayerIterator::Begin(render_surface_layer_list_.get());
332 } 337 }
333 338
334 void EnterLayer(typename Types::LayerType* layer, 339 void EnterLayer(typename Types::LayerType* layer,
335 typename Types::OcclusionTrackerType* occlusion) { 340 typename Types::OcclusionTrackerType* occlusion) {
336 ASSERT_EQ(*layer_iterator_, layer); 341 ASSERT_EQ(*layer_iterator_, layer);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 const gfx::Size& bounds) { 411 const gfx::Size& bounds) {
407 SetBaseProperties(layer, transform, position, bounds); 412 SetBaseProperties(layer, transform, position, bounds);
408 } 413 }
409 414
410 void SetProperties(LayerImpl* layer, 415 void SetProperties(LayerImpl* layer,
411 const gfx::Transform& transform, 416 const gfx::Transform& transform,
412 const gfx::PointF& position, 417 const gfx::PointF& position,
413 const gfx::Size& bounds) { 418 const gfx::Size& bounds) {
414 SetBaseProperties(layer, transform, position, bounds); 419 SetBaseProperties(layer, transform, position, bounds);
415 420
416 layer->SetContentBounds(layer->bounds()); 421 layer->SetContentBounds(gfx::ToCeiledSize(layer->bounds()));
417 } 422 }
418 423
419 void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) { 424 void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) {
420 owning_layer->SetReplicaLayer(layer.get()); 425 owning_layer->SetReplicaLayer(layer.get());
421 replica_layers_.push_back(layer); 426 replica_layers_.push_back(layer);
422 } 427 }
423 428
424 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { 429 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) {
425 owning_layer->SetReplicaLayer(layer.Pass()); 430 owning_layer->SetReplicaLayer(layer.Pass());
426 } 431 }
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after
3301 EXPECT_EQ(gfx::Rect(), 3306 EXPECT_EQ(gfx::Rect(),
3302 occlusion.UnoccludedSurfaceContentRect( 3307 occlusion.UnoccludedSurfaceContentRect(
3303 surface, gfx::Rect(80, 70, 50, 50))); 3308 surface, gfx::Rect(80, 70, 50, 50)));
3304 } 3309 }
3305 }; 3310 };
3306 3311
3307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 3312 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
3308 3313
3309 } // namespace 3314 } // namespace
3310 } // namespace cc 3315 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698