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, Tile::USE_LCD_TEXT
);
47 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size
& tile_size
) {
48 tile_size_
= tile_size
;
51 gfx::Size
FakePictureLayerTilingClient::CalculateTileSize(
52 const gfx::Size
& /* content_bounds */) const {
56 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
57 return max_tiles_for_interest_area_
;
60 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
61 return skewport_target_time_in_seconds_
;
64 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
66 return skewport_extrapolation_limit_in_content_pixels_
;
69 const Region
* FakePictureLayerTilingClient::GetInvalidation() {
70 return &invalidation_
;
73 const PictureLayerTiling
* FakePictureLayerTilingClient::GetTwinTiling(
74 const PictureLayerTiling
* tiling
) const {