| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 // the layer. | 786 // the layer. |
| 785 high_res_tiling = pending_layer_->tilings().tiling_at(0); | 787 high_res_tiling = pending_layer_->tilings().tiling_at(0); |
| 786 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); | 788 EXPECT_LT(1u, high_res_tiling->AllTilesForTesting().size()); |
| 787 | 789 |
| 788 // Verify the tiles are not larger than the context's max texture size. | 790 // Verify the tiles are not larger than the context's max texture size. |
| 789 Tile* tile = pending_layer_->tilings().tiling_at(0)->AllTilesForTesting()[0]; | 791 Tile* tile = pending_layer_->tilings().tiling_at(0)->AllTilesForTesting()[0]; |
| 790 EXPECT_GE(140, tile->content_rect().width()); | 792 EXPECT_GE(140, tile->content_rect().width()); |
| 791 EXPECT_GE(140, tile->content_rect().height()); | 793 EXPECT_GE(140, tile->content_rect().height()); |
| 792 } | 794 } |
| 793 | 795 |
| 796 TEST_F(PictureLayerImplTest, CannotAppendTileQuads) { |
| 797 MockQuadCuller quad_culler; |
| 798 |
| 799 gfx::Size tile_size(400, 400); |
| 800 gfx::Size layer_bounds(1300, 1900); |
| 801 |
| 802 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 803 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 804 scoped_refptr<FakePicturePileImpl> active_pile = |
| 805 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 806 |
| 807 SetupTrees(pending_pile, active_pile); |
| 808 |
| 809 active_layer_->SetContentBounds(layer_bounds); |
| 810 |
| 811 gfx::Rect layer_invalidation(150, 200, 30, 180); |
| 812 Region invalidation(layer_invalidation); |
| 813 AddDefaultTilingsWithInvalidation(invalidation); |
| 814 |
| 815 AppendQuadsData data; |
| 816 data.cannot_append_tile_draw_quads = true; |
| 817 active_layer_->AppendQuads(&quad_culler, &data); |
| 818 |
| 819 ASSERT_EQ(1U, quad_culler.quad_list().size()); |
| 820 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, quad_culler.quad_list()[0]->material); |
| 821 } |
| 822 |
| 794 } // namespace | 823 } // namespace |
| 795 } // namespace cc | 824 } // namespace cc |
| OLD | NEW |