| 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 <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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 PictureLayerTilingSet set(&client, layer_bounds); | 69 PictureLayerTilingSet set(&client, layer_bounds); |
| 70 | 70 |
| 71 float scale = min_scale; | 71 float scale = min_scale; |
| 72 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { | 72 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { |
| 73 PictureLayerTiling* tiling = set.AddTiling(scale); | 73 PictureLayerTiling* tiling = set.AddTiling(scale); |
| 74 tiling->CreateAllTilesForTesting(); | 74 tiling->CreateAllTilesForTesting(); |
| 75 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 75 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 76 for (size_t i = 0; i < tiles.size(); ++i) { | 76 for (size_t i = 0; i < tiles.size(); ++i) { |
| 77 EXPECT_FALSE(tiles[i]->tile_version().GetResourceForTesting()); | 77 EXPECT_FALSE(tiles[i]->tile_version().GetResourceForTesting()); |
| 78 | 78 |
| 79 tiles[i]->tile_version().GetResourceForTesting() = | 79 tiles[i]->tile_version().SetResourceForTesting( |
| 80 make_scoped_ptr(new ResourcePool::Resource( | 80 make_scoped_ptr(new ResourcePool::Resource( |
| 81 resource_provider.get(), | 81 resource_provider.get(), |
| 82 gfx::Size(1, 1), | 82 gfx::Size(1, 1), |
| 83 resource_provider->best_texture_format())); | 83 resource_provider->best_texture_format()))); |
| 84 tiles[i]->tile_version().SetMemoryStateForTesting( | |
| 85 USING_RELEASABLE_MEMORY); | |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 | 86 |
| 89 float max_contents_scale = scale; | 87 float max_contents_scale = scale; |
| 90 gfx::Size content_bounds( | 88 gfx::Size content_bounds( |
| 91 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); | 89 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); |
| 92 gfx::Rect content_rect(content_bounds); | 90 gfx::Rect content_rect(content_bounds); |
| 93 | 91 |
| 94 Region remaining(content_rect); | 92 Region remaining(content_rect); |
| 95 PictureLayerTilingSet::CoverageIterator iter( | 93 PictureLayerTilingSet::CoverageIterator iter( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { | 141 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { |
| 144 runTest(10, 1.f, 1.f, 5.f, 5.f); | 142 runTest(10, 1.f, 1.f, 5.f, 5.f); |
| 145 } | 143 } |
| 146 | 144 |
| 147 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { | 145 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { |
| 148 runTest(10, 1.f, 1.f, 4.5f, 5.f); | 146 runTest(10, 1.f, 1.f, 4.5f, 5.f); |
| 149 } | 147 } |
| 150 | 148 |
| 151 } // namespace | 149 } // namespace |
| 152 } // namespace cc | 150 } // namespace cc |
| OLD | NEW |