OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2767 // MaximumTilingContentsScale on the layer. | 2767 // MaximumTilingContentsScale on the layer. |
2768 EXPECT_EQ(gfx::Size(2500u, 5000u).ToString(), | 2768 EXPECT_EQ(gfx::Size(2500u, 5000u).ToString(), |
2769 quad_culler.shared_quad_state_list()[0]->content_bounds.ToString()); | 2769 quad_culler.shared_quad_state_list()[0]->content_bounds.ToString()); |
2770 // The visible_content_rect should be scaled by the | 2770 // The visible_content_rect should be scaled by the |
2771 // MaximumTilingContentsScale on the layer. | 2771 // MaximumTilingContentsScale on the layer. |
2772 EXPECT_EQ( | 2772 EXPECT_EQ( |
2773 gfx::Rect(0u, 0u, 2500u, 5000u).ToString(), | 2773 gfx::Rect(0u, 0u, 2500u, 5000u).ToString(), |
2774 quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString()); | 2774 quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString()); |
2775 } | 2775 } |
2776 | 2776 |
| 2777 TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { |
| 2778 gfx::Size tile_size(400, 400); |
| 2779 gfx::Size bounds(100000, 100); |
| 2780 |
| 2781 host_impl_.CreatePendingTree(); |
| 2782 |
| 2783 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1); |
| 2784 |
| 2785 scoped_ptr<FakePictureLayerImpl> layer_with_mask = |
| 2786 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 2); |
| 2787 |
| 2788 layer_with_mask->SetBounds(bounds); |
| 2789 layer_with_mask->SetContentBounds(bounds); |
| 2790 |
| 2791 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 2792 FakePicturePileImpl::CreateFilledPile(tile_size, bounds); |
| 2793 scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile( |
| 2794 host_impl_.pending_tree(), 3, pending_pile); |
| 2795 |
| 2796 mask->SetIsMask(true); |
| 2797 mask->SetBounds(bounds); |
| 2798 mask->SetContentBounds(bounds); |
| 2799 mask->SetDrawsContent(true); |
| 2800 |
| 2801 FakePictureLayerImpl* pending_mask_content = mask.get(); |
| 2802 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); |
| 2803 |
| 2804 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = |
| 2805 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); |
| 2806 |
| 2807 child_of_layer_with_mask->SetBounds(bounds); |
| 2808 child_of_layer_with_mask->SetContentBounds(bounds); |
| 2809 child_of_layer_with_mask->SetDrawsContent(true); |
| 2810 |
| 2811 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); |
| 2812 |
| 2813 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); |
| 2814 |
| 2815 host_impl_.pending_tree()->SetRootLayer(root.Pass()); |
| 2816 |
| 2817 EXPECT_FALSE(pending_mask_content->tilings()); |
| 2818 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 2819 EXPECT_NE(0u, pending_mask_content->num_tilings()); |
| 2820 } |
| 2821 |
2777 } // namespace | 2822 } // namespace |
2778 } // namespace cc | 2823 } // namespace cc |
OLD | NEW |