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"
11 class FakeInfinitePicturePileImpl
: public PicturePileImpl
{
13 FakeInfinitePicturePileImpl()
14 : PicturePileImpl(false) {
15 gfx::Size
size(std::numeric_limits
<int>::max(),
16 std::numeric_limits
<int>::max());
18 recorded_region_
= Region(gfx::Rect(size
));
22 virtual ~FakeInfinitePicturePileImpl() {}
25 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
26 : tile_manager_(TileManager::Create(&tile_manager_client_
,
30 &stats_instrumentation_
,
32 pile_(new FakeInfinitePicturePileImpl()),
34 allow_create_tile_(true) {}
36 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
39 scoped_refptr
<Tile
> FakePictureLayerTilingClient::CreateTile(
42 if (!allow_create_tile_
)
44 return new Tile(tile_manager_
.get(),
54 void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size
) {
55 tile_size_
= tile_size
;
58 gfx::Size
FakePictureLayerTilingClient::CalculateTileSize(
59 gfx::Size
/* content_bounds */) {
63 const Region
* FakePictureLayerTilingClient::GetInvalidation() {
64 return &invalidation_
;
67 const PictureLayerTiling
* FakePictureLayerTilingClient::GetTwinTiling(
68 const PictureLayerTiling
* tiling
) {
72 bool FakePictureLayerTilingClient::TileHasText(Tile
* tile
) {
73 if (text_rect_
.IsEmpty())
75 return tile
->content_rect().Intersects(text_rect_
);