| OLD | NEW | 
|---|
| 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 5447 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5458   gfx::Size pile_tile_size(3000, 3000); | 5458   gfx::Size pile_tile_size(3000, 3000); | 
| 5459   scoped_refptr<FakePicturePileImpl> pile(FakePicturePileImpl::CreateFilledPile( | 5459   scoped_refptr<FakePicturePileImpl> pile(FakePicturePileImpl::CreateFilledPile( | 
| 5460       pile_tile_size, content_layer_bounds)); | 5460       pile_tile_size, content_layer_bounds)); | 
| 5461 | 5461 | 
| 5462   scoped_ptr<FakePictureLayerImpl> scoped_content_layer = | 5462   scoped_ptr<FakePictureLayerImpl> scoped_content_layer = | 
| 5463       FakePictureLayerImpl::CreateWithPile(host_impl_->pending_tree(), 3, pile); | 5463       FakePictureLayerImpl::CreateWithPile(host_impl_->pending_tree(), 3, pile); | 
| 5464   LayerImpl* content_layer = scoped_content_layer.get(); | 5464   LayerImpl* content_layer = scoped_content_layer.get(); | 
| 5465   scrolling_layer->AddChild(scoped_content_layer.PassAs<LayerImpl>()); | 5465   scrolling_layer->AddChild(scoped_content_layer.PassAs<LayerImpl>()); | 
| 5466   content_layer->SetBounds(content_layer_bounds); | 5466   content_layer->SetBounds(content_layer_bounds); | 
| 5467   content_layer->SetDrawsContent(true); | 5467   content_layer->SetDrawsContent(true); | 
|  | 5468   content_layer->SetContentBounds(content_layer_bounds); | 
| 5468 | 5469 | 
| 5469   root->SetBounds(root_size); | 5470   root->SetBounds(root_size); | 
| 5470 | 5471 | 
| 5471   gfx::Vector2d scroll_offset(100000, 0); | 5472   gfx::Vector2d scroll_offset(100000, 0); | 
| 5472   scrolling_layer->SetScrollClipLayer(root->id()); | 5473   scrolling_layer->SetScrollClipLayer(root->id()); | 
| 5473   scrolling_layer->SetScrollOffset(scroll_offset); | 5474   scrolling_layer->SetScrollOffset(scroll_offset); | 
| 5474 | 5475 | 
| 5475   host_impl_->ActivatePendingTree(); | 5476   host_impl_->ActivatePendingTree(); | 
|  | 5477   host_impl_->active_tree()->UpdateDrawProperties(); | 
| 5476 | 5478 | 
| 5477   host_impl_->active_tree()->UpdateDrawProperties(); |  | 
| 5478   ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 5479   ASSERT_EQ(1u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 
| 5479 | 5480 | 
| 5480   LayerTreeHostImpl::FrameData frame; | 5481   LayerTreeHostImpl::FrameData frame; | 
| 5481   EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5482   EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 
| 5482 | 5483 | 
| 5483   ASSERT_EQ(1u, frame.render_passes.size()); | 5484   ASSERT_EQ(1u, frame.render_passes.size()); | 
| 5484   ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); | 5485   ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); | 
| 5485   const DrawQuad* quad = frame.render_passes[0]->quad_list[0]; | 5486   const DrawQuad* quad = frame.render_passes[0]->quad_list[0]; | 
| 5486 | 5487 | 
| 5487   float edge[24]; | 5488   float edge[24]; | 
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6544   gfx::Size bounds(100000, 100); | 6545   gfx::Size bounds(100000, 100); | 
| 6545 | 6546 | 
| 6546   host_impl_->CreatePendingTree(); | 6547   host_impl_->CreatePendingTree(); | 
| 6547 | 6548 | 
| 6548   scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1); | 6549   scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1); | 
| 6549 | 6550 | 
| 6550   scoped_ptr<FakePictureLayerImpl> layer_with_mask = | 6551   scoped_ptr<FakePictureLayerImpl> layer_with_mask = | 
| 6551       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2); | 6552       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2); | 
| 6552 | 6553 | 
| 6553   layer_with_mask->SetBounds(bounds); | 6554   layer_with_mask->SetBounds(bounds); | 
|  | 6555   layer_with_mask->SetContentBounds(bounds); | 
| 6554 | 6556 | 
| 6555   scoped_ptr<FakePictureLayerImpl> mask = | 6557   scoped_ptr<FakePictureLayerImpl> mask = | 
| 6556       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3); | 6558       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3); | 
| 6557 | 6559 | 
| 6558   mask->SetIsMask(true); | 6560   mask->SetIsMask(true); | 
| 6559   mask->SetBounds(bounds); | 6561   mask->SetBounds(bounds); | 
|  | 6562   mask->SetContentBounds(bounds); | 
| 6560 | 6563 | 
| 6561   FakePictureLayerImpl* pending_mask_content = mask.get(); | 6564   FakePictureLayerImpl* pending_mask_content = mask.get(); | 
| 6562   layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); | 6565   layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); | 
| 6563 | 6566 | 
| 6564   scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 6567   scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 
| 6565       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4); | 6568       FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4); | 
| 6566 | 6569 | 
| 6567   child_of_layer_with_mask->SetBounds(bounds); | 6570   child_of_layer_with_mask->SetBounds(bounds); | 
| 6568   child_of_layer_with_mask->SetDrawsContent(true); | 6571   child_of_layer_with_mask->SetDrawsContent(true); | 
|  | 6572   child_of_layer_with_mask->SetContentBounds(bounds); | 
| 6569 | 6573 | 
| 6570   layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); | 6574   layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); | 
| 6571 | 6575 | 
| 6572   root->AddChild(layer_with_mask.PassAs<LayerImpl>()); | 6576   root->AddChild(layer_with_mask.PassAs<LayerImpl>()); | 
| 6573 | 6577 | 
| 6574   host_impl_->pending_tree()->SetRootLayer(root.Pass()); | 6578   host_impl_->pending_tree()->SetRootLayer(root.Pass()); | 
| 6575 | 6579 | 
| 6576   gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority(); | 6580   gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority(); | 
| 6577   ASSERT_EQ(0, r1.x()); | 6581   ASSERT_EQ(0, r1.x()); | 
| 6578   ASSERT_EQ(0, r1.y()); | 6582   ASSERT_EQ(0, r1.y()); | 
| 6579   ASSERT_EQ(0, r1.width()); | 6583   ASSERT_EQ(0, r1.width()); | 
| 6580   ASSERT_EQ(0, r1.height()); | 6584   ASSERT_EQ(0, r1.height()); | 
| 6581 | 6585 | 
| 6582   host_impl_->ActivatePendingTree(); | 6586   host_impl_->ActivatePendingTree(); | 
| 6583 | 6587 | 
| 6584   host_impl_->active_tree()->UpdateDrawProperties(); | 6588   host_impl_->active_tree()->UpdateDrawProperties(); | 
| 6585 | 6589 | 
| 6586   ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 6590   ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size()); | 
| 6587 | 6591 | 
| 6588   FakePictureLayerImpl* active_mask_content = | 6592   FakePictureLayerImpl* active_mask_content = | 
| 6589       static_cast<FakePictureLayerImpl*>( | 6593       static_cast<FakePictureLayerImpl*>( | 
| 6590           host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); | 6594           host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); | 
| 6591   gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); | 6595   gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); | 
| 6592 | 6596 | 
| 6593   ASSERT_TRUE(!r2.IsEmpty()); | 6597   ASSERT_TRUE(!r2.IsEmpty()); | 
| 6594 } | 6598 } | 
| 6595 | 6599 | 
| 6596 }  // namespace | 6600 }  // namespace | 
| 6597 }  // namespace cc | 6601 }  // namespace cc | 
| OLD | NEW | 
|---|