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

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

Issue 271533011: cc: Move tiling management out of draw properties calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests + review comments Created 6 years, 7 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 6561 matching lines...) Expand 10 before | Expand all | Expand 10 after
6572 gfx::Size bounds(100000, 100); 6572 gfx::Size bounds(100000, 100);
6573 6573
6574 host_impl_->CreatePendingTree(); 6574 host_impl_->CreatePendingTree();
6575 6575
6576 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1); 6576 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1);
6577 6577
6578 scoped_ptr<FakePictureLayerImpl> layer_with_mask = 6578 scoped_ptr<FakePictureLayerImpl> layer_with_mask =
6579 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2); 6579 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2);
6580 6580
6581 layer_with_mask->SetBounds(bounds); 6581 layer_with_mask->SetBounds(bounds);
6582 layer_with_mask->SetContentBounds(bounds);
6582 6583
6583 scoped_ptr<FakePictureLayerImpl> mask = 6584 scoped_ptr<FakePictureLayerImpl> mask =
6584 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3); 6585 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3);
6585 6586
6586 mask->SetIsMask(true); 6587 mask->SetIsMask(true);
6587 mask->SetBounds(bounds); 6588 mask->SetBounds(bounds);
6589 mask->SetContentBounds(bounds);
6588 6590
6589 FakePictureLayerImpl* pending_mask_content = mask.get(); 6591 FakePictureLayerImpl* pending_mask_content = mask.get();
6590 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); 6592 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
6591 6593
6592 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = 6594 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
6593 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4); 6595 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4);
6594 6596
6595 child_of_layer_with_mask->SetBounds(bounds); 6597 child_of_layer_with_mask->SetBounds(bounds);
6596 child_of_layer_with_mask->SetDrawsContent(true); 6598 child_of_layer_with_mask->SetDrawsContent(true);
6599 child_of_layer_with_mask->SetContentBounds(bounds);
danakj 2014/05/23 17:07:34 move below SetBounds
6597 6600
6598 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); 6601 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
6599 6602
6600 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); 6603 root->AddChild(layer_with_mask.PassAs<LayerImpl>());
6601 6604
6602 host_impl_->pending_tree()->SetRootLayer(root.Pass()); 6605 host_impl_->pending_tree()->SetRootLayer(root.Pass());
6603 6606
6604 gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority(); 6607 gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority();
6605 ASSERT_EQ(0, r1.x()); 6608 ASSERT_EQ(0, r1.x());
6606 ASSERT_EQ(0, r1.y()); 6609 ASSERT_EQ(0, r1.y());
6607 ASSERT_EQ(0, r1.width()); 6610 ASSERT_EQ(0, r1.width());
6608 ASSERT_EQ(0, r1.height()); 6611 ASSERT_EQ(0, r1.height());
6609 6612
6610 host_impl_->ActivatePendingTree(); 6613 host_impl_->ActivatePendingTree();
6611 6614
6612 host_impl_->active_tree()->UpdateDrawProperties(); 6615 host_impl_->active_tree()->UpdateDrawProperties();
6613 6616
6614 ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); 6617 ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size());
6615 6618
6616 FakePictureLayerImpl* active_mask_content = 6619 FakePictureLayerImpl* active_mask_content =
6617 static_cast<FakePictureLayerImpl*>( 6620 static_cast<FakePictureLayerImpl*>(
6618 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); 6621 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer());
6619 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); 6622 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority();
6620 6623
6621 ASSERT_TRUE(!r2.IsEmpty()); 6624 ASSERT_TRUE(!r2.IsEmpty());
6622 } 6625 }
6623 6626
6624 } // namespace 6627 } // namespace
6625 } // namespace cc 6628 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698