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
3 // found in the LICENSE file.
5 #include "cc/test/fake_picture_layer_tiling_client.h"
9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "cc/test/fake_tile_manager.h"
14 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
15 : tile_manager_(new FakeTileManager(&tile_manager_client_
)),
16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
18 recycled_twin_tiling_(NULL
),
19 allow_create_tile_(true),
20 max_tiles_for_interest_area_(10000),
21 skewport_target_time_in_seconds_(1.0f
),
22 skewport_extrapolation_limit_in_content_pixels_(2000) {
25 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
26 ResourceProvider
* resource_provider
)
28 ResourcePool::Create(resource_provider
, GL_TEXTURE_2D
, RGBA_8888
)),
30 new FakeTileManager(&tile_manager_client_
, resource_pool_
.get())),
31 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
33 recycled_twin_tiling_(NULL
),
34 allow_create_tile_(true),
35 max_tiles_for_interest_area_(10000),
36 skewport_target_time_in_seconds_(1.0f
) {
39 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
42 scoped_refptr
<Tile
> FakePictureLayerTilingClient::CreateTile(
44 const gfx::Rect
& rect
) {
45 if (!allow_create_tile_
)
46 return scoped_refptr
<Tile
>();
47 return tile_manager_
->CreateTile(pile_
.get(), tile_size_
, rect
, 1, 0, 0, 0);
50 PicturePileImpl
* FakePictureLayerTilingClient::GetPile() {
54 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size
& tile_size
) {
55 tile_size_
= tile_size
;
58 gfx::Size
FakePictureLayerTilingClient::CalculateTileSize(
59 const gfx::Size
& /* content_bounds */) const {
63 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
64 return max_tiles_for_interest_area_
;
67 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
68 return skewport_target_time_in_seconds_
;
71 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
73 return skewport_extrapolation_limit_in_content_pixels_
;
76 const Region
* FakePictureLayerTilingClient::GetInvalidation() {
77 return &invalidation_
;
80 const PictureLayerTiling
* FakePictureLayerTilingClient::GetTwinTiling(
81 const PictureLayerTiling
* tiling
) const {
85 PictureLayerTiling
* FakePictureLayerTilingClient::GetRecycledTwinTiling(
86 const PictureLayerTiling
* tiling
) {
87 return recycled_twin_tiling_
;
90 WhichTree
FakePictureLayerTilingClient::GetTree() const {