| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 float scale_increment, | 189 float scale_increment, |
| 190 float ideal_contents_scale, | 190 float ideal_contents_scale, |
| 191 float expected_scale) { | 191 float expected_scale) { |
| 192 FakeOutputSurfaceClient output_surface_client; | 192 FakeOutputSurfaceClient output_surface_client; |
| 193 scoped_ptr<FakeOutputSurface> output_surface = | 193 scoped_ptr<FakeOutputSurface> output_surface = |
| 194 FakeOutputSurface::Create3d(); | 194 FakeOutputSurface::Create3d(); |
| 195 CHECK(output_surface->BindToClient(&output_surface_client)); | 195 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 196 | 196 |
| 197 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 197 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 198 new TestSharedBitmapManager()); | 198 new TestSharedBitmapManager()); |
| 199 scoped_ptr<ResourceProvider> resource_provider = | 199 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( |
| 200 ResourceProvider::Create(output_surface.get(), | 200 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
| 201 shared_bitmap_manager.get(), | 201 false, 1); |
| 202 NULL, | |
| 203 NULL, | |
| 204 0, | |
| 205 false, | |
| 206 1); | |
| 207 | 202 |
| 208 FakePictureLayerTilingClient client(resource_provider.get()); | 203 FakePictureLayerTilingClient client(resource_provider.get()); |
| 209 client.SetTileSize(gfx::Size(256, 256)); | 204 client.SetTileSize(gfx::Size(256, 256)); |
| 210 client.set_tree(PENDING_TREE); | 205 client.set_tree(PENDING_TREE); |
| 211 gfx::Size layer_bounds(1000, 800); | 206 gfx::Size layer_bounds(1000, 800); |
| 212 auto set = PictureLayerTilingSet::Create(&client); | 207 auto set = PictureLayerTilingSet::Create(&client); |
| 213 | 208 |
| 214 float scale = min_scale; | 209 float scale = min_scale; |
| 215 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { | 210 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { |
| 216 PictureLayerTiling* tiling = set->AddTiling(scale, layer_bounds); | 211 PictureLayerTiling* tiling = set->AddTiling(scale, layer_bounds); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // Sync from source to target. | 290 // Sync from source to target. |
| 296 void SyncTilings(const gfx::Size& new_bounds, | 291 void SyncTilings(const gfx::Size& new_bounds, |
| 297 const Region& invalidation, | 292 const Region& invalidation, |
| 298 float minimum_scale) { | 293 float minimum_scale) { |
| 299 for (size_t i = 0; i < source_->num_tilings(); ++i) | 294 for (size_t i = 0; i < source_->num_tilings(); ++i) |
| 300 source_->tiling_at(i)->CreateAllTilesForTesting(); | 295 source_->tiling_at(i)->CreateAllTilesForTesting(); |
| 301 for (size_t i = 0; i < target_->num_tilings(); ++i) | 296 for (size_t i = 0; i < target_->num_tilings(); ++i) |
| 302 target_->tiling_at(i)->CreateAllTilesForTesting(); | 297 target_->tiling_at(i)->CreateAllTilesForTesting(); |
| 303 | 298 |
| 304 target_->SyncTilings(*source_.get(), new_bounds, invalidation, | 299 target_->SyncTilings(*source_.get(), new_bounds, invalidation, |
| 305 minimum_scale, target_client_.raster_source()); | 300 minimum_scale, target_client_.raster_source(), |
| 301 base::TimeTicks()); |
| 306 } | 302 } |
| 307 void SyncTilings(const gfx::Size& new_bounds) { | 303 void SyncTilings(const gfx::Size& new_bounds) { |
| 308 Region invalidation; | 304 Region invalidation; |
| 309 SyncTilings(new_bounds, invalidation, 0.f); | 305 SyncTilings(new_bounds, invalidation, 0.f); |
| 310 } | 306 } |
| 311 void SyncTilings(const gfx::Size& new_bounds, const Region& invalidation) { | 307 void SyncTilings(const gfx::Size& new_bounds, const Region& invalidation) { |
| 312 SyncTilings(new_bounds, invalidation, 0.f); | 308 SyncTilings(new_bounds, invalidation, 0.f); |
| 313 } | 309 } |
| 314 void SyncTilings(const gfx::Size& new_bounds, float minimum_scale) { | 310 void SyncTilings(const gfx::Size& new_bounds, float minimum_scale) { |
| 315 Region invalidation; | 311 Region invalidation; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); | 542 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); |
| 547 for (size_t i = 0; i < original_tiles.size(); ++i) { | 543 for (size_t i = 0; i < original_tiles.size(); ++i) { |
| 548 std::vector<Tile*>::iterator find = | 544 std::vector<Tile*>::iterator find = |
| 549 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); | 545 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); |
| 550 EXPECT_TRUE(find == new_tiles.end()); | 546 EXPECT_TRUE(find == new_tiles.end()); |
| 551 } | 547 } |
| 552 } | 548 } |
| 553 | 549 |
| 554 } // namespace | 550 } // namespace |
| 555 } // namespace cc | 551 } // namespace cc |
| OLD | NEW |