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

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

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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/tiles/picture_layer_tiling_set.h" 5 #include "cc/tiles/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 27 matching lines...) Expand all
38 38
39 scoped_refptr<FakePicturePileImpl> pile = 39 scoped_refptr<FakePicturePileImpl> pile =
40 FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds); 40 FakePicturePileImpl::CreateEmptyPileWithDefaultTileSize(layer_bounds);
41 41
42 set->AddTiling(1.0, pile); 42 set->AddTiling(1.0, pile);
43 set->AddTiling(1.5, pile); 43 set->AddTiling(1.5, pile);
44 set->AddTiling(2.0, pile); 44 set->AddTiling(2.0, pile);
45 45
46 float contents_scale = 2.0; 46 float contents_scale = 2.0;
47 gfx::Size content_bounds( 47 gfx::Size content_bounds(
48 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); 48 gfx::ScaleToCeiledSize(layer_bounds, contents_scale));
49 gfx::Rect content_rect(content_bounds); 49 gfx::Rect content_rect(content_bounds);
50 50
51 Region remaining(content_rect); 51 Region remaining(content_rect);
52 PictureLayerTilingSet::CoverageIterator iter(set.get(), contents_scale, 52 PictureLayerTilingSet::CoverageIterator iter(set.get(), contents_scale,
53 content_rect, contents_scale); 53 content_rect, contents_scale);
54 for (; iter; ++iter) { 54 for (; iter; ++iter) {
55 gfx::Rect geometry_rect = iter.geometry_rect(); 55 gfx::Rect geometry_rect = iter.geometry_rect();
56 EXPECT_TRUE(content_rect.Contains(geometry_rect)); 56 EXPECT_TRUE(content_rect.Contains(geometry_rect));
57 ASSERT_TRUE(remaining.Contains(geometry_rect)); 57 ASSERT_TRUE(remaining.Contains(geometry_rect));
58 remaining.Subtract(geometry_rect); 58 remaining.Subtract(geometry_rect);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { 230 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) {
231 PictureLayerTiling* tiling = set->AddTiling(scale, pile); 231 PictureLayerTiling* tiling = set->AddTiling(scale, pile);
232 tiling->set_resolution(HIGH_RESOLUTION); 232 tiling->set_resolution(HIGH_RESOLUTION);
233 tiling->CreateAllTilesForTesting(); 233 tiling->CreateAllTilesForTesting();
234 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); 234 std::vector<Tile*> tiles = tiling->AllTilesForTesting();
235 client.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 235 client.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
236 } 236 }
237 237
238 float max_contents_scale = scale; 238 float max_contents_scale = scale;
239 gfx::Size content_bounds( 239 gfx::Size content_bounds(
240 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); 240 gfx::ScaleToCeiledSize(layer_bounds, max_contents_scale));
241 gfx::Rect content_rect(content_bounds); 241 gfx::Rect content_rect(content_bounds);
242 242
243 Region remaining(content_rect); 243 Region remaining(content_rect);
244 PictureLayerTilingSet::CoverageIterator iter( 244 PictureLayerTilingSet::CoverageIterator iter(
245 set.get(), max_contents_scale, content_rect, ideal_contents_scale); 245 set.get(), max_contents_scale, content_rect, ideal_contents_scale);
246 for (; iter; ++iter) { 246 for (; iter; ++iter) {
247 gfx::Rect geometry_rect = iter.geometry_rect(); 247 gfx::Rect geometry_rect = iter.geometry_rect();
248 EXPECT_TRUE(content_rect.Contains(geometry_rect)); 248 EXPECT_TRUE(content_rect.Contains(geometry_rect));
249 ASSERT_TRUE(remaining.Contains(geometry_rect)); 249 ASSERT_TRUE(remaining.Contains(geometry_rect));
250 remaining.Subtract(geometry_rect); 250 remaining.Subtract(geometry_rect);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 // Clone from the pending to the active tree with the same max content size. 450 // Clone from the pending to the active tree with the same max content size.
451 active_set->UpdateTilingsToCurrentRasterSourceForActivation( 451 active_set->UpdateTilingsToCurrentRasterSourceForActivation(
452 pile.get(), pending_set.get(), Region(), 1.f, max_content_scale); 452 pile.get(), pending_set.get(), Region(), 1.f, max_content_scale);
453 // All the tilings are on the active tree. 453 // All the tilings are on the active tree.
454 EXPECT_EQ(2u, active_set->num_tilings()); 454 EXPECT_EQ(2u, active_set->num_tilings());
455 } 455 }
456 456
457 } // namespace 457 } // namespace
458 } // namespace cc 458 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698