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

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

Issue 12583018: cc: Rename PictureLayerTiling(Set) Iterator to CoverageIterator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 <vector> 7 #include <vector>
8 8
9 #include "cc/resources/resource_pool.h" 9 #include "cc/resources/resource_pool.h"
10 #include "cc/resources/resource_provider.h" 10 #include "cc/resources/resource_provider.h"
(...skipping 17 matching lines...) Expand all
28 set.AddTiling(1.0); 28 set.AddTiling(1.0);
29 set.AddTiling(1.5); 29 set.AddTiling(1.5);
30 set.AddTiling(2.0); 30 set.AddTiling(2.0);
31 31
32 float contents_scale = 2.0; 32 float contents_scale = 2.0;
33 gfx::Size content_bounds( 33 gfx::Size content_bounds(
34 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); 34 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)));
35 gfx::Rect content_rect(content_bounds); 35 gfx::Rect content_rect(content_bounds);
36 36
37 Region remaining(content_rect); 37 Region remaining(content_rect);
38 PictureLayerTilingSet::Iterator iter( 38 PictureLayerTilingSet::CoverageIterator iter(
39 &set, 39 &set,
40 contents_scale, 40 contents_scale,
41 content_rect, 41 content_rect,
42 contents_scale); 42 contents_scale);
43 for (; iter; ++iter) { 43 for (; iter; ++iter) {
44 gfx::Rect geometry_rect = iter.geometry_rect(); 44 gfx::Rect geometry_rect = iter.geometry_rect();
45 EXPECT_TRUE(content_rect.Contains(geometry_rect)); 45 EXPECT_TRUE(content_rect.Contains(geometry_rect));
46 ASSERT_TRUE(remaining.Contains(geometry_rect)); 46 ASSERT_TRUE(remaining.Contains(geometry_rect));
47 remaining.Subtract(geometry_rect); 47 remaining.Subtract(geometry_rect);
48 48
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 resource_provider->best_texture_format())); 86 resource_provider->best_texture_format()));
87 } 87 }
88 } 88 }
89 89
90 float max_contents_scale = scale; 90 float max_contents_scale = scale;
91 gfx::Size content_bounds( 91 gfx::Size content_bounds(
92 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); 92 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale)));
93 gfx::Rect content_rect(content_bounds); 93 gfx::Rect content_rect(content_bounds);
94 94
95 Region remaining(content_rect); 95 Region remaining(content_rect);
96 PictureLayerTilingSet::Iterator iter( 96 PictureLayerTilingSet::CoverageIterator iter(
97 &set, 97 &set,
98 max_contents_scale, 98 max_contents_scale,
99 content_rect, 99 content_rect,
100 ideal_contents_scale); 100 ideal_contents_scale);
101 for (; iter; ++iter) { 101 for (; iter; ++iter) {
102 gfx::Rect geometry_rect = iter.geometry_rect(); 102 gfx::Rect geometry_rect = iter.geometry_rect();
103 EXPECT_TRUE(content_rect.Contains(geometry_rect)); 103 EXPECT_TRUE(content_rect.Contains(geometry_rect));
104 ASSERT_TRUE(remaining.Contains(geometry_rect)); 104 ASSERT_TRUE(remaining.Contains(geometry_rect));
105 remaining.Subtract(geometry_rect); 105 remaining.Subtract(geometry_rect);
106 106
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { 144 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) {
145 runTest(10, 1.f, 1.f, 5.f, 5.f); 145 runTest(10, 1.f, 1.f, 5.f, 5.f);
146 } 146 }
147 147
148 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { 148 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) {
149 runTest(10, 1.f, 1.f, 4.5f, 5.f); 149 runTest(10, 1.f, 1.f, 4.5f, 5.f);
150 } 150 }
151 151
152 } // namespace 152 } // namespace
153 } // namespace cc 153 } // 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