Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Oct 9, 2024

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.

}

void Canvas::ClipGeometry(std::unique_ptr<Geometry> geometry,
void Canvas::ClipGeometry(const Geometry& geometry,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined AddClipEntityToCurrentPass into this method, since its all only called in one place.


void AddClipEntityToCurrentPass(Entity& entity);

void RestoreClip();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't ever need to create a restore entity anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

using ColorFilterProc = std::function<Color(Color)>;

struct ClipCoverage {
enum class Type { kNoChange, kAppend, kRestore };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(
Copy link
Contributor Author

@jonahwilliams jonahwilliams Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, not virtual on ClipContents anymore.

return contents_->GetCoverage(*this);
}

Contents::ClipCoverage Entity::GetClipCoverage(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

Entity& entity,
size_t clip_height_floor,
Point global_pass_position) {
EntityPassClipStack::ClipStateResult EntityPassClipStack::RecordRestore(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather that work generic over entities, there is now a RecordClip and RecordRestore operation.

@jonahwilliams jonahwilliams changed the title [Impeller][WIP] Remove polymorphism from clip recording. [Impeller] Remove polymorphism from clip recording. Oct 9, 2024
@jonahwilliams jonahwilliams marked this pull request as ready for review October 9, 2024 20:51
auto-submit bot pushed a commit that referenced this pull request Oct 22, 2024
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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant