8
8
9
9
#include " flutter/fml/logging.h"
10
10
#include " impeller/aiks/paint_pass_delegate.h"
11
- #include " impeller/entity/contents/clear_contents.h"
12
11
#include " impeller/entity/contents/clip_contents.h"
13
12
#include " impeller/entity/contents/text_contents.h"
14
13
#include " impeller/entity/contents/texture_contents.h"
@@ -111,10 +110,9 @@ void Canvas::RestoreToCount(size_t count) {
111
110
void Canvas::DrawPath (Path path, Paint paint) {
112
111
Entity entity;
113
112
entity.SetTransformation (GetCurrentTransformation ());
114
- entity.SetPath (std::move (path));
115
113
entity.SetStencilDepth (GetStencilDepth ());
116
114
entity.SetBlendMode (paint.blend_mode );
117
- entity.SetContents (paint.WithFilters (paint.CreateContentsForEntity ()));
115
+ entity.SetContents (paint.WithFilters (paint.CreateContentsForEntity (std::move (path) )));
118
116
119
117
GetCurrentPass ().AddEntity (std::move (entity));
120
118
}
@@ -124,8 +122,7 @@ void Canvas::DrawPaint(Paint paint) {
124
122
entity.SetTransformation (GetCurrentTransformation ());
125
123
entity.SetStencilDepth (GetStencilDepth ());
126
124
entity.SetBlendMode (paint.blend_mode );
127
- entity.SetContents (
128
- std::make_shared<ClearContents>(paint.CreateContentsForEntity ()));
125
+ entity.SetContents (paint.CreateContentsForEntity ({}, true ));
129
126
130
127
GetCurrentPass ().AddEntity (std::move (entity));
131
128
}
@@ -158,11 +155,11 @@ void Canvas::SaveLayer(Paint paint, std::optional<Rect> bounds) {
158
155
159
156
void Canvas::ClipPath (Path path, Entity::ClipOperation clip_op) {
160
157
auto contents = std::make_shared<ClipContents>();
158
+ contents->SetPath (std::move (path));
161
159
contents->SetClipOperation (clip_op);
162
160
163
161
Entity entity;
164
162
entity.SetTransformation (GetCurrentTransformation ());
165
- entity.SetPath (std::move (path));
166
163
entity.SetContents (std::move (contents));
167
164
entity.SetStencilDepth (GetStencilDepth ());
168
165
entity.SetAddsToCoverage (false );
@@ -178,7 +175,6 @@ void Canvas::RestoreClip() {
178
175
entity.SetTransformation (GetCurrentTransformation ());
179
176
// This path is empty because ClipRestoreContents just generates a quad that
180
177
// takes up the full render target.
181
- entity.SetPath ({});
182
178
entity.SetContents (std::make_shared<ClipRestoreContents>());
183
179
entity.SetStencilDepth (GetStencilDepth ());
184
180
entity.SetAddsToCoverage (false );
@@ -234,12 +230,12 @@ void Canvas::DrawImageRect(std::shared_ptr<Image> image,
234
230
}
235
231
236
232
auto contents = std::make_shared<TextureContents>();
233
+ contents->SetPath (PathBuilder{}.AddRect (dest).TakePath ());
237
234
contents->SetTexture (image->GetTexture ());
238
235
contents->SetSourceRect (source);
239
236
contents->SetSamplerDescriptor (std::move (sampler));
240
237
241
238
Entity entity;
242
- entity.SetPath (PathBuilder{}.AddRect (dest).TakePath ());
243
239
entity.SetBlendMode (paint.blend_mode );
244
240
entity.SetStencilDepth (GetStencilDepth ());
245
241
entity.SetContents (paint.WithFilters (contents, false ));
@@ -293,7 +289,6 @@ void Canvas::DrawTextFrame(TextFrame text_frame, Point position, Paint paint) {
293
289
Entity entity;
294
290
entity.SetTransformation (GetCurrentTransformation () *
295
291
Matrix::MakeTranslation (position));
296
- entity.SetPath ({});
297
292
entity.SetStencilDepth (GetStencilDepth ());
298
293
entity.SetBlendMode (paint.blend_mode );
299
294
entity.SetContents (paint.WithFilters (std::move (text_contents), true ));
0 commit comments