| 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/test/fake_picture_layer_tiling_client.h" | 5 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "cc/test/fake_picture_pile_impl.h" | 9 #include "cc/test/fake_picture_pile_impl.h" |
| 10 #include "cc/test/fake_tile_manager.h" | 10 #include "cc/test/fake_tile_manager.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 FakePictureLayerTilingClient::FakePictureLayerTilingClient() | 14 FakePictureLayerTilingClient::FakePictureLayerTilingClient() |
| 15 : tile_manager_(new FakeTileManager(&tile_manager_client_)), | 15 : tile_manager_(new FakeTileManager(&tile_manager_client_)), |
| 16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), | 16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), |
| 17 twin_set_(nullptr), | 17 twin_set_(nullptr), |
| 18 twin_tiling_(nullptr), | 18 twin_tiling_(nullptr), |
| 19 recycled_twin_tiling_(nullptr), | 19 recycled_twin_tiling_(nullptr), |
| 20 allow_create_tile_(true), | |
| 21 max_tile_priority_bin_(TilePriority::NOW) { | 20 max_tile_priority_bin_(TilePriority::NOW) { |
| 22 } | 21 } |
| 23 | 22 |
| 24 FakePictureLayerTilingClient::FakePictureLayerTilingClient( | 23 FakePictureLayerTilingClient::FakePictureLayerTilingClient( |
| 25 ResourceProvider* resource_provider) | 24 ResourceProvider* resource_provider) |
| 26 : resource_pool_( | 25 : resource_pool_( |
| 27 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)), | 26 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)), |
| 28 tile_manager_( | 27 tile_manager_( |
| 29 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), | 28 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), |
| 30 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), | 29 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), |
| 31 twin_set_(nullptr), | 30 twin_set_(nullptr), |
| 32 twin_tiling_(nullptr), | 31 twin_tiling_(nullptr), |
| 33 recycled_twin_tiling_(nullptr), | 32 recycled_twin_tiling_(nullptr), |
| 34 allow_create_tile_(true), | |
| 35 max_tile_priority_bin_(TilePriority::NOW) { | 33 max_tile_priority_bin_(TilePriority::NOW) { |
| 36 } | 34 } |
| 37 | 35 |
| 38 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { | 36 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { |
| 39 } | 37 } |
| 40 | 38 |
| 41 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( | 39 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( |
| 42 PictureLayerTiling*, | 40 float content_scale, |
| 43 const gfx::Rect& rect) { | 41 const gfx::Rect& rect) { |
| 44 if (!allow_create_tile_) | |
| 45 return scoped_refptr<Tile>(); | |
| 46 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0); | 42 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0); |
| 47 } | 43 } |
| 48 | 44 |
| 49 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { | 45 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { |
| 50 tile_size_ = tile_size; | 46 tile_size_ = tile_size; |
| 51 } | 47 } |
| 52 | 48 |
| 53 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( | 49 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( |
| 54 const gfx::Size& /* content_bounds */) const { | 50 const gfx::Size& /* content_bounds */) const { |
| 55 return tile_size_; | 51 return tile_size_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 | 79 |
| 84 WhichTree FakePictureLayerTilingClient::GetTree() const { | 80 WhichTree FakePictureLayerTilingClient::GetTree() const { |
| 85 return tree_; | 81 return tree_; |
| 86 } | 82 } |
| 87 | 83 |
| 88 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { | 84 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { |
| 89 return false; | 85 return false; |
| 90 } | 86 } |
| 91 | 87 |
| 92 } // namespace cc | 88 } // namespace cc |
| OLD | NEW |