1 // Copyright 2013 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_PILE_IMPL_H_
6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/playback/picture_pile_impl.h"
10 #include "cc/test/fake_picture_pile.h"
18 class FakePicturePileImpl
: public PicturePileImpl
{
20 static scoped_refptr
<FakePicturePileImpl
> CreatePile(
21 const gfx::Size
& tile_size
,
22 const gfx::Size
& layer_bounds
,
25 static scoped_refptr
<FakePicturePileImpl
> CreateFilledPileWithDefaultTileSize(
26 const gfx::Size
& layer_bounds
) {
27 return CreateFilledPile(gfx::Size(512, 512), layer_bounds
);
29 static scoped_refptr
<FakePicturePileImpl
> CreateEmptyPileWithDefaultTileSize(
30 const gfx::Size
& layer_bounds
) {
31 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds
);
33 static scoped_refptr
<FakePicturePileImpl
> CreateFilledPile(
34 const gfx::Size
& tile_size
,
35 const gfx::Size
& layer_bounds
);
36 static scoped_refptr
<FakePicturePileImpl
> CreateEmptyPile(
37 const gfx::Size
& tile_size
,
38 const gfx::Size
& layer_bounds
);
39 static scoped_refptr
<FakePicturePileImpl
>
40 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size
& tile_size
,
41 const gfx::Size
& layer_bounds
,
43 static scoped_refptr
<FakePicturePileImpl
> CreateInfiniteFilledPile();
44 static scoped_refptr
<FakePicturePileImpl
> CreateFromPile(
45 const PicturePile
* other
,
46 base::WaitableEvent
* playback_allowed_event
);
48 // Hi-jack the PlaybackToCanvas method to delay its completion.
49 void PlaybackToCanvas(SkCanvas
* canvas
,
50 const gfx::Rect
& canvas_bitmap_rect
,
51 const gfx::Rect
& canvas_playback_rect
,
52 float contents_scale
) const override
;
54 const TilingData
& tiling() { return tiling_
; }
56 bool HasRecordingAt(int x
, int y
) const;
57 int num_tiles_x() const { return tiling_
.num_tiles_x(); }
58 int num_tiles_y() const { return tiling_
.num_tiles_y(); }
61 FakePicturePileImpl();
62 FakePicturePileImpl(const PicturePile
* other
,
63 base::WaitableEvent
* playback_allowed_event
);
64 ~FakePicturePileImpl() override
;
66 base::WaitableEvent
* playback_allowed_event_
;
67 gfx::Size tile_grid_size_
;
72 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_