| 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_pool.h" | 10 #include "cc/resources/resource_pool.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 FakeOutputSurfaceClient output_surface_client; | 198 FakeOutputSurfaceClient output_surface_client; |
| 199 scoped_ptr<FakeOutputSurface> output_surface = | 199 scoped_ptr<FakeOutputSurface> output_surface = |
| 200 FakeOutputSurface::Create3d(); | 200 FakeOutputSurface::Create3d(); |
| 201 CHECK(output_surface->BindToClient(&output_surface_client)); | 201 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 202 | 202 |
| 203 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 203 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 204 new TestSharedBitmapManager()); | 204 new TestSharedBitmapManager()); |
| 205 scoped_ptr<ResourceProvider> resource_provider = | 205 scoped_ptr<ResourceProvider> resource_provider = |
| 206 ResourceProvider::Create(output_surface.get(), | 206 ResourceProvider::Create(output_surface.get(), |
| 207 shared_bitmap_manager.get(), | 207 shared_bitmap_manager.get(), |
| 208 NULL, | 208 nullptr, |
| 209 0, | 209 0, |
| 210 false, | 210 false, |
| 211 1, | 211 1, |
| 212 false); | 212 false); |
| 213 | 213 |
| 214 FakePictureLayerTilingClient client(resource_provider.get()); | 214 FakePictureLayerTilingClient client(resource_provider.get()); |
| 215 client.SetTileSize(gfx::Size(256, 256)); | 215 client.SetTileSize(gfx::Size(256, 256)); |
| 216 client.set_tree(PENDING_TREE); | 216 client.set_tree(PENDING_TREE); |
| 217 gfx::Size layer_bounds(1000, 800); | 217 gfx::Size layer_bounds(1000, 800); |
| 218 PictureLayerTilingSet set(&client, layer_bounds); | 218 PictureLayerTilingSet set(&client, layer_bounds); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 SyncTilings(new_bounds); | 423 SyncTilings(new_bounds); |
| 424 VerifyTargetEqualsSource(new_bounds); | 424 VerifyTargetEqualsSource(new_bounds); |
| 425 } | 425 } |
| 426 | 426 |
| 427 Tile* FindTileAtOrigin(PictureLayerTiling* tiling) { | 427 Tile* FindTileAtOrigin(PictureLayerTiling* tiling) { |
| 428 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 428 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 429 for (size_t i = 0; i < tiles.size(); ++i) { | 429 for (size_t i = 0; i < tiles.size(); ++i) { |
| 430 if (tiles[i]->content_rect().origin() == gfx::Point()) | 430 if (tiles[i]->content_rect().origin() == gfx::Point()) |
| 431 return tiles[i]; | 431 return tiles[i]; |
| 432 } | 432 } |
| 433 return NULL; | 433 return nullptr; |
| 434 } | 434 } |
| 435 | 435 |
| 436 TEST_F(PictureLayerTilingSetSyncTest, KeepExisting) { | 436 TEST_F(PictureLayerTilingSetSyncTest, KeepExisting) { |
| 437 float source_scales[] = {0.7f, 1.f, 1.1f, 2.f}; | 437 float source_scales[] = {0.7f, 1.f, 1.1f, 2.f}; |
| 438 for (size_t i = 0; i < arraysize(source_scales); ++i) | 438 for (size_t i = 0; i < arraysize(source_scales); ++i) |
| 439 source_->AddTiling(source_scales[i]); | 439 source_->AddTiling(source_scales[i]); |
| 440 float target_scales[] = {0.5f, 1.f, 2.f}; | 440 float target_scales[] = {0.5f, 1.f, 2.f}; |
| 441 for (size_t i = 0; i < arraysize(target_scales); ++i) | 441 for (size_t i = 0; i < arraysize(target_scales); ++i) |
| 442 target_->AddTiling(target_scales[i]); | 442 target_->AddTiling(target_scales[i]); |
| 443 | 443 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); | 557 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); |
| 558 for (size_t i = 0; i < original_tiles.size(); ++i) { | 558 for (size_t i = 0; i < original_tiles.size(); ++i) { |
| 559 std::vector<Tile*>::iterator find = | 559 std::vector<Tile*>::iterator find = |
| 560 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); | 560 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); |
| 561 EXPECT_TRUE(find == new_tiles.end()); | 561 EXPECT_TRUE(find == new_tiles.end()); |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace | 565 } // namespace |
| 566 } // namespace cc | 566 } // namespace cc |
| OLD | NEW |