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 "cc/resources/resource_pool.h" | 7 #include "cc/resources/resource_pool.h" |
8 #include "cc/resources/resource_provider.h" | 8 #include "cc/resources/resource_provider.h" |
9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
10 #include "cc/test/fake_picture_layer_tiling_client.h" | 10 #include "cc/test/fake_picture_layer_tiling_client.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 gfx::Size layer_bounds(1000, 800); | 23 gfx::Size layer_bounds(1000, 800); |
24 set.SetLayerBounds(layer_bounds); | 24 set.SetLayerBounds(layer_bounds); |
25 | 25 |
26 set.AddTiling(1.0); | 26 set.AddTiling(1.0); |
27 set.AddTiling(1.5); | 27 set.AddTiling(1.5); |
28 set.AddTiling(2.0); | 28 set.AddTiling(2.0); |
29 | 29 |
30 float contents_scale = 2.0; | 30 float contents_scale = 2.0; |
31 gfx::Size content_bounds( | 31 gfx::Size content_bounds( |
32 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); | 32 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale))); |
33 gfx::Rect content_rect(gfx::Point(), content_bounds); | 33 gfx::Rect content_rect(content_bounds); |
34 | 34 |
35 Region remaining(content_rect); | 35 Region remaining(content_rect); |
36 PictureLayerTilingSet::Iterator iter( | 36 PictureLayerTilingSet::Iterator iter( |
37 &set, | 37 &set, |
38 contents_scale, | 38 contents_scale, |
39 content_rect, | 39 content_rect, |
40 contents_scale); | 40 contents_scale); |
41 for (; iter; ++iter) { | 41 for (; iter; ++iter) { |
42 gfx::Rect geometry_rect = iter.geometry_rect(); | 42 gfx::Rect geometry_rect = iter.geometry_rect(); |
43 EXPECT_TRUE(content_rect.Contains(geometry_rect)); | 43 EXPECT_TRUE(content_rect.Contains(geometry_rect)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 make_scoped_ptr(new ResourcePool::Resource( | 81 make_scoped_ptr(new ResourcePool::Resource( |
82 resource_provider.get(), | 82 resource_provider.get(), |
83 gfx::Size(1, 1), | 83 gfx::Size(1, 1), |
84 resource_provider->best_texture_format())); | 84 resource_provider->best_texture_format())); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 float max_contents_scale = scale; | 88 float max_contents_scale = scale; |
89 gfx::Size content_bounds( | 89 gfx::Size content_bounds( |
90 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); | 90 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); |
91 gfx::Rect content_rect(gfx::Point(), content_bounds); | 91 gfx::Rect content_rect(content_bounds); |
92 | 92 |
93 Region remaining(content_rect); | 93 Region remaining(content_rect); |
94 PictureLayerTilingSet::Iterator iter( | 94 PictureLayerTilingSet::Iterator iter( |
95 &set, | 95 &set, |
96 max_contents_scale, | 96 max_contents_scale, |
97 content_rect, | 97 content_rect, |
98 ideal_contents_scale); | 98 ideal_contents_scale); |
99 for (; iter; ++iter) { | 99 for (; iter; ++iter) { |
100 gfx::Rect geometry_rect = iter.geometry_rect(); | 100 gfx::Rect geometry_rect = iter.geometry_rect(); |
101 EXPECT_TRUE(content_rect.Contains(geometry_rect)); | 101 EXPECT_TRUE(content_rect.Contains(geometry_rect)); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { | 142 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { |
143 runTest(10, 1.f, 1.f, 5.f, 5.f); | 143 runTest(10, 1.f, 1.f, 5.f, 5.f); |
144 } | 144 } |
145 | 145 |
146 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { | 146 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { |
147 runTest(10, 1.f, 1.f, 4.5f, 5.f); | 147 runTest(10, 1.f, 1.f, 4.5f, 5.f); |
148 } | 148 } |
149 | 149 |
150 } // namespace | 150 } // namespace |
151 } // namespace cc | 151 } // namespace cc |
OLD | NEW |