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
,
23 const gfx::Rect
& recorded_viewport
,
26 static scoped_refptr
<FakePicturePileImpl
> CreateFilledPileWithDefaultTileSize(
27 const gfx::Size
& layer_bounds
) {
28 return CreateFilledPile(gfx::Size(512, 512), layer_bounds
);
30 static scoped_refptr
<FakePicturePileImpl
> CreateEmptyPileWithDefaultTileSize(
31 const gfx::Size
& layer_bounds
) {
32 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds
);
34 static scoped_refptr
<FakePicturePileImpl
> CreateFilledPile(
35 const gfx::Size
& tile_size
,
36 const gfx::Size
& layer_bounds
);
37 static scoped_refptr
<FakePicturePileImpl
> CreateEmptyPile(
38 const gfx::Size
& tile_size
,
39 const gfx::Size
& layer_bounds
);
40 static scoped_refptr
<FakePicturePileImpl
>
41 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size
& tile_size
,
42 const gfx::Size
& layer_bounds
,
44 static scoped_refptr
<FakePicturePileImpl
> CreateInfiniteFilledPile();
45 static scoped_refptr
<FakePicturePileImpl
> CreateFromPile(
46 const PicturePile
* other
,
47 base::WaitableEvent
* playback_allowed_event
);
49 // Hi-jack the PlaybackToCanvas method to delay its completion.
50 void PlaybackToCanvas(SkCanvas
* canvas
,
51 const gfx::Rect
& canvas_bitmap_rect
,
52 const gfx::Rect
& canvas_playback_rect
,
53 float contents_scale
) const override
;
55 const TilingData
& tiling() { return tiling_
; }
57 bool HasRecordingAt(int x
, int y
) const;
58 int num_tiles_x() const { return tiling_
.num_tiles_x(); }
59 int num_tiles_y() const { return tiling_
.num_tiles_y(); }
62 FakePicturePileImpl();
63 FakePicturePileImpl(const PicturePile
* other
,
64 base::WaitableEvent
* playback_allowed_event
);
65 ~FakePicturePileImpl() override
;
67 base::WaitableEvent
* playback_allowed_event_
;
72 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_