| 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_tiles_for_interest_area_(10000), | 21 max_tiles_for_interest_area_(10000), |
| 21 skewport_target_time_in_seconds_(1.0f), | 22 skewport_target_time_in_seconds_(1.0f), |
| 22 skewport_extrapolation_limit_in_content_pixels_(2000) { | 23 skewport_extrapolation_limit_in_content_pixels_(2000) { |
| 23 } | 24 } |
| 24 | 25 |
| 25 FakePictureLayerTilingClient::FakePictureLayerTilingClient( | 26 FakePictureLayerTilingClient::FakePictureLayerTilingClient( |
| 26 ResourceProvider* resource_provider) | 27 ResourceProvider* resource_provider) |
| 27 : resource_pool_( | 28 : resource_pool_( |
| 28 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)), | 29 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)), |
| 29 tile_manager_( | 30 tile_manager_( |
| 30 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), | 31 new FakeTileManager(&tile_manager_client_, resource_pool_.get())), |
| 31 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), | 32 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), |
| 32 twin_tiling_(NULL), | 33 twin_tiling_(NULL), |
| 33 recycled_twin_tiling_(NULL), | 34 recycled_twin_tiling_(NULL), |
| 34 allow_create_tile_(true), | 35 allow_create_tile_(true), |
| 36 max_tile_priority_bin_(TilePriority::NOW), |
| 35 max_tiles_for_interest_area_(10000), | 37 max_tiles_for_interest_area_(10000), |
| 36 skewport_target_time_in_seconds_(1.0f) { | 38 skewport_target_time_in_seconds_(1.0f) { |
| 37 } | 39 } |
| 38 | 40 |
| 39 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { | 41 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { |
| 40 } | 42 } |
| 41 | 43 |
| 42 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( | 44 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( |
| 43 PictureLayerTiling*, | 45 PictureLayerTiling*, |
| 44 const gfx::Rect& rect) { | 46 const gfx::Rect& rect) { |
| 45 if (!allow_create_tile_) | 47 if (!allow_create_tile_) |
| 46 return scoped_refptr<Tile>(); | 48 return scoped_refptr<Tile>(); |
| 47 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0); | 49 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0); |
| 48 } | 50 } |
| 49 | 51 |
| 50 RasterSource* FakePictureLayerTilingClient::GetRasterSource() { | 52 RasterSource* FakePictureLayerTilingClient::GetRasterSource() { |
| 51 return pile_.get(); | 53 return pile_.get(); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { | 56 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) { |
| 55 tile_size_ = tile_size; | 57 tile_size_ = tile_size; |
| 56 } | 58 } |
| 57 | 59 |
| 58 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( | 60 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( |
| 59 const gfx::Size& /* content_bounds */) const { | 61 const gfx::Size& /* content_bounds */) const { |
| 60 return tile_size_; | 62 return tile_size_; |
| 61 } | 63 } |
| 62 | 64 |
| 65 TilePriority::PriorityBin FakePictureLayerTilingClient::GetMaxTilePriorityBin() |
| 66 const { |
| 67 return max_tile_priority_bin_; |
| 68 } |
| 69 |
| 63 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const { | 70 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const { |
| 64 return max_tiles_for_interest_area_; | 71 return max_tiles_for_interest_area_; |
| 65 } | 72 } |
| 66 | 73 |
| 67 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const { | 74 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const { |
| 68 return skewport_target_time_in_seconds_; | 75 return skewport_target_time_in_seconds_; |
| 69 } | 76 } |
| 70 | 77 |
| 71 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels() | 78 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels() |
| 72 const { | 79 const { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 | 97 |
| 91 WhichTree FakePictureLayerTilingClient::GetTree() const { | 98 WhichTree FakePictureLayerTilingClient::GetTree() const { |
| 92 return tree_; | 99 return tree_; |
| 93 } | 100 } |
| 94 | 101 |
| 95 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { | 102 bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { |
| 96 return false; | 103 return false; |
| 97 } | 104 } |
| 98 | 105 |
| 99 } // namespace cc | 106 } // namespace cc |
| OLD | NEW |