| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 if (target_->num_tilings() > 0) { | 347 if (target_->num_tilings() > 0) { |
| 348 float last_scale = target_->tiling_at(0)->contents_scale(); | 348 float last_scale = target_->tiling_at(0)->contents_scale(); |
| 349 for (size_t i = 1; i < target_->num_tilings(); ++i) { | 349 for (size_t i = 1; i < target_->num_tilings(); ++i) { |
| 350 const PictureLayerTiling* target_tiling = target_->tiling_at(i); | 350 const PictureLayerTiling* target_tiling = target_->tiling_at(i); |
| 351 EXPECT_LT(target_tiling->contents_scale(), last_scale); | 351 EXPECT_LT(target_tiling->contents_scale(), last_scale); |
| 352 last_scale = target_tiling->contents_scale(); | 352 last_scale = target_tiling->contents_scale(); |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 for (size_t i = 0; i < target_->num_tilings(); ++i) | 356 for (size_t i = 0; i < target_->num_tilings(); ++i) |
| 357 ValidateTiling(target_->tiling_at(i), target_client_.GetPile()); | 357 ValidateTiling(target_->tiling_at(i), target_client_.GetRasterSource()); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void ValidateTiling(const PictureLayerTiling* tiling, | 360 void ValidateTiling(const PictureLayerTiling* tiling, |
| 361 const PicturePileImpl* pile) { | 361 const RasterSource* raster_source) { |
| 362 if (tiling->tiling_size().IsEmpty()) { | 362 if (tiling->tiling_size().IsEmpty()) { |
| 363 EXPECT_TRUE(tiling->live_tiles_rect().IsEmpty()); | 363 EXPECT_TRUE(tiling->live_tiles_rect().IsEmpty()); |
| 364 } else if (!tiling->live_tiles_rect().IsEmpty()) { | 364 } else if (!tiling->live_tiles_rect().IsEmpty()) { |
| 365 gfx::Rect tiling_rect(tiling->tiling_size()); | 365 gfx::Rect tiling_rect(tiling->tiling_size()); |
| 366 EXPECT_TRUE(tiling_rect.Contains(tiling->live_tiles_rect())); | 366 EXPECT_TRUE(tiling_rect.Contains(tiling->live_tiles_rect())); |
| 367 } | 367 } |
| 368 | 368 |
| 369 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 369 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 370 for (size_t i = 0; i < tiles.size(); ++i) { | 370 for (size_t i = 0; i < tiles.size(); ++i) { |
| 371 const Tile* tile = tiles[i]; | 371 const Tile* tile = tiles[i]; |
| 372 ASSERT_TRUE(!!tile); | 372 ASSERT_TRUE(!!tile); |
| 373 EXPECT_EQ(tile->picture_pile(), pile); | 373 EXPECT_EQ(tile->raster_source(), raster_source); |
| 374 EXPECT_TRUE(tile->content_rect().Intersects(tiling->live_tiles_rect())) | 374 EXPECT_TRUE(tile->content_rect().Intersects(tiling->live_tiles_rect())) |
| 375 << "All tiles must be inside the live tiles rect." | 375 << "All tiles must be inside the live tiles rect." |
| 376 << " Tile rect: " << tile->content_rect().ToString() | 376 << " Tile rect: " << tile->content_rect().ToString() |
| 377 << " Live rect: " << tiling->live_tiles_rect().ToString() | 377 << " Live rect: " << tiling->live_tiles_rect().ToString() |
| 378 << " Scale: " << tiling->contents_scale(); | 378 << " Scale: " << tiling->contents_scale(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 for (PictureLayerTiling::CoverageIterator iter( | 381 for (PictureLayerTiling::CoverageIterator iter( |
| 382 tiling, tiling->contents_scale(), tiling->live_tiles_rect()); | 382 tiling, tiling->contents_scale(), tiling->live_tiles_rect()); |
| 383 iter; | 383 iter; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); | 553 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); |
| 554 for (size_t i = 0; i < original_tiles.size(); ++i) { | 554 for (size_t i = 0; i < original_tiles.size(); ++i) { |
| 555 std::vector<Tile*>::iterator find = | 555 std::vector<Tile*>::iterator find = |
| 556 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); | 556 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); |
| 557 EXPECT_TRUE(find == new_tiles.end()); | 557 EXPECT_TRUE(find == new_tiles.end()); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace | 561 } // namespace |
| 562 } // namespace cc | 562 } // namespace cc |
| OLD | NEW |