Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: cc/resources/picture_layer_tiling_set_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698