| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_RECORDING_SOURCE_H_ | 5 #ifndef CC_TEST_FAKE_RECORDING_SOURCE_H_ |
| 6 #define CC_TEST_FAKE_RECORDING_SOURCE_H_ | 6 #define CC_TEST_FAKE_RECORDING_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 size_t painter_reported_memory_usage = | 78 size_t painter_reported_memory_usage = |
| 79 client_.GetApproximateUnsharedMemoryUsage(); | 79 client_.GetApproximateUnsharedMemoryUsage(); |
| 80 UpdateAndExpandInvalidation(&invalidation, size_, new_recorded_viewport); | 80 UpdateAndExpandInvalidation(&invalidation, size_, new_recorded_viewport); |
| 81 UpdateDisplayItemList(display_list, painter_reported_memory_usage); | 81 UpdateDisplayItemList(display_list, painter_reported_memory_usage); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void add_draw_rect(const gfx::Rect& rect) { | 84 void add_draw_rect(const gfx::Rect& rect) { |
| 85 client_.add_draw_rect(rect, default_paint_); | 85 client_.add_draw_rect(rect, default_paint_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) { | 88 void add_draw_rect_with_paint(const gfx::Rect& rect, const CdlPaint& paint) { |
| 89 client_.add_draw_rect(rect, paint); | 89 client_.add_draw_rect(rect, paint); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void add_draw_rectf(const gfx::RectF& rect) { | 92 void add_draw_rectf(const gfx::RectF& rect) { |
| 93 client_.add_draw_rectf(rect, default_paint_); | 93 client_.add_draw_rectf(rect, default_paint_); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void add_draw_rectf_with_paint(const gfx::RectF& rect, const SkPaint& paint) { | 96 void add_draw_rectf_with_paint(const gfx::RectF& rect, |
| 97 const CdlPaint& paint) { |
| 97 client_.add_draw_rectf(rect, paint); | 98 client_.add_draw_rectf(rect, paint); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void add_draw_image(sk_sp<const SkImage> image, const gfx::Point& point) { | 101 void add_draw_image(sk_sp<const SkImage> image, const gfx::Point& point) { |
| 101 client_.add_draw_image(std::move(image), point, default_paint_); | 102 client_.add_draw_image(std::move(image), point, default_paint_); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void add_draw_image_with_transform(sk_sp<const SkImage> image, | 105 void add_draw_image_with_transform(sk_sp<const SkImage> image, |
| 105 const gfx::Transform& transform) { | 106 const gfx::Transform& transform) { |
| 106 client_.add_draw_image_with_transform(std::move(image), transform, | 107 client_.add_draw_image_with_transform(std::move(image), transform, |
| 107 default_paint_); | 108 default_paint_); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void add_draw_image_with_paint(sk_sp<const SkImage> image, | 111 void add_draw_image_with_paint(sk_sp<const SkImage> image, |
| 111 const gfx::Point& point, | 112 const gfx::Point& point, |
| 112 const SkPaint& paint) { | 113 const CdlPaint& paint) { |
| 113 client_.add_draw_image(std::move(image), point, paint); | 114 client_.add_draw_image(std::move(image), point, paint); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; } | 117 void set_default_paint(const CdlPaint& paint) { default_paint_ = paint; } |
| 117 | 118 |
| 118 void set_reported_memory_usage(size_t reported_memory_usage) { | 119 void set_reported_memory_usage(size_t reported_memory_usage) { |
| 119 client_.set_reported_memory_usage(reported_memory_usage); | 120 client_.set_reported_memory_usage(reported_memory_usage); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void reset_draws() { | 123 void reset_draws() { |
| 123 client_ = FakeContentLayerClient(); | 124 client_ = FakeContentLayerClient(); |
| 124 client_.set_bounds(size_); | 125 client_.set_bounds(size_); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void SetPlaybackAllowedEvent(base::WaitableEvent* event) { | 128 void SetPlaybackAllowedEvent(base::WaitableEvent* event) { |
| 128 playback_allowed_event_ = event; | 129 playback_allowed_event_ = event; |
| 129 } | 130 } |
| 130 | 131 |
| 131 // Checks that the basic properties of the |other| match |this|. For the | 132 // Checks that the basic properties of the |other| match |this|. For the |
| 132 // DisplayItemList, it checks that the painted result matches the painted | 133 // DisplayItemList, it checks that the painted result matches the painted |
| 133 // result of |other|. | 134 // result of |other|. |
| 134 bool EqualsTo(const FakeRecordingSource& other); | 135 bool EqualsTo(const FakeRecordingSource& other); |
| 135 | 136 |
| 136 private: | 137 private: |
| 137 FakeContentLayerClient client_; | 138 FakeContentLayerClient client_; |
| 138 SkPaint default_paint_; | 139 CdlPaint default_paint_; |
| 139 base::WaitableEvent* playback_allowed_event_; | 140 base::WaitableEvent* playback_allowed_event_; |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 } // namespace cc | 143 } // namespace cc |
| 143 | 144 |
| 144 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ | 145 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ |
| OLD | NEW |