| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 FakeOutputSurface::Create3d(); | 62 FakeOutputSurface::Create3d(); |
| 63 scoped_ptr<ResourceProvider> resource_provider = | 63 scoped_ptr<ResourceProvider> resource_provider = |
| 64 ResourceProvider::Create(output_surface.get(), 0); | 64 ResourceProvider::Create(output_surface.get(), 0); |
| 65 | 65 |
| 66 FakePictureLayerTilingClient client; | 66 FakePictureLayerTilingClient client; |
| 67 client.SetTileSize(gfx::Size(256, 256)); | 67 client.SetTileSize(gfx::Size(256, 256)); |
| 68 gfx::Size layer_bounds(1000, 800); | 68 gfx::Size layer_bounds(1000, 800); |
| 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 TileRasterMode mode = HIGH_QUALITY_RASTER_MODE; |
| 72 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { | 73 for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { |
| 73 PictureLayerTiling* tiling = set.AddTiling(scale); | 74 PictureLayerTiling* tiling = set.AddTiling(scale); |
| 74 tiling->CreateAllTilesForTesting(); | 75 tiling->CreateAllTilesForTesting(); |
| 75 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 76 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 76 for (size_t i = 0; i < tiles.size(); ++i) { | 77 for (size_t i = 0; i < tiles.size(); ++i) { |
| 77 EXPECT_FALSE(tiles[i]->tile_version().GetResourceForTesting()); | 78 EXPECT_FALSE(tiles[i]->tile_version(mode).GetResourceForTesting()); |
| 78 | 79 |
| 79 tiles[i]->tile_version().SetResourceForTesting( | 80 tiles[i]->tile_version(mode).SetResourceForTesting( |
| 80 make_scoped_ptr(new ResourcePool::Resource( | 81 make_scoped_ptr(new ResourcePool::Resource( |
| 81 resource_provider.get(), | 82 resource_provider.get(), |
| 82 gfx::Size(1, 1), | 83 gfx::Size(1, 1), |
| 83 resource_provider->best_texture_format()))); | 84 resource_provider->best_texture_format()))); |
| 84 } | 85 } |
| 85 } | 86 } |
| 86 | 87 |
| 87 float max_contents_scale = scale; | 88 float max_contents_scale = scale; |
| 88 gfx::Size content_bounds( | 89 gfx::Size content_bounds( |
| 89 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); | 90 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, max_contents_scale))); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { | 142 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_Equal) { |
| 142 runTest(10, 1.f, 1.f, 5.f, 5.f); | 143 runTest(10, 1.f, 1.f, 5.f, 5.f); |
| 143 } | 144 } |
| 144 | 145 |
| 145 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { | 146 TEST_F(PictureLayerTilingSetTestWithResources, ManyTilings_NotEqual) { |
| 146 runTest(10, 1.f, 1.f, 4.5f, 5.f); | 147 runTest(10, 1.f, 1.f, 4.5f, 5.f); |
| 147 } | 148 } |
| 148 | 149 |
| 149 } // namespace | 150 } // namespace |
| 150 } // namespace cc | 151 } // namespace cc |
| OLD | NEW |