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

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

Issue 389973004: cc: Give TilingData back a Size instead of a Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tilingsize: comments Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('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_pool.h" 10 #include "cc/resources/resource_pool.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 last_scale = target_tiling->contents_scale(); 212 last_scale = target_tiling->contents_scale();
213 } 213 }
214 } 214 }
215 215
216 for (size_t i = 0; i < target_->num_tilings(); ++i) 216 for (size_t i = 0; i < target_->num_tilings(); ++i)
217 ValidateTiling(target_->tiling_at(i), target_client_.GetPile()); 217 ValidateTiling(target_->tiling_at(i), target_client_.GetPile());
218 } 218 }
219 219
220 void ValidateTiling(const PictureLayerTiling* tiling, 220 void ValidateTiling(const PictureLayerTiling* tiling,
221 const PicturePileImpl* pile) { 221 const PicturePileImpl* pile) {
222 if (tiling->TilingRect().IsEmpty()) 222 if (tiling->tiling_size().IsEmpty()) {
223 EXPECT_TRUE(tiling->live_tiles_rect().IsEmpty()); 223 EXPECT_TRUE(tiling->live_tiles_rect().IsEmpty());
224 else if (!tiling->live_tiles_rect().IsEmpty()) 224 } else if (!tiling->live_tiles_rect().IsEmpty()) {
225 EXPECT_TRUE(tiling->TilingRect().Contains(tiling->live_tiles_rect())); 225 gfx::Rect tiling_rect(tiling->tiling_size());
226 EXPECT_TRUE(tiling_rect.Contains(tiling->live_tiles_rect()));
227 }
226 228
227 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); 229 std::vector<Tile*> tiles = tiling->AllTilesForTesting();
228 for (size_t i = 0; i < tiles.size(); ++i) { 230 for (size_t i = 0; i < tiles.size(); ++i) {
229 const Tile* tile = tiles[i]; 231 const Tile* tile = tiles[i];
230 ASSERT_TRUE(!!tile); 232 ASSERT_TRUE(!!tile);
231 EXPECT_EQ(tile->picture_pile(), pile); 233 EXPECT_EQ(tile->picture_pile(), pile);
232 EXPECT_TRUE(tile->content_rect().Intersects(tiling->live_tiles_rect())) 234 EXPECT_TRUE(tile->content_rect().Intersects(tiling->live_tiles_rect()))
233 << "All tiles must be inside the live tiles rect." 235 << "All tiles must be inside the live tiles rect."
234 << " Tile rect: " << tile->content_rect().ToString() 236 << " Tile rect: " << tile->content_rect().ToString()
235 << " Live rect: " << tiling->live_tiles_rect().ToString() 237 << " Live rect: " << tiling->live_tiles_rect().ToString()
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); 414 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting();
413 for (size_t i = 0; i < original_tiles.size(); ++i) { 415 for (size_t i = 0; i < original_tiles.size(); ++i) {
414 std::vector<Tile*>::iterator find = 416 std::vector<Tile*>::iterator find =
415 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); 417 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]);
416 EXPECT_TRUE(find == new_tiles.end()); 418 EXPECT_TRUE(find == new_tiles.end());
417 } 419 }
418 } 420 }
419 421
420 } // namespace 422 } // namespace
421 } // namespace cc 423 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698