| 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 | 13 |
| 14 class FakePicturePileImpl : public PicturePileImpl { | 14 class FakePicturePileImpl : public PicturePileImpl { |
| 15 public: | 15 public: |
| 16 static scoped_refptr<FakePicturePileImpl> CreateFilledPile( | 16 static scoped_refptr<FakePicturePileImpl> CreateFilledPile( |
| 17 gfx::Size tile_size, | 17 gfx::Size tile_size, |
| 18 gfx::Size layer_bounds); | 18 gfx::Size layer_bounds); |
| 19 | 19 |
| 20 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile( | 20 static scoped_refptr<FakePicturePileImpl> CreateEmptyPile( |
| 21 gfx::Size tile_size, | 21 gfx::Size tile_size, |
| 22 gfx::Size layer_bounds); | 22 gfx::Size layer_bounds); |
| 23 | 23 |
| 24 TilingData& tiling() { return tiling_; } | 24 TilingData& tiling() { return tiling_; } |
| 25 | 25 |
| 26 void AddRecordingAt(int x, int y); | 26 void AddRecordingAt(int x, int y); |
| 27 | |
| 28 void RemoveRecordingAt(int x, int y); | 27 void RemoveRecordingAt(int x, int y); |
| 28 void RerecordPile(); |
| 29 | 29 |
| 30 void AddPictureToRecording( | 30 void AddPictureToRecording( |
| 31 int x, | 31 int x, |
| 32 int y, | 32 int y, |
| 33 scoped_refptr<Picture> picture); | 33 scoped_refptr<Picture> picture); |
| 34 | 34 |
| 35 void add_draw_rect(gfx::Rect rect) { | 35 void add_draw_rect(const gfx::RectF& rect) { |
| 36 client_.add_draw_rect(rect, default_paint_); | 36 client_.add_draw_rect(rect, default_paint_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void add_draw_bitmap(const SkBitmap& bitmap, gfx::Point point) { | 39 void add_draw_bitmap(const SkBitmap& bitmap, gfx::Point point) { |
| 40 client_.add_draw_bitmap(bitmap, point); | 40 client_.add_draw_bitmap(bitmap, point); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void add_draw_rect_with_paint(gfx::Rect rect, const SkPaint& paint) { | 43 void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) { |
| 44 client_.add_draw_rect(rect, paint); | 44 client_.add_draw_rect(rect, paint); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void set_default_paint(const SkPaint& paint) { | 47 void set_default_paint(const SkPaint& paint) { |
| 48 default_paint_ = paint; | 48 default_paint_ = paint; |
| 49 } | 49 } |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 FakePicturePileImpl(); | 52 FakePicturePileImpl(); |
| 53 virtual ~FakePicturePileImpl(); | 53 virtual ~FakePicturePileImpl(); |
| 54 | 54 |
| 55 FakeContentLayerClient client_; | 55 FakeContentLayerClient client_; |
| 56 SkPaint default_paint_; | 56 SkPaint default_paint_; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace cc | 59 } // namespace cc |
| 60 | 60 |
| 61 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ | 61 #endif // CC_TEST_FAKE_PICTURE_PILE_IMPL_H_ |
| OLD | NEW |