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 allow_create_tile_(true),
19 max_tiles_for_interest_area_(10000),
20 skewport_target_time_in_seconds_(1.0f
),
21 skewport_extrapolation_limit_in_content_pixels_(2000) {}
23 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
24 ResourceProvider
* resource_provider
)
26 ResourcePool::Create(resource_provider
, GL_TEXTURE_2D
, RGBA_8888
)),
28 new FakeTileManager(&tile_manager_client_
, resource_pool_
.get())),
29 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
31 allow_create_tile_(true),
32 max_tiles_for_interest_area_(10000),
33 skewport_target_time_in_seconds_(1.0f
) {}
35 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
38 scoped_refptr
<Tile
> FakePictureLayerTilingClient::CreateTile(
40 const gfx::Rect
& rect
) {
41 if (!allow_create_tile_
)
42 return scoped_refptr
<Tile
>();
43 return tile_manager_
->CreateTile(
44 pile_
.get(), tile_size_
, rect
, gfx::Rect(), 1, 0, 0, 0);
47 PicturePileImpl
* FakePictureLayerTilingClient::GetPile() {
51 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size
& tile_size
) {
52 tile_size_
= tile_size
;
55 gfx::Size
FakePictureLayerTilingClient::CalculateTileSize(
56 const gfx::Size
& /* content_bounds */) const {
60 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
61 return max_tiles_for_interest_area_
;
64 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
65 return skewport_target_time_in_seconds_
;
68 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
70 return skewport_extrapolation_limit_in_content_pixels_
;
73 const Region
* FakePictureLayerTilingClient::GetInvalidation() {
74 return &invalidation_
;
77 const PictureLayerTiling
* FakePictureLayerTilingClient::GetTwinTiling(
78 const PictureLayerTiling
* tiling
) const {