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/resources/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_rect
,
51 float contents_scale
) const override
;
53 const TilingData
& tiling() { return tiling_
; }
55 bool HasRecordingAt(int x
, int y
) const;
56 int num_tiles_x() const { return tiling_
.num_tiles_x(); }
57 int num_tiles_y() const { return tiling_
.num_tiles_y(); }
60 FakePicturePileImpl();
61 FakePicturePileImpl(const PicturePile
* other
,
62 base::WaitableEvent
* playback_allowed_event
);
63 ~FakePicturePileImpl() override
;
65 base::WaitableEvent
* playback_allowed_event_
;
66 gfx::Size tile_grid_size_
;
71 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_