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 <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "cc/layers/append_quads_data.h" |
9 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
10 #include "cc/test/fake_content_layer_client.h" | 11 #include "cc/test/fake_content_layer_client.h" |
11 #include "cc/test/fake_impl_proxy.h" | 12 #include "cc/test/fake_impl_proxy.h" |
12 #include "cc/test/fake_layer_tree_host_impl.h" | 13 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/test/fake_output_surface.h" | 14 #include "cc/test/fake_output_surface.h" |
14 #include "cc/test/fake_picture_pile_impl.h" | 15 #include "cc/test/fake_picture_pile_impl.h" |
15 #include "cc/test/geometry_test_utils.h" | 16 #include "cc/test/geometry_test_utils.h" |
16 #include "cc/test/impl_side_painting_settings.h" | 17 #include "cc/test/impl_side_painting_settings.h" |
| 18 #include "cc/test/mock_quad_culler.h" |
17 #include "cc/trees/layer_tree_impl.h" | 19 #include "cc/trees/layer_tree_impl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/skia/include/core/SkDevice.h" | 21 #include "third_party/skia/include/core/SkDevice.h" |
20 #include "ui/gfx/rect_conversions.h" | 22 #include "ui/gfx/rect_conversions.h" |
21 | 23 |
22 namespace cc { | 24 namespace cc { |
23 namespace { | 25 namespace { |
24 | 26 |
25 class TestablePictureLayerImpl : public PictureLayerImpl { | 27 class TestablePictureLayerImpl : public PictureLayerImpl { |
26 public: | 28 public: |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 // the layer. | 821 // the layer. |
820 high_res_tiling = pending_layer_->tilings().tiling_at(0); | 822 high_res_tiling = pending_layer_->tilings().tiling_at(0); |
821 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); | 823 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); |
822 | 824 |
823 // Verify the tiles are not larger than the context's max texture size. | 825 // Verify the tiles are not larger than the context's max texture size. |
824 Tile* tile = pending_layer_->tilings().tiling_at(0)->AllTilesForTesting()[0]; | 826 Tile* tile = pending_layer_->tilings().tiling_at(0)->AllTilesForTesting()[0]; |
825 EXPECT_GE(140, tile->content_rect().width()); | 827 EXPECT_GE(140, tile->content_rect().width()); |
826 EXPECT_GE(140, tile->content_rect().height()); | 828 EXPECT_GE(140, tile->content_rect().height()); |
827 } | 829 } |
828 | 830 |
| 831 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { |
| 832 MockQuadCuller quad_culler; |
| 833 |
| 834 gfx::Size tile_size(400, 400); |
| 835 gfx::Size layer_bounds(1300, 1900); |
| 836 |
| 837 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 838 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 839 scoped_refptr<FakePicturePileImpl> active_pile = |
| 840 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 841 |
| 842 SetupTrees(pending_pile, active_pile); |
| 843 |
| 844 active_layer_->SetContentBounds(layer_bounds); |
| 845 active_layer_->draw_properties().visible_content_rect = |
| 846 gfx::Rect(layer_bounds); |
| 847 |
| 848 gfx::Rect layer_invalidation(150, 200, 30, 180); |
| 849 Region invalidation(layer_invalidation); |
| 850 AddDefaultTilingsWithInvalidation(invalidation); |
| 851 |
| 852 AppendQuadsData data; |
| 853 data.allow_tile_draw_quads = false; |
| 854 active_layer_->AppendQuads(&quad_culler, &data); |
| 855 |
| 856 ASSERT_EQ(1U, quad_culler.quad_list().size()); |
| 857 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, quad_culler.quad_list()[0]->material); |
| 858 } |
| 859 |
829 } // namespace | 860 } // namespace |
830 } // namespace cc | 861 } // namespace cc |
OLD | NEW |