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/geometry/rect.h"
17 class FakePictureLayerTilingClient
: public PictureLayerTilingClient
{
19 FakePictureLayerTilingClient();
20 explicit FakePictureLayerTilingClient(ResourceProvider
* resource_provider
);
21 ~FakePictureLayerTilingClient() override
;
23 // PictureLayerTilingClient implementation.
24 scoped_refptr
<Tile
> CreateTile(float contents_scale
,
25 const gfx::Rect
& rect
) override
;
26 gfx::Size
CalculateTileSize(const gfx::Size
& content_bounds
) const override
;
27 TilePriority::PriorityBin
GetMaxTilePriorityBin() const override
;
29 void SetTileSize(const gfx::Size
& tile_size
);
30 gfx::Size
TileSize() const { return tile_size_
; }
32 const Region
* GetPendingInvalidation() override
;
33 const PictureLayerTiling
* GetPendingOrActiveTwinTiling(
34 const PictureLayerTiling
* tiling
) const override
;
35 PictureLayerTiling
* GetRecycledTwinTiling(
36 const PictureLayerTiling
* tiling
) override
;
37 bool RequiresHighResToDraw() const override
;
38 WhichTree
GetTree() const override
;
40 void set_twin_tiling_set(PictureLayerTilingSet
* set
) {
42 twin_tiling_
= nullptr;
44 void set_twin_tiling(PictureLayerTiling
* tiling
) {
45 twin_tiling_
= tiling
;
48 void set_recycled_twin_tiling(PictureLayerTiling
* tiling
) {
49 recycled_twin_tiling_
= tiling
;
51 void set_text_rect(const gfx::Rect
& rect
) { text_rect_
= rect
; }
52 void set_invalidation(const Region
& region
) { invalidation_
= region
; }
53 void set_max_tile_priority_bin(TilePriority::PriorityBin bin
) {
54 max_tile_priority_bin_
= bin
;
56 void set_tree(WhichTree tree
) { tree_
= tree
; }
57 RasterSource
* raster_source() { return pile_
.get(); }
59 TileManager
* tile_manager() const {
60 return tile_manager_
.get();
64 FakeTileManagerClient tile_manager_client_
;
65 scoped_ptr
<ResourcePool
> resource_pool_
;
66 scoped_ptr
<TileManager
> tile_manager_
;
67 scoped_refptr
<PicturePileImpl
> pile_
;
69 PictureLayerTilingSet
* twin_set_
;
70 PictureLayerTiling
* twin_tiling_
;
71 PictureLayerTiling
* recycled_twin_tiling_
;
74 TilePriority::PriorityBin max_tile_priority_bin_
;
80 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_