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.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/resources/resource_update_queue.h" | 9 #include "cc/resources/resource_update_queue.h" |
10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Layer is suitable for gpu rasterization by default. | 77 // Layer is suitable for gpu rasterization by default. |
78 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 78 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
79 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 79 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
80 | 80 |
81 // Veto gpu rasterization. | 81 // Veto gpu rasterization. |
82 pile->SetUnsuitableForGpuRasterizationForTesting(); | 82 pile->SetUnsuitableForGpuRasterizationForTesting(); |
83 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); | 83 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); |
84 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 84 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
85 } | 85 } |
86 | 86 |
| 87 TEST(PictureLayerTest, UseTileGridSize) { |
| 88 LayerTreeSettings settings; |
| 89 settings.default_tile_grid_size = gfx::Size(123, 123); |
| 90 |
| 91 MockContentLayerClient client; |
| 92 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 93 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 94 scoped_ptr<FakeLayerTreeHost> host = |
| 95 FakeLayerTreeHost::Create(&host_client, settings); |
| 96 host->SetRootLayer(layer); |
| 97 |
| 98 // Tile-grid is set according to its setting. |
| 99 SkTileGridFactory::TileGridInfo info = |
| 100 layer->GetPicturePileForTesting()->GetTileGridInfoForTesting(); |
| 101 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width()); |
| 102 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height()); |
| 103 } |
| 104 |
87 } // namespace | 105 } // namespace |
88 } // namespace cc | 106 } // namespace cc |
OLD | NEW |