| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | 5 #ifndef CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ |
| 6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | 6 #define CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/resources/picture_pile_impl.h" | 9 #include "cc/resources/picture_pile_impl.h" |
| 10 #include "cc/test/fake_content_layer_client.h" | 10 #include "cc/test/fake_content_layer_client.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 class ThreadBlocker; |
| 13 | 14 |
| 14 class FakePicturePileImpl : public PicturePileImpl { | 15 class FakePicturePileImpl : public PicturePileImpl { |
| 15 public: | 16 public: |
| 16 static scoped_refptr<FakePicturePileImpl> CreateFilledPile( | 17 static scoped_refptr<FakePicturePileImpl> CreateFilledPile( |
| 17 const gfx::Size& tile_size, | 18 const gfx::Size& tile_size, |
| 18 const gfx::Size& layer_bounds); | 19 const gfx::Size& layer_bounds); |
| 19 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile( | 20 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile( |
| 20 const gfx::Size& tile_size, | 21 const gfx::Size& tile_size, |
| 21 const gfx::Size& layer_bounds); | 22 const gfx::Size& layer_bounds); |
| 22 static scoped_refptr<FakePicturePileImpl> | 23 static scoped_refptr<FakePicturePileImpl> |
| 23 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size& tile_size, | 24 CreateEmptyPileThatThinksItHasRecordings(const gfx::Size& tile_size, |
| 24 const gfx::Size& layer_bounds); | 25 const gfx::Size& layer_bounds); |
| 25 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile(); | 26 static scoped_refptr<FakePicturePileImpl> CreateInfiniteFilledPile(); |
| 27 static scoped_refptr<FakePicturePileImpl> CreateFromPile( |
| 28 const PicturePile* other, |
| 29 ThreadBlocker* blocker); |
| 30 |
| 31 // Hi-jack the PlaybackToCanvas method to delay its completion. |
| 32 void PlaybackToCanvas(SkCanvas* canvas, |
| 33 const gfx::Rect& canvas_rect, |
| 34 float contents_scale) const override; |
| 26 | 35 |
| 27 TilingData& tiling() { return tiling_; } | 36 TilingData& tiling() { return tiling_; } |
| 28 | 37 |
| 29 void AddRecordingAt(int x, int y); | 38 void AddRecordingAt(int x, int y); |
| 30 void RemoveRecordingAt(int x, int y); | 39 void RemoveRecordingAt(int x, int y); |
| 31 void RerecordPile(); | 40 void RerecordPile(); |
| 32 | 41 |
| 33 void add_draw_rect(const gfx::RectF& rect) { | 42 void add_draw_rect(const gfx::RectF& rect) { |
| 34 client_.add_draw_rect(rect, default_paint_); | 43 client_.add_draw_rect(rect, default_paint_); |
| 35 } | 44 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 86 |
| 78 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 87 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
| 79 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 88 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
| 80 | 89 |
| 81 void SetMinContentsScale(float scale); | 90 void SetMinContentsScale(float scale); |
| 82 void SetBufferPixels(int new_buffer_pixels); | 91 void SetBufferPixels(int new_buffer_pixels); |
| 83 void Clear(); | 92 void Clear(); |
| 84 | 93 |
| 85 protected: | 94 protected: |
| 86 FakePicturePileImpl(); | 95 FakePicturePileImpl(); |
| 87 explicit FakePicturePileImpl(const PicturePile* other); | 96 FakePicturePileImpl(const PicturePile* other, ThreadBlocker* blocker); |
| 88 ~FakePicturePileImpl() override; | 97 ~FakePicturePileImpl() override; |
| 89 | 98 |
| 90 FakeContentLayerClient client_; | 99 FakeContentLayerClient client_; |
| 91 SkPaint default_paint_; | 100 SkPaint default_paint_; |
| 101 ThreadBlocker* raster_thread_blocker_; |
| 92 SkTileGridFactory::TileGridInfo tile_grid_info_; | 102 SkTileGridFactory::TileGridInfo tile_grid_info_; |
| 93 }; | 103 }; |
| 94 | 104 |
| 95 } // namespace cc | 105 } // namespace cc |
| 96 | 106 |
| 97 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | 107 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ |
| OLD | NEW |