 |
Flutter Impeller
|
|
Go to the documentation of this file.
5 #ifndef FLUTTER_IMPELLER_ENTITY_ENTITY_PASS_H_
6 #define FLUTTER_IMPELLER_ENTITY_ENTITY_PASS_H_
24 class EntityPassClipRecorder;
37 using Element = std::variant<Entity, std::unique_ptr<EntityPass>>;
43 const Matrix& effect_transform,
57 void SetDelegate(std::shared_ptr<EntityPassDelegate> delgate);
74 std::unique_ptr<EntityPass>
Clone()
const;
116 const std::function<
bool(
const Entity&)>& iterator)
const;
170 std::optional<Rect> coverage_limit)
const;
173 std::optional<Rect> coverage_limit)
const;
176 struct EntityResult {
192 Status status = kFailure;
194 static EntityResult Success(
Entity e) {
return {std::move(e), kSuccess}; }
195 static EntityResult Failure() {
return {{}, kFailure}; }
196 static EntityResult Skip() {
return {{}, kSkip}; }
199 bool RenderElement(Entity& element_entity,
200 size_t clip_depth_floor,
201 InlinePassContext& pass_context,
203 ContentContext& renderer,
205 Point global_pass_position)
const;
208 ContentContext& renderer,
210 InlinePassContext& pass_context,
211 ISize root_pass_size,
212 Point global_pass_position,
215 size_t clip_depth_floor)
const;
274 bool OnRender(ContentContext& renderer,
276 ISize root_pass_size,
277 EntityPassTarget& pass_target,
278 Point global_pass_position,
279 Point local_pass_position,
282 size_t clip_depth_floor = 0,
283 std::shared_ptr<Contents> backdrop_filter_contents =
nullptr,
284 const std::optional<InlinePassContext::RenderPassResult>&
285 collapsed_parent_pass = std::nullopt)
const;
289 std::vector<Element> elements_;
293 size_t clip_depth_ = 0u;
295 bool flood_clip_ =
false;
296 bool enable_offscreen_debug_checkerboard_ =
false;
297 std::optional<Rect> bounds_limit_;
298 std::unique_ptr<EntityPassClipRecorder> clip_replay_ =
299 std::make_unique<EntityPassClipRecorder>();
309 uint32_t advanced_blend_reads_from_pass_texture_ = 0;
310 uint32_t backdrop_filter_reads_from_pass_texture_ = 0;
312 uint32_t GetTotalPassReads(ContentContext& renderer)
const;
316 std::shared_ptr<EntityPassDelegate> delegate_ =
341 std::vector<Entity> rendered_clip_entities_;
346 #endif // FLUTTER_IMPELLER_ENTITY_ENTITY_PASS_H_
void AddSubpassInline(std::unique_ptr< EntityPass > pass)
Merges a given pass into this pass. Useful for drawing pre-recorded pictures that don't require rende...
void IterateAllEntities(const std::function< bool(Entity &)> &iterator)
Iterate all entities in this pass, recursively including entities of child passes....
void RecordEntity(const Entity &entity, Contents::ClipCoverage::Type type)
Record the entity based on the provided coverage [type].
void SetBackdropFilter(BackdropFilterProc proc)
const std::vector< Entity > & GetReplayEntities() const
std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> BackdropFilterProc
std::optional< Rect > GetSubpassCoverage(const EntityPass &subpass, std::optional< Rect > coverage_limit) const
Computes the coverage of a given subpass. This is used to determine the texture size of a given subpa...
size_t GetSubpassesDepth() const
void SetBoundsLimit(std::optional< Rect > bounds_limit)
Set the bounds limit, which is provided by the user when creating a SaveLayer. This is a hint that al...
static std::unique_ptr< EntityPassDelegate > MakeDefault()
EntityPass * AddSubpass(std::unique_ptr< EntityPass > pass)
Appends a given pass as a subpass.
bool IterateUntilSubpass(const std::function< bool(Entity &)> &iterator)
Iterate entities in this pass up until the first subpass is found. This is useful for limiting look-a...
void IterateAllElements(const std::function< bool(Element &)> &iterator)
Iterate all elements (entities and subpasses) in this pass, recursively including elements of child p...
std::vector< ClipCoverageLayer > ClipCoverageStack
std::optional< Rect > GetElementsCoverage(std::optional< Rect > coverage_limit) const
void SetClipDepth(size_t clip_depth)
void SetBlendMode(BlendMode blend_mode)
void SetElements(std::vector< Element > elements)
std::optional< Rect > GetBoundsLimit() const
Get the bounds limit, which is provided by the user when creating a SaveLayer.
EntityPass * GetSuperpass() const
~EntityPassClipRecorder()=default
std::optional< Rect > coverage
std::variant< Entity, std::unique_ptr< EntityPass > > Element
size_t GetElementCount() const
Return the number of elements on this pass.
void SetTransform(Matrix transform)
A class that tracks all clips that have been recorded in the current entity pass stencil.
bool Render(ContentContext &renderer, const RenderTarget &render_target) const
static constexpr TSize Infinite()
static const std::string kCaptureDocumentName
void SetDelegate(std::shared_ptr< EntityPassDelegate > delgate)
void SetEnableOffscreenCheckerboard(bool enabled)
A 4x4 matrix using column-major storage.
std::optional< Color > GetClearColor(ISize size=ISize::Infinite()) const
Return the premultiplied clear color of the pass entities, if any.
Color GetClearColorOrDefault(ISize size=ISize::Infinite()) const
Return the premultiplied clear color of the pass entities.
void AddEntity(Entity entity)
Add an entity to the current entity pass.
std::unique_ptr< EntityPass > Clone() const