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(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 bool RequiresHighResToDraw() const override
;
37 void set_twin_tiling_set(PictureLayerTilingSet
* set
) {
39 twin_tiling_
= nullptr;
41 void set_twin_tiling(PictureLayerTiling
* tiling
) {
42 twin_tiling_
= tiling
;
45 void set_text_rect(const gfx::Rect
& rect
) { text_rect_
= rect
; }
46 void set_invalidation(const Region
& region
) { invalidation_
= region
; }
47 void set_max_tile_priority_bin(TilePriority::PriorityBin bin
) {
48 max_tile_priority_bin_
= bin
;
50 RasterSource
* raster_source() { return pile_
.get(); }
52 TileManager
* tile_manager() const {
53 return tile_manager_
.get();
57 FakeTileManagerClient tile_manager_client_
;
58 scoped_ptr
<ResourcePool
> resource_pool_
;
59 scoped_ptr
<TileManager
> tile_manager_
;
60 scoped_refptr
<PicturePileImpl
> pile_
;
62 PictureLayerTilingSet
* twin_set_
;
63 PictureLayerTiling
* twin_tiling_
;
66 TilePriority::PriorityBin max_tile_priority_bin_
;
71 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_