| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 FakeLayerTreeHost::Create(&host_client, settings); | 94 FakeLayerTreeHost::Create(&host_client, settings); |
| 95 host->SetRootLayer(layer); | 95 host->SetRootLayer(layer); |
| 96 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode()); | 96 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode()); |
| 97 | 97 |
| 98 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord; | 98 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord; |
| 99 host = FakeLayerTreeHost::Create(&host_client, settings); | 99 host = FakeLayerTreeHost::Create(&host_client, settings); |
| 100 host->SetRootLayer(layer); | 100 host->SetRootLayer(layer); |
| 101 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode()); | 101 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST(PictureLayerTest, UseTileGridSize) { |
| 105 LayerTreeSettings settings; |
| 106 settings.default_tile_grid_size = gfx::Size(123, 123); |
| 107 |
| 108 MockContentLayerClient client; |
| 109 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 110 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 111 scoped_ptr<FakeLayerTreeHost> host = |
| 112 FakeLayerTreeHost::Create(&host_client, settings); |
| 113 host->SetRootLayer(layer); |
| 114 |
| 115 // Tile-grid is set according to its setting. |
| 116 SkTileGridFactory::TileGridInfo info = |
| 117 layer->GetPicturePileForTesting()->GetTileGridInfoForTesting(); |
| 118 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width()); |
| 119 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height()); |
| 120 } |
| 121 |
| 104 } // namespace | 122 } // namespace |
| 105 } // namespace cc | 123 } // namespace cc |
| OLD | NEW |