Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: cc/test/fake_recording_source.h

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
89 const PaintFlags& paint) {
89 client_.add_draw_rect(rect, paint); 90 client_.add_draw_rect(rect, paint);
90 } 91 }
91 92
92 void add_draw_rectf(const gfx::RectF& rect) { 93 void add_draw_rectf(const gfx::RectF& rect) {
93 client_.add_draw_rectf(rect, default_paint_); 94 client_.add_draw_rectf(rect, default_paint_);
94 } 95 }
95 96
96 void add_draw_rectf_with_paint(const gfx::RectF& rect, const SkPaint& paint) { 97 void add_draw_rectf_with_paint(const gfx::RectF& rect,
98 const PaintFlags& paint) {
97 client_.add_draw_rectf(rect, paint); 99 client_.add_draw_rectf(rect, paint);
98 } 100 }
99 101
100 void add_draw_image(sk_sp<const SkImage> image, const gfx::Point& point) { 102 void add_draw_image(sk_sp<const SkImage> image, const gfx::Point& point) {
101 client_.add_draw_image(std::move(image), point, default_paint_); 103 client_.add_draw_image(std::move(image), point, default_paint_);
102 } 104 }
103 105
104 void add_draw_image_with_transform(sk_sp<const SkImage> image, 106 void add_draw_image_with_transform(sk_sp<const SkImage> image,
105 const gfx::Transform& transform) { 107 const gfx::Transform& transform) {
106 client_.add_draw_image_with_transform(std::move(image), transform, 108 client_.add_draw_image_with_transform(std::move(image), transform,
107 default_paint_); 109 default_paint_);
108 } 110 }
109 111
110 void add_draw_image_with_paint(sk_sp<const SkImage> image, 112 void add_draw_image_with_paint(sk_sp<const SkImage> image,
111 const gfx::Point& point, 113 const gfx::Point& point,
112 const SkPaint& paint) { 114 const PaintFlags& paint) {
113 client_.add_draw_image(std::move(image), point, paint); 115 client_.add_draw_image(std::move(image), point, paint);
114 } 116 }
115 117
116 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; } 118 void set_default_paint(const PaintFlags& paint) { default_paint_ = paint; }
117 119
118 void set_reported_memory_usage(size_t reported_memory_usage) { 120 void set_reported_memory_usage(size_t reported_memory_usage) {
119 client_.set_reported_memory_usage(reported_memory_usage); 121 client_.set_reported_memory_usage(reported_memory_usage);
120 } 122 }
121 123
122 void reset_draws() { 124 void reset_draws() {
123 client_ = FakeContentLayerClient(); 125 client_ = FakeContentLayerClient();
124 client_.set_bounds(size_); 126 client_.set_bounds(size_);
125 } 127 }
126 128
127 void SetPlaybackAllowedEvent(base::WaitableEvent* event) { 129 void SetPlaybackAllowedEvent(base::WaitableEvent* event) {
128 playback_allowed_event_ = event; 130 playback_allowed_event_ = event;
129 } 131 }
130 132
131 // Checks that the basic properties of the |other| match |this|. For the 133 // Checks that the basic properties of the |other| match |this|. For the
132 // DisplayItemList, it checks that the painted result matches the painted 134 // DisplayItemList, it checks that the painted result matches the painted
133 // result of |other|. 135 // result of |other|.
134 bool EqualsTo(const FakeRecordingSource& other); 136 bool EqualsTo(const FakeRecordingSource& other);
135 137
136 private: 138 private:
137 FakeContentLayerClient client_; 139 FakeContentLayerClient client_;
138 SkPaint default_paint_; 140 PaintFlags default_paint_;
139 base::WaitableEvent* playback_allowed_event_; 141 base::WaitableEvent* playback_allowed_event_;
140 }; 142 };
141 143
142 } // namespace cc 144 } // namespace cc
143 145
144 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ 146 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698