OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | |
6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "cc/playback/picture_pile_impl.h" | |
10 #include "cc/test/fake_picture_pile.h" | |
11 | |
12 namespace base { | |
13 class WaitableEvent; | |
14 } | |
15 | |
16 namespace cc { | |
17 | |
18 class FakePicturePileImpl : public PicturePileImpl { | |
19 public: | |
20 static scoped_refptr<FakePicturePileImpl> CreatePile( | |
21 const gfx::Size& tile_size, | |
22 const gfx::Size& layer_bounds, | |
23 const gfx::Rect& recorded_viewport, | |
24 bool is_filled); | |
25 | |
26 static scoped_refptr<FakePicturePileImpl> CreateFilledPileWithDefaultTileSize( | |
27 const gfx::Size& layer_bounds) { | |
28 return CreateFilledPile(gfx::Size(512, 512), layer_bounds); | |
29 } | |
30 static scoped_refptr<FakePicturePileImpl> CreateEmptyPileWithDefaultTileSize( | |
31 const gfx::Size& layer_bounds) { | |
32 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds); | |
33 } | |
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, | |
43 bool is_solid_color); | |
44 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile(); | |
45 static scoped_refptr<FakePicturePileImpl> CreateFromPile( | |
46 const PicturePile* other, | |
47 base::WaitableEvent* playback_allowed_event); | |
48 | |
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; | |
54 | |
55 const TilingData& tiling() { return tiling_; } | |
56 | |
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(); } | |
60 | |
61 protected: | |
62 FakePicturePileImpl(); | |
63 FakePicturePileImpl(const PicturePile* other, | |
64 base::WaitableEvent* playback_allowed_event); | |
65 ~FakePicturePileImpl() override; | |
66 | |
67 base::WaitableEvent* playback_allowed_event_; | |
68 }; | |
69 | |
70 } // namespace cc | |
71 | |
72 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | |
OLD | NEW |