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/playback/picture_pile.h" | 8 #include "cc/playback/picture_pile.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 TilingData& tiling() { return tiling_; } | 72 TilingData& tiling() { return tiling_; } |
73 | 73 |
74 bool is_solid_color() const { return is_solid_color_; } | 74 bool is_solid_color() const { return is_solid_color_; } |
75 SkColor solid_color() const { return solid_color_; } | 75 SkColor solid_color() const { return solid_color_; } |
76 void SetIsSolidColor(bool is_solid) { is_solid_color_ = is_solid; } | 76 void SetIsSolidColor(bool is_solid) { is_solid_color_ = is_solid; } |
77 | 77 |
78 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } | 78 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } |
79 | 79 |
80 void add_draw_rect(const gfx::RectF& rect) { | 80 void add_draw_rect(const gfx::Rect& rect) { |
81 client_.add_draw_rect(rect, default_paint_); | 81 client_.add_draw_rect(rect, default_paint_); |
82 } | 82 } |
83 | 83 |
84 void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) { | 84 void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) { |
85 client_.add_draw_bitmap(bitmap, point, default_paint_); | |
86 } | |
87 | |
88 void add_draw_rect_with_paint(const gfx::RectF& rect, const SkPaint& paint) { | |
89 client_.add_draw_rect(rect, paint); | 85 client_.add_draw_rect(rect, paint); |
90 } | 86 } |
91 | 87 |
| 88 void add_draw_rectf(const gfx::RectF& rect) { |
| 89 client_.add_draw_rectf(rect, default_paint_); |
| 90 } |
| 91 |
| 92 void add_draw_rectf_with_paint(const gfx::RectF& rect, const SkPaint& paint) { |
| 93 client_.add_draw_rectf(rect, paint); |
| 94 } |
| 95 |
| 96 void add_draw_bitmap(const SkBitmap& bitmap, const gfx::Point& point) { |
| 97 add_draw_bitmap_with_paint(bitmap, point, default_paint_); |
| 98 } |
| 99 |
92 void add_draw_bitmap_with_paint(const SkBitmap& bitmap, | 100 void add_draw_bitmap_with_paint(const SkBitmap& bitmap, |
93 const gfx::Point& point, | 101 const gfx::Point& point, |
94 const SkPaint& paint) { | 102 const SkPaint& paint) { |
95 client_.add_draw_bitmap(bitmap, point, paint); | 103 client_.add_draw_bitmap(bitmap, point, paint); |
96 } | 104 } |
97 | 105 |
98 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; } | 106 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; } |
99 | 107 |
100 void AddRecordingAt(int x, int y); | 108 void AddRecordingAt(int x, int y); |
101 void RemoveRecordingAt(int x, int y); | 109 void RemoveRecordingAt(int x, int y); |
102 bool HasRecordingAt(int x, int y) const; | 110 bool HasRecordingAt(int x, int y) const; |
103 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 111 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
104 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 112 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
105 void Rerecord(); | 113 void Rerecord(); |
106 | 114 |
107 private: | 115 private: |
108 base::WaitableEvent* playback_allowed_event_; | 116 base::WaitableEvent* playback_allowed_event_; |
109 | 117 |
110 FakeContentLayerClient client_; | 118 FakeContentLayerClient client_; |
111 SkPaint default_paint_; | 119 SkPaint default_paint_; |
112 }; | 120 }; |
113 | 121 |
114 } // namespace cc | 122 } // namespace cc |
115 | 123 |
116 #endif // CC_TEST_FAKE_PICTURE_PILE_H_ | 124 #endif // CC_TEST_FAKE_PICTURE_PILE_H_ |
OLD | NEW |