[Impeller] Remove polymorphism from clip recording.#55784
[Impeller] Remove polymorphism from clip recording.#55784jonahwilliams wants to merge 11 commits intoflutter:mainfrom
Conversation
| } | ||
|
|
||
| void Canvas::ClipGeometry(std::unique_ptr<Geometry> geometry, | ||
| void Canvas::ClipGeometry(const Geometry& geometry, |
There was a problem hiding this comment.
I combined AddClipEntityToCurrentPass into this method, since its all only called in one place.
|
|
||
| void AddClipEntityToCurrentPass(Entity& entity); | ||
|
|
||
| void RestoreClip(); |
There was a problem hiding this comment.
This one was unused.
| /// depth should be the depth of the entity that is currently being drawn, and | ||
| /// restore_coverage should be its coverage. If restore_coverage is | ||
| /// std::nullopt, the render pass coverage is used instead. | ||
| bool RenderClipRestore(const ContentContext& renderer, |
There was a problem hiding this comment.
We don't ever need to create a restore entity anymore.
There was a problem hiding this comment.
Either its a save restore in which case we do nothing (since we keep incrementing depth) or a saveLayer in which case we don't need to restore since we're ending the pass.
| return false; | ||
| } | ||
|
|
||
| Contents::ClipCoverage Contents::GetClipCoverage( |
| using ColorFilterProc = std::function<Color(Color)>; | ||
|
|
||
| struct ClipCoverage { | ||
| enum class Type { kNoChange, kAppend, kRestore }; |
There was a problem hiding this comment.
This enum was no longer used, moved struct to clip contents
| /// During rendering, coverage coordinates count pixels from the top | ||
| /// left corner of the framebuffer. | ||
| /// | ||
| virtual ClipCoverage GetClipCoverage( |
There was a problem hiding this comment.
Unused, not virtual on ClipContents anymore.
impeller/entity/contents/filters/gaussian_blur_filter_contents.cc
Outdated
Show resolved
Hide resolved
| return contents_->GetCoverage(*this); | ||
| } | ||
|
|
||
| Contents::ClipCoverage Entity::GetClipCoverage( |
| Entity& entity, | ||
| size_t clip_height_floor, | ||
| Point global_pass_position) { | ||
| EntityPassClipStack::ClipStateResult EntityPassClipStack::RecordRestore( |
There was a problem hiding this comment.
Rather that work generic over entities, there is now a RecordClip and RecordRestore operation.
Now that we don't have the entity pass structure, clips can be treated as a kind of structured data and not a generic entity. Doing so lets us simplify some of the clip management and remove some usage of raw pointers. This change also removes the ClipRestoreContents, which are only ever created and then immediately rendered - we can instead replace this with a function. The ClipCoverageStack now has explicit Clip/Restore methods that internally apply the same logic, but without involving the entity object. Redo of #55784
Now that we don't have the entity pass structure, clips can be treated as a kind of structured data and not a generic entity. Doing so lets us simplify some of the clip management and remove some usage of raw pointers. This change also removes the ClipRestoreContents, which are only ever created and then immediately rendered - we can instead replace this with a function. The ClipCoverageStack now has explicit Clip/Restore methods that internally apply the same logic, but without involving the entity object. Redo of flutter/engine#55784
Now that we don't have the entity pass structure, clips can be treated as a kind of structured data and not a generic entity. Doing so lets us simplify some of the clip management and remove some usage of raw pointers. This change also removes the ClipRestoreContents, which are only ever created and then immediately rendered - we can instead replace this with a function.
The ClipCoverageStack now has explicit Clip/Restore methods that internally apply the same logic, but without involving the entity object.