| 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_tiling_(NULL), | 17 twin_tiling_(NULL), |
| 18 recycled_twin_tiling_(NULL), | 18 recycled_twin_tiling_(NULL), |
| 19 allow_create_tile_(true), | 19 allow_create_tile_(true), |
| 20 max_tile_priority_bin_(TilePriority::NOW), | 20 max_tile_priority_bin_(TilePriority::NOW), |
| 21 max_tiles_for_interest_area_(10000), | 21 max_tiles_for_interest_area_(10000), |
| 22 skewport_target_time_in_seconds_(1.0f), | 22 skewport_target_time_in_seconds_(1.0f), |
| 23 skewport_extrapolation_limit_in_content_pixels_(2000) { | 23 skewport_extrapolation_limit_in_content_pixels_(2000) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 FakePictureLayerTilingClient::FakePictureLayerTilingClient( | 26 FakePictureLayerTilingClient::FakePictureLayerTilingClient( |
| 27 ResourceProvider* resource_provider) | 27 ResourceProvider* resource_provider) |
| 28 : resource_pool_( | 28 : resource_pool_( |
| 29 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)), | 29 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, false)), |
| 30 tile_manager_( | 30 tile_manager_( |
| 31 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), | 31 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), |
| 32 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), | 32 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), |
| 33 twin_tiling_(NULL), | 33 twin_tiling_(NULL), |
| 34 recycled_twin_tiling_(NULL), | 34 recycled_twin_tiling_(NULL), |
| 35 allow_create_tile_(true), | 35 allow_create_tile_(true), |
| 36 max_tile_priority_bin_(TilePriority::NOW), | 36 max_tile_priority_bin_(TilePriority::NOW), |
| 37 max_tiles_for_interest_area_(10000), | 37 max_tiles_for_interest_area_(10000), |
| 38 skewport_target_time_in_seconds_(1.0f) { | 38 skewport_target_time_in_seconds_(1.0f) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { | 41 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( | 44 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( |
| 45 PictureLayerTiling*, | 45 PictureLayerTiling*, |
| 46 const gfx::Rect& rect) { | 46 const gfx::Rect& rect, |
| 47 int flags) { |
| 47 if (!allow_create_tile_) | 48 if (!allow_create_tile_) |
| 48 return scoped_refptr<Tile>(); | 49 return scoped_refptr<Tile>(); |
| 49 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0); | 50 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, |
| 51 flags); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { | 54 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { |
| 53 tile_size_ = tile_size; | 55 tile_size_ = tile_size; |
| 54 } | 56 } |
| 55 | 57 |
| 56 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( | 58 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( |
| 57 const gfx::Size& /* content_bounds */) const { | 59 const gfx::Size& /* content_bounds */) const { |
| 58 return tile_size_; | 60 return tile_size_; |
| 59 } | 61 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 95 |
| 94 WhichTree FakePictureLayerTilingClient::GetTree() const { | 96 WhichTree FakePictureLayerTilingClient::GetTree() const { |
| 95 return tree_; | 97 return tree_; |
| 96 } | 98 } |
| 97 | 99 |
| 98 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { | 100 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { |
| 99 return false; | 101 return false; |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace cc | 104 } // namespace cc |
| OLD | NEW |