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 #ifndef CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
8 #include "cc/resources/picture_layer_tiling.h"
9 #include "cc/resources/picture_pile_impl.h"
10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_manager.h"
12 #include "cc/test/fake_tile_manager_client.h"
13 #include "ui/gfx/rect.h"
17 class FakePictureLayerTilingClient
: public PictureLayerTilingClient
{
19 FakePictureLayerTilingClient();
20 virtual ~FakePictureLayerTilingClient();
22 // PictureLayerTilingClient implementation.
23 virtual scoped_refptr
<Tile
> CreateTile(
24 PictureLayerTiling
* tiling
, gfx::Rect rect
) OVERRIDE
;
25 virtual void UpdatePile(Tile
* tile
) OVERRIDE
{}
26 virtual gfx::Size
CalculateTileSize(
27 gfx::Size content_bounds
) const OVERRIDE
;
29 void SetTileSize(gfx::Size tile_size
);
30 gfx::Size
TileSize() const { return tile_size_
; }
31 scoped_refptr
<PicturePileImpl
> pile() { return pile_
; }
32 const PicturePileImpl
* pile() const { return pile_
.get(); }
34 virtual const Region
* GetInvalidation() OVERRIDE
;
35 virtual const PictureLayerTiling
* GetTwinTiling(
36 const PictureLayerTiling
* tiling
) OVERRIDE
;
38 void set_twin_tiling(PictureLayerTiling
* tiling
) { twin_tiling_
= tiling
; }
39 void set_text_rect(gfx::Rect rect
) { text_rect_
= rect
; }
40 void set_allow_create_tile(bool allow
) { allow_create_tile_
= allow
; }
41 void set_invalidation(const Region
& region
) { invalidation_
= region
; }
43 TileManager
* tile_manager() const {
44 return tile_manager_
.get();
48 FakeTileManagerClient tile_manager_client_
;
49 scoped_ptr
<TileManager
> tile_manager_
;
50 scoped_refptr
<PicturePileImpl
> pile_
;
52 PictureLayerTiling
* twin_tiling_
;
54 bool allow_create_tile_
;
60 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_