Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture_layer_tiling_set.h" | 5 #include "cc/resources/picture_layer_tiling_set.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 defaults.skewport_target_time_in_seconds, | 27 defaults.skewport_target_time_in_seconds, |
| 28 defaults.skewport_extrapolation_limit_in_content_pixels); | 28 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 29 } | 29 } |
| 30 | 30 |
| 31 TEST(PictureLayerTilingSetTest, NoResources) { | 31 TEST(PictureLayerTilingSetTest, NoResources) { |
| 32 FakePictureLayerTilingClient client; | 32 FakePictureLayerTilingClient client; |
| 33 gfx::Size layer_bounds(1000, 800); | 33 gfx::Size layer_bounds(1000, 800); |
| 34 auto set = CreateTilingSet(&client); | 34 auto set = CreateTilingSet(&client); |
| 35 client.SetTileSize(gfx::Size(256, 256)); | 35 client.SetTileSize(gfx::Size(256, 256)); |
| 36 | 36 |
| 37 set->AddTiling(1.0, layer_bounds); | 37 auto pile = |
|
tfarina
2014/12/19 17:18:11
I know auto is allowed now that we are using C++11
danakj
2014/12/19 17:22:07
FWIW Foo::Create() methods always return smart poi
enne (OOO)
2014/12/19 18:02:55
+1 to auto
tfarina
2014/12/19 18:11:34
Ouch :(
danakj
2014/12/19 18:26:11
Sorry :/ Thank you for bringing it up, we need to
| |
| 38 set->AddTiling(1.5, layer_bounds); | 38 FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds); |
| 39 set->AddTiling(2.0, layer_bounds); | 39 |
| 40 set->AddTiling(1.0, pile); | |
| 41 set->AddTiling(1.5, pile); | |
| 42 set->AddTiling(2.0, pile); | |
| 40 | 43 |
| 41 float contents_scale = 2.0; | 44 float contents_scale = 2.0; |
| 42 gfx::Size content_bounds( | 45 gfx::Size content_bounds( |
| 43 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); | 46 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); |
| 44 gfx::Rect content_rect(content_bounds); | 47 gfx::Rect content_rect(content_bounds); |
| 45 | 48 |
| 46 Region remaining(content_rect); | 49 Region remaining(content_rect); |
| 47 PictureLayerTilingSet::CoverageIterator iter(set.get(), contents_scale, | 50 PictureLayerTilingSet::CoverageIterator iter(set.get(), contents_scale, |
| 48 content_rect, contents_scale); | 51 content_rect, contents_scale); |
| 49 for (; iter; ++iter) { | 52 for (; iter; ++iter) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 62 FakePictureLayerTilingClient client; | 65 FakePictureLayerTilingClient client; |
| 63 gfx::Size layer_bounds(10, 10); | 66 gfx::Size layer_bounds(10, 10); |
| 64 PictureLayerTilingSet::TilingRange higher_than_high_res_range(0, 0); | 67 PictureLayerTilingSet::TilingRange higher_than_high_res_range(0, 0); |
| 65 PictureLayerTilingSet::TilingRange high_res_range(0, 0); | 68 PictureLayerTilingSet::TilingRange high_res_range(0, 0); |
| 66 PictureLayerTilingSet::TilingRange between_high_and_low_res_range(0, 0); | 69 PictureLayerTilingSet::TilingRange between_high_and_low_res_range(0, 0); |
| 67 PictureLayerTilingSet::TilingRange low_res_range(0, 0); | 70 PictureLayerTilingSet::TilingRange low_res_range(0, 0); |
| 68 PictureLayerTilingSet::TilingRange lower_than_low_res_range(0, 0); | 71 PictureLayerTilingSet::TilingRange lower_than_low_res_range(0, 0); |
| 69 PictureLayerTiling* high_res_tiling; | 72 PictureLayerTiling* high_res_tiling; |
| 70 PictureLayerTiling* low_res_tiling; | 73 PictureLayerTiling* low_res_tiling; |
| 71 | 74 |
| 75 auto pile = | |
| 76 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); | |
| 77 | |
| 72 auto set = CreateTilingSet(&client); | 78 auto set = CreateTilingSet(&client); |
| 73 set->AddTiling(2.0, layer_bounds); | 79 set->AddTiling(2.0, pile); |
| 74 high_res_tiling = set->AddTiling(1.0, layer_bounds); | 80 high_res_tiling = set->AddTiling(1.0, pile); |
| 75 high_res_tiling->set_resolution(HIGH_RESOLUTION); | 81 high_res_tiling->set_resolution(HIGH_RESOLUTION); |
| 76 set->AddTiling(0.5, layer_bounds); | 82 set->AddTiling(0.5, pile); |
| 77 low_res_tiling = set->AddTiling(0.25, layer_bounds); | 83 low_res_tiling = set->AddTiling(0.25, pile); |
| 78 low_res_tiling->set_resolution(LOW_RESOLUTION); | 84 low_res_tiling->set_resolution(LOW_RESOLUTION); |
| 79 set->AddTiling(0.125, layer_bounds); | 85 set->AddTiling(0.125, pile); |
| 80 | 86 |
| 81 higher_than_high_res_range = | 87 higher_than_high_res_range = |
| 82 set->GetTilingRange(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); | 88 set->GetTilingRange(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); |
| 83 EXPECT_EQ(0u, higher_than_high_res_range.start); | 89 EXPECT_EQ(0u, higher_than_high_res_range.start); |
| 84 EXPECT_EQ(1u, higher_than_high_res_range.end); | 90 EXPECT_EQ(1u, higher_than_high_res_range.end); |
| 85 | 91 |
| 86 high_res_range = set->GetTilingRange(PictureLayerTilingSet::HIGH_RES); | 92 high_res_range = set->GetTilingRange(PictureLayerTilingSet::HIGH_RES); |
| 87 EXPECT_EQ(1u, high_res_range.start); | 93 EXPECT_EQ(1u, high_res_range.start); |
| 88 EXPECT_EQ(2u, high_res_range.end); | 94 EXPECT_EQ(2u, high_res_range.end); |
| 89 | 95 |
| 90 between_high_and_low_res_range = | 96 between_high_and_low_res_range = |
| 91 set->GetTilingRange(PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); | 97 set->GetTilingRange(PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); |
| 92 EXPECT_EQ(2u, between_high_and_low_res_range.start); | 98 EXPECT_EQ(2u, between_high_and_low_res_range.start); |
| 93 EXPECT_EQ(3u, between_high_and_low_res_range.end); | 99 EXPECT_EQ(3u, between_high_and_low_res_range.end); |
| 94 | 100 |
| 95 low_res_range = set->GetTilingRange(PictureLayerTilingSet::LOW_RES); | 101 low_res_range = set->GetTilingRange(PictureLayerTilingSet::LOW_RES); |
| 96 EXPECT_EQ(3u, low_res_range.start); | 102 EXPECT_EQ(3u, low_res_range.start); |
| 97 EXPECT_EQ(4u, low_res_range.end); | 103 EXPECT_EQ(4u, low_res_range.end); |
| 98 | 104 |
| 99 lower_than_low_res_range = | 105 lower_than_low_res_range = |
| 100 set->GetTilingRange(PictureLayerTilingSet::LOWER_THAN_LOW_RES); | 106 set->GetTilingRange(PictureLayerTilingSet::LOWER_THAN_LOW_RES); |
| 101 EXPECT_EQ(4u, lower_than_low_res_range.start); | 107 EXPECT_EQ(4u, lower_than_low_res_range.start); |
| 102 EXPECT_EQ(5u, lower_than_low_res_range.end); | 108 EXPECT_EQ(5u, lower_than_low_res_range.end); |
| 103 | 109 |
| 104 auto set_without_low_res = CreateTilingSet(&client); | 110 auto set_without_low_res = CreateTilingSet(&client); |
| 105 set_without_low_res->AddTiling(2.0, layer_bounds); | 111 set_without_low_res->AddTiling(2.0, pile); |
| 106 high_res_tiling = set_without_low_res->AddTiling(1.0, layer_bounds); | 112 high_res_tiling = set_without_low_res->AddTiling(1.0, pile); |
| 107 high_res_tiling->set_resolution(HIGH_RESOLUTION); | 113 high_res_tiling->set_resolution(HIGH_RESOLUTION); |
| 108 set_without_low_res->AddTiling(0.5, layer_bounds); | 114 set_without_low_res->AddTiling(0.5, pile); |
| 109 set_without_low_res->AddTiling(0.25, layer_bounds); | 115 set_without_low_res->AddTiling(0.25, pile); |
| 110 | 116 |
| 111 higher_than_high_res_range = set_without_low_res->GetTilingRange( | 117 higher_than_high_res_range = set_without_low_res->GetTilingRange( |
| 112 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); | 118 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); |
| 113 EXPECT_EQ(0u, higher_than_high_res_range.start); | 119 EXPECT_EQ(0u, higher_than_high_res_range.start); |
| 114 EXPECT_EQ(1u, higher_than_high_res_range.end); | 120 EXPECT_EQ(1u, higher_than_high_res_range.end); |
| 115 | 121 |
| 116 high_res_range = | 122 high_res_range = |
| 117 set_without_low_res->GetTilingRange(PictureLayerTilingSet::HIGH_RES); | 123 set_without_low_res->GetTilingRange(PictureLayerTilingSet::HIGH_RES); |
| 118 EXPECT_EQ(1u, high_res_range.start); | 124 EXPECT_EQ(1u, high_res_range.start); |
| 119 EXPECT_EQ(2u, high_res_range.end); | 125 EXPECT_EQ(2u, high_res_range.end); |
| 120 | 126 |
| 121 between_high_and_low_res_range = set_without_low_res->GetTilingRange( | 127 between_high_and_low_res_range = set_without_low_res->GetTilingRange( |
| 122 PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); | 128 PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); |
| 123 EXPECT_EQ(2u, between_high_and_low_res_range.start); | 129 EXPECT_EQ(2u, between_high_and_low_res_range.start); |
| 124 EXPECT_EQ(4u, between_high_and_low_res_range.end); | 130 EXPECT_EQ(4u, between_high_and_low_res_range.end); |
| 125 | 131 |
| 126 low_res_range = | 132 low_res_range = |
| 127 set_without_low_res->GetTilingRange(PictureLayerTilingSet::LOW_RES); | 133 set_without_low_res->GetTilingRange(PictureLayerTilingSet::LOW_RES); |
| 128 EXPECT_EQ(0u, low_res_range.end - low_res_range.start); | 134 EXPECT_EQ(0u, low_res_range.end - low_res_range.start); |
| 129 | 135 |
| 130 lower_than_low_res_range = set_without_low_res->GetTilingRange( | 136 lower_than_low_res_range = set_without_low_res->GetTilingRange( |
| 131 PictureLayerTilingSet::LOWER_THAN_LOW_RES); | 137 PictureLayerTilingSet::LOWER_THAN_LOW_RES); |
| 132 EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start); | 138 EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start); |
| 133 | 139 |
| 134 auto set_with_only_high_and_low_res = CreateTilingSet(&client); | 140 auto set_with_only_high_and_low_res = CreateTilingSet(&client); |
| 135 high_res_tiling = | 141 high_res_tiling = set_with_only_high_and_low_res->AddTiling(1.0, pile); |
| 136 set_with_only_high_and_low_res->AddTiling(1.0, layer_bounds); | |
| 137 high_res_tiling->set_resolution(HIGH_RESOLUTION); | 142 high_res_tiling->set_resolution(HIGH_RESOLUTION); |
| 138 low_res_tiling = set_with_only_high_and_low_res->AddTiling(0.5, layer_bounds); | 143 low_res_tiling = set_with_only_high_and_low_res->AddTiling(0.5, pile); |
| 139 low_res_tiling->set_resolution(LOW_RESOLUTION); | 144 low_res_tiling->set_resolution(LOW_RESOLUTION); |
| 140 | 145 |
| 141 higher_than_high_res_range = set_with_only_high_and_low_res->GetTilingRange( | 146 higher_than_high_res_range = set_with_only_high_and_low_res->GetTilingRange( |
| 142 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); | 147 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); |
| 143 EXPECT_EQ(0u, | 148 EXPECT_EQ(0u, |
| 144 higher_than_high_res_range.end - higher_than_high_res_range.start); | 149 higher_than_high_res_range.end - higher_than_high_res_range.start); |
| 145 | 150 |
| 146 high_res_range = set_with_only_high_and_low_res->GetTilingRange( | 151 high_res_range = set_with_only_high_and_low_res->GetTilingRange( |
| 147 PictureLayerTilingSet::HIGH_RES); | 152 PictureLayerTilingSet::HIGH_RES); |
| 148 EXPECT_EQ(0u, high_res_range.start); | 153 EXPECT_EQ(0u, high_res_range.start); |
| 149 EXPECT_EQ(1u, high_res_range.end); | 154 EXPECT_EQ(1u, high_res_range.end); |
| 150 | 155 |
| 151 between_high_and_low_res_range = | 156 between_high_and_low_res_range = |
| 152 set_with_only_high_and_low_res->GetTilingRange( | 157 set_with_only_high_and_low_res->GetTilingRange( |
| 153 PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); | 158 PictureLayerTilingSet::BETWEEN_HIGH_AND_LOW_RES); |
| 154 EXPECT_EQ(0u, between_high_and_low_res_range.end - | 159 EXPECT_EQ(0u, between_high_and_low_res_range.end - |
| 155 between_high_and_low_res_range.start); | 160 between_high_and_low_res_range.start); |
| 156 | 161 |
| 157 low_res_range = set_with_only_high_and_low_res->GetTilingRange( | 162 low_res_range = set_with_only_high_and_low_res->GetTilingRange( |
| 158 PictureLayerTilingSet::LOW_RES); | 163 PictureLayerTilingSet::LOW_RES); |
| 159 EXPECT_EQ(1u, low_res_range.start); | 164 EXPECT_EQ(1u, low_res_range.start); |
| 160 EXPECT_EQ(2u, low_res_range.end); | 165 EXPECT_EQ(2u, low_res_range.end); |
| 161 | 166 |
| 162 lower_than_low_res_range = set_with_only_high_and_low_res->GetTilingRange( | 167 lower_than_low_res_range = set_with_only_high_and_low_res->GetTilingRange( |
| 163 PictureLayerTilingSet::LOWER_THAN_LOW_RES); | 168 PictureLayerTilingSet::LOWER_THAN_LOW_RES); |
| 164 EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start); | 169 EXPECT_EQ(0u, lower_than_low_res_range.end - lower_than_low_res_range.start); |
| 165 | 170 |
| 166 auto set_with_only_high_res = CreateTilingSet(&client); | 171 auto set_with_only_high_res = CreateTilingSet(&client); |
| 167 high_res_tiling = set_with_only_high_res->AddTiling(1.0, layer_bounds); | 172 high_res_tiling = set_with_only_high_res->AddTiling(1.0, pile); |
| 168 high_res_tiling->set_resolution(HIGH_RESOLUTION); | 173 high_res_tiling->set_resolution(HIGH_RESOLUTION); |
| 169 | 174 |
| 170 higher_than_high_res_range = set_with_only_high_res->GetTilingRange( | 175 higher_than_high_res_range = set_with_only_high_res->GetTilingRange( |
| 171 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); | 176 PictureLayerTilingSet::HIGHER_THAN_HIGH_RES); |
| 172 EXPECT_EQ(0u, | 177 EXPECT_EQ(0u, |
| 173 higher_than_high_res_range.end - higher_than_high_res_range.start); | 178 higher_than_high_res_range.end - higher_than_high_res_range.start); |
| 174 | 179 |
| 175 high_res_range = | 180 high_res_range = |
| 176 set_with_only_high_res->GetTilingRange(PictureLayerTilingSet::HIGH_RES); | 181 set_with_only_high_res->GetTilingRange(PictureLayerTilingSet::HIGH_RES); |
| 177 EXPECT_EQ(0u, high_res_range.start); | 182 EXPECT_EQ(0u, high_res_range.start); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 NULL, | 218 NULL, |
| 214 0, | 219 0, |
| 215 false, | 220 false, |
| 216 1); | 221 1); |
| 217 | 222 |
| 218 FakePictureLayerTilingClient client(resource_provider.get()); | 223 FakePictureLayerTilingClient client(resource_provider.get()); |
| 219 client.SetTileSize(gfx::Size(256, 256)); | 224 client.SetTileSize(gfx::Size(256, 256)); |
| 220 client.set_tree(PENDING_TREE); | 225 client.set_tree(PENDING_TREE); |
| 221 gfx::Size layer_bounds(1000, 800); | 226 gfx::Size layer_bounds(1000, 800); |
| 222 auto set = CreateTilingSet(&client); | 227 auto set = CreateTilingSet(&client); |
| 228 auto pile = | |
| 229 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); | |
| 223 | 230 |
| 224 float scale = min_scale; | 231 float scale = min_scale; |
| 225 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { | 232 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { |
| 226 PictureLayerTiling* tiling = set->AddTiling(scale, layer_bounds); | 233 PictureLayerTiling* tiling = set->AddTiling(scale, pile); |
| 227 tiling->CreateAllTilesForTesting(); | 234 tiling->CreateAllTilesForTesting(); |
| 228 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 235 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 229 client.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 236 client.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
| 230 } | 237 } |
| 231 | 238 |
| 232 float max_contents_scale = scale; | 239 float max_contents_scale = scale; |
| 233 gfx::Size content_bounds( | 240 gfx::Size content_bounds( |
| 234 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); | 241 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); |
| 235 gfx::Rect content_rect(content_bounds); | 242 gfx::Rect content_rect(content_bounds); |
| 236 | 243 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 TEST(PictureLayerTilingSetTest, TileSizeChange) { | 298 TEST(PictureLayerTilingSetTest, TileSizeChange) { |
| 292 FakePictureLayerTilingClient pending_client; | 299 FakePictureLayerTilingClient pending_client; |
| 293 FakePictureLayerTilingClient active_client; | 300 FakePictureLayerTilingClient active_client; |
| 294 auto pending_set = | 301 auto pending_set = |
| 295 PictureLayerTilingSet::Create(&pending_client, 1000, 1.f, 1000); | 302 PictureLayerTilingSet::Create(&pending_client, 1000, 1.f, 1000); |
| 296 auto active_set = | 303 auto active_set = |
| 297 PictureLayerTilingSet::Create(&active_client, 1000, 1.f, 1000); | 304 PictureLayerTilingSet::Create(&active_client, 1000, 1.f, 1000); |
| 298 | 305 |
| 299 gfx::Size layer_bounds(100, 100); | 306 gfx::Size layer_bounds(100, 100); |
| 300 auto pile = | 307 auto pile = |
| 301 FakePicturePileImpl::CreateEmptyPile(gfx::Size(77, 77), layer_bounds); | 308 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds); |
| 302 | 309 |
| 303 gfx::Size tile_size1(10, 10); | 310 gfx::Size tile_size1(10, 10); |
| 304 gfx::Size tile_size2(30, 30); | 311 gfx::Size tile_size2(30, 30); |
| 305 gfx::Size tile_size3(20, 20); | 312 gfx::Size tile_size3(20, 20); |
| 306 | 313 |
| 307 pending_client.SetTileSize(tile_size1); | 314 pending_client.SetTileSize(tile_size1); |
| 308 pending_set->AddTiling(1.f, layer_bounds); | 315 pending_set->AddTiling(1.f, pile); |
| 309 // New tilings get the correct tile size. | 316 // New tilings get the correct tile size. |
| 310 EXPECT_EQ(tile_size1, pending_set->tiling_at(0)->tile_size()); | 317 EXPECT_EQ(tile_size1, pending_set->tiling_at(0)->tile_size()); |
| 311 | 318 |
| 312 // Set some expected things for the tiling set to function. | 319 // Set some expected things for the tiling set to function. |
| 313 pending_set->tiling_at(0)->set_resolution(HIGH_RESOLUTION); | 320 pending_set->tiling_at(0)->set_resolution(HIGH_RESOLUTION); |
| 314 active_client.set_twin_tiling_set(pending_set.get()); | 321 active_client.set_twin_tiling_set(pending_set.get()); |
| 315 | 322 |
| 316 // Set a priority rect so we get tiles. | 323 // Set a priority rect so we get tiles. |
| 317 pending_set->UpdateTilePriorities(gfx::Rect(layer_bounds), 1.f, 1.0, | 324 pending_set->UpdateTilePriorities(gfx::Rect(layer_bounds), 1.f, 1.0, |
| 318 Occlusion(), false); | 325 Occlusion(), false); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 TEST(PictureLayerTilingSetTest, MaxContentScale) { | 399 TEST(PictureLayerTilingSetTest, MaxContentScale) { |
| 393 FakePictureLayerTilingClient pending_client; | 400 FakePictureLayerTilingClient pending_client; |
| 394 FakePictureLayerTilingClient active_client; | 401 FakePictureLayerTilingClient active_client; |
| 395 auto pending_set = | 402 auto pending_set = |
| 396 PictureLayerTilingSet::Create(&pending_client, 1000, 1.f, 1000); | 403 PictureLayerTilingSet::Create(&pending_client, 1000, 1.f, 1000); |
| 397 auto active_set = | 404 auto active_set = |
| 398 PictureLayerTilingSet::Create(&active_client, 1000, 1.f, 1000); | 405 PictureLayerTilingSet::Create(&active_client, 1000, 1.f, 1000); |
| 399 | 406 |
| 400 gfx::Size layer_bounds(100, 105); | 407 gfx::Size layer_bounds(100, 105); |
| 401 auto pile = | 408 auto pile = |
| 402 FakePicturePileImpl::CreateEmptyPile(gfx::Size(77, 77), layer_bounds); | 409 FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds); |
| 403 | 410 |
| 404 // Tilings can be added of any scale, the tiling client can controls this. | 411 // Tilings can be added of any scale, the tiling client can controls this. |
| 405 pending_set->AddTiling(1.f, layer_bounds); | 412 pending_set->AddTiling(1.f, pile); |
| 406 pending_set->AddTiling(2.f, layer_bounds); | 413 pending_set->AddTiling(2.f, pile); |
| 407 pending_set->AddTiling(3.f, layer_bounds); | 414 pending_set->AddTiling(3.f, pile); |
| 408 | 415 |
| 409 // Set some expected things for the tiling set to function. | 416 // Set some expected things for the tiling set to function. |
| 410 pending_set->tiling_at(0)->set_resolution(HIGH_RESOLUTION); | 417 pending_set->tiling_at(0)->set_resolution(HIGH_RESOLUTION); |
| 411 active_client.set_twin_tiling_set(pending_set.get()); | 418 active_client.set_twin_tiling_set(pending_set.get()); |
| 412 | 419 |
| 413 // Update to a new source frame with a max content scale that is larger than | 420 // Update to a new source frame with a max content scale that is larger than |
| 414 // everything. | 421 // everything. |
| 415 float max_content_scale = 3.f; | 422 float max_content_scale = 3.f; |
| 416 pending_set->UpdateTilingsToCurrentRasterSource(pile.get(), nullptr, Region(), | 423 pending_set->UpdateTilingsToCurrentRasterSource(pile.get(), nullptr, Region(), |
| 417 1.f, max_content_scale); | 424 1.f, max_content_scale); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 436 | 443 |
| 437 // Clone from the pending to the active tree with the same max content size. | 444 // Clone from the pending to the active tree with the same max content size. |
| 438 active_set->UpdateTilingsToCurrentRasterSource( | 445 active_set->UpdateTilingsToCurrentRasterSource( |
| 439 pile.get(), pending_set.get(), Region(), 1.f, max_content_scale); | 446 pile.get(), pending_set.get(), Region(), 1.f, max_content_scale); |
| 440 // All the tilings are on the active tree. | 447 // All the tilings are on the active tree. |
| 441 EXPECT_EQ(2u, active_set->num_tilings()); | 448 EXPECT_EQ(2u, active_set->num_tilings()); |
| 442 } | 449 } |
| 443 | 450 |
| 444 } // namespace | 451 } // namespace |
| 445 } // namespace cc | 452 } // namespace cc |
| OLD | NEW |