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 "cc/layers/picture_layer.h" | 7 #include "cc/layers/picture_layer.h" |
8 #include "cc/test/fake_content_layer_client.h" | 8 #include "cc/test/fake_content_layer_client.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
11 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/impl_side_painting_settings.h" |
12 #include "cc/trees/layer_tree_impl.h" | 13 #include "cc/trees/layer_tree_impl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/skia/include/core/SkDevice.h" | 15 #include "third_party/skia/include/core/SkDevice.h" |
15 #include "ui/gfx/rect_conversions.h" | 16 #include "ui/gfx/rect_conversions.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 namespace { | 19 namespace { |
19 | 20 |
20 class TestablePictureLayerImpl : public PictureLayerImpl { | 21 class TestablePictureLayerImpl : public PictureLayerImpl { |
21 public: | 22 public: |
(...skipping 24 matching lines...) Expand all Loading... |
46 LayerTreeImpl* tree_impl, | 47 LayerTreeImpl* tree_impl, |
47 int id, | 48 int id, |
48 scoped_refptr<PicturePileImpl> pile) | 49 scoped_refptr<PicturePileImpl> pile) |
49 : PictureLayerImpl(tree_impl, id) { | 50 : PictureLayerImpl(tree_impl, id) { |
50 pile_ = pile; | 51 pile_ = pile; |
51 SetBounds(pile_->size()); | 52 SetBounds(pile_->size()); |
52 CreateTilingSet(); | 53 CreateTilingSet(); |
53 } | 54 } |
54 }; | 55 }; |
55 | 56 |
56 class ImplSidePaintingSettings : public LayerTreeSettings { | |
57 public: | |
58 ImplSidePaintingSettings() { | |
59 impl_side_painting = true; | |
60 } | |
61 }; | |
62 | |
63 class TestablePicturePileImpl : public PicturePileImpl { | 57 class TestablePicturePileImpl : public PicturePileImpl { |
64 public: | 58 public: |
65 static scoped_refptr<TestablePicturePileImpl> CreateFilledPile( | 59 static scoped_refptr<TestablePicturePileImpl> CreateFilledPile( |
66 gfx::Size tile_size, | 60 gfx::Size tile_size, |
67 gfx::Size layer_bounds) { | 61 gfx::Size layer_bounds) { |
68 scoped_refptr<TestablePicturePileImpl> pile(new TestablePicturePileImpl()); | 62 scoped_refptr<TestablePicturePileImpl> pile(new TestablePicturePileImpl()); |
69 pile->tiling().SetTotalSize(layer_bounds); | 63 pile->tiling().SetTotalSize(layer_bounds); |
70 pile->tiling().SetMaxTextureSize(tile_size); | 64 pile->tiling().SetMaxTextureSize(tile_size); |
71 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); | 65 pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); |
72 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { | 66 for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 used_tilings.push_back(active_layer_->tilings().tiling_at(1)); | 688 used_tilings.push_back(active_layer_->tilings().tiling_at(1)); |
695 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 689 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
696 ASSERT_EQ(3u, active_layer_->tilings().num_tilings()); | 690 ASSERT_EQ(3u, active_layer_->tilings().num_tilings()); |
697 used_tilings.clear(); | 691 used_tilings.clear(); |
698 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); | 692 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); |
699 ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); | 693 ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); |
700 } | 694 } |
701 | 695 |
702 } // namespace | 696 } // namespace |
703 } // namespace cc | 697 } // namespace cc |
OLD | NEW |