| 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( | 84 tiles[i]->tile_version().SetMemoryStateForTesting( |
| 85 USING_RELEASABLE_MEMORY); | 85 USING_RELEASABLE_MEMORY); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 float max_contents_scale = scale; | 89 float max_contents_scale = scale; |
| 90 gfx::Size content_bounds( | 90 gfx::Size content_bounds( |
| 91 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); | 91 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); |
| 92 gfx::Rect content_rect(content_bounds); | 92 gfx::Rect content_rect(content_bounds); |
| 93 | 93 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { | 143 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { |
| 144 runTest(10, 1.f, 1.f, 5.f, 5.f); | 144 runTest(10, 1.f, 1.f, 5.f, 5.f); |
| 145 } | 145 } |
| 146 | 146 |
| 147 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { | 147 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { |
| 148 runTest(10, 1.f, 1.f, 4.5f, 5.f); | 148 runTest(10, 1.f, 1.f, 4.5f, 5.f); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 } // namespace cc | 152 } // namespace cc |
| OLD | NEW |