| 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/resources/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 bool is_filled); | |
| 24 | |
| 25 static scoped_refptr<FakePicturePileImpl> CreateFilledPileWithDefaultTileSize( | |
| 26 const gfx::Size& layer_bounds) { | |
| 27 return CreateFilledPile(gfx::Size(512, 512), layer_bounds); | |
| 28 } | |
| 29 static scoped_refptr<FakePicturePileImpl> CreateEmptyPileWithDefaultTileSize( | |
| 30 const gfx::Size& layer_bounds) { | |
| 31 return CreateEmptyPile(gfx::Size(512, 512), layer_bounds); | |
| 32 } | |
| 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, | |
| 42 bool is_solid_color); | |
| 43 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile(); | |
| 44 static scoped_refptr<FakePicturePileImpl> CreateFromPile( | |
| 45 const PicturePile* other, | |
| 46 base::WaitableEvent* playback_allowed_event); | |
| 47 | |
| 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; | |
| 52 | |
| 53 const TilingData& tiling() { return tiling_; } | |
| 54 | |
| 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(); } | |
| 58 | |
| 59 protected: | |
| 60 FakePicturePileImpl(); | |
| 61 FakePicturePileImpl(const PicturePile* other, | |
| 62 base::WaitableEvent* playback_allowed_event); | |
| 63 ~FakePicturePileImpl() override; | |
| 64 | |
| 65 base::WaitableEvent* playback_allowed_event_; | |
| 66 gfx::Size tile_grid_size_; | |
| 67 }; | |
| 68 | |
| 69 } // namespace cc | |
| 70 | |
| 71 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | |
| OLD | NEW |