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/playback/picture_pile_impl.h"
9 #include "cc/test/fake_tile_manager_client.h"
10 #include "cc/tiles/picture_layer_tiling.h"
11 #include "cc/tiles/tile.h"
12 #include "cc/tiles/tile_manager.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 ScopedTilePtr
CreateTile(const Tile::CreateInfo
& info
) override
;
25 gfx::Size
CalculateTileSize(const gfx::Size
& content_bounds
) const override
;
26 bool HasValidTilePriorities() const override
;
28 void SetTileSize(const gfx::Size
& tile_size
);
29 gfx::Size
TileSize() const { return tile_size_
; }
31 const Region
* GetPendingInvalidation() override
;
32 const PictureLayerTiling
* GetPendingOrActiveTwinTiling(
33 const PictureLayerTiling
* tiling
) const override
;
34 bool RequiresHighResToDraw() const override
;
36 void set_twin_tiling_set(PictureLayerTilingSet
* set
) {
38 twin_tiling_
= nullptr;
40 void set_twin_tiling(PictureLayerTiling
* tiling
) {
41 twin_tiling_
= tiling
;
44 void set_text_rect(const gfx::Rect
& rect
) { text_rect_
= rect
; }
45 void set_invalidation(const Region
& region
) { invalidation_
= region
; }
46 void set_has_valid_tile_priorities(bool has_valid_tile_priorities
) {
47 has_valid_tile_priorities_
= has_valid_tile_priorities
;
49 RasterSource
* raster_source() { return pile_
.get(); }
51 TileManager
* tile_manager() const {
52 return tile_manager_
.get();
56 FakeTileManagerClient tile_manager_client_
;
57 scoped_ptr
<ResourcePool
> resource_pool_
;
58 scoped_ptr
<TileManager
> tile_manager_
;
59 scoped_refptr
<PicturePileImpl
> pile_
;
61 PictureLayerTilingSet
* twin_set_
;
62 PictureLayerTiling
* twin_tiling_
;
65 bool has_valid_tile_priorities_
;
70 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_