| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_H_ | 5 #ifndef CC_TEST_FAKE_PICTURE_PILE_H_ |
| 6 #define CC_TEST_FAKE_PICTURE_PILE_H_ | 6 #define CC_TEST_FAKE_PICTURE_PILE_H_ |
| 7 | 7 |
| 8 #include "cc/resources/picture_pile.h" | 8 #include "cc/resources/picture_pile.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 class ThreadBlocker; |
| 11 | 12 |
| 12 class FakePicturePile : public PicturePile { | 13 class FakePicturePile : public PicturePile { |
| 13 public: | 14 public: |
| 15 FakePicturePile() : raster_thread_blocker_(nullptr) {} |
| 14 ~FakePicturePile() override {} | 16 ~FakePicturePile() override {} |
| 15 | 17 |
| 18 // PicturePile overrides. |
| 19 scoped_refptr<RasterSource> CreateRasterSource() const override; |
| 20 |
| 16 using PicturePile::buffer_pixels; | 21 using PicturePile::buffer_pixels; |
| 17 using PicturePile::CanRasterSlowTileCheck; | 22 using PicturePile::CanRasterSlowTileCheck; |
| 18 using PicturePile::Clear; | 23 using PicturePile::Clear; |
| 19 | 24 |
| 20 PictureMap& picture_map() { return picture_map_; } | 25 PictureMap& picture_map() { return picture_map_; } |
| 21 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; } | 26 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; } |
| 22 | 27 |
| 23 bool CanRasterLayerRect(gfx::Rect layer_rect) { | 28 bool CanRasterLayerRect(gfx::Rect layer_rect) { |
| 24 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size())); | 29 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size())); |
| 25 if (recorded_viewport_.Contains(layer_rect)) | 30 if (recorded_viewport_.Contains(layer_rect)) |
| 26 return true; | 31 return true; |
| 27 return CanRasterSlowTileCheck(layer_rect); | 32 return CanRasterSlowTileCheck(layer_rect); |
| 28 } | 33 } |
| 29 | 34 |
| 30 bool HasRecordings() const { return has_any_recordings_; } | 35 bool HasRecordings() const { return has_any_recordings_; } |
| 31 | 36 |
| 32 void SetRecordedViewport(const gfx::Rect& viewport) { | 37 void SetRecordedViewport(const gfx::Rect& viewport) { |
| 33 recorded_viewport_ = viewport; | 38 recorded_viewport_ = viewport; |
| 34 } | 39 } |
| 35 | 40 |
| 36 void SetHasAnyRecordings(bool has_recordings) { | 41 void SetHasAnyRecordings(bool has_recordings) { |
| 37 has_any_recordings_ = has_recordings; | 42 has_any_recordings_ = has_recordings; |
| 38 } | 43 } |
| 39 | 44 |
| 45 void SetRasterThreadBlocker(ThreadBlocker* blocker) { |
| 46 raster_thread_blocker_ = blocker; |
| 47 } |
| 48 |
| 40 TilingData& tiling() { return tiling_; } | 49 TilingData& tiling() { return tiling_; } |
| 41 | 50 |
| 42 bool is_solid_color() const { return is_solid_color_; } | 51 bool is_solid_color() const { return is_solid_color_; } |
| 43 SkColor solid_color() const { return solid_color_; } | 52 SkColor solid_color() const { return solid_color_; } |
| 44 | 53 |
| 45 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } | 54 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } |
| 46 | 55 |
| 47 typedef PicturePile::PictureInfo PictureInfo; | 56 typedef PicturePile::PictureInfo PictureInfo; |
| 48 typedef PicturePile::PictureMapKey PictureMapKey; | 57 typedef PicturePile::PictureMapKey PictureMapKey; |
| 49 typedef PicturePile::PictureMap PictureMap; | 58 typedef PicturePile::PictureMap PictureMap; |
| 59 |
| 60 private: |
| 61 ThreadBlocker* raster_thread_blocker_; |
| 50 }; | 62 }; |
| 63 |
| 51 } // namespace cc | 64 } // namespace cc |
| 52 | 65 |
| 53 #endif // CC_TEST_FAKE_PICTURE_PILE_H_ | 66 #endif // CC_TEST_FAKE_PICTURE_PILE_H_ |
| OLD | NEW |