 |
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_
54 using Element = std::variant<Entity, std::unique_ptr<EntityPass>>;
60 const Matrix& effect_transform,
67 void SetDelegate(std::shared_ptr<EntityPassDelegate> delgate);
81 std::optional<Rect> bounds_limit,
103 void PopClips(
size_t num_clips, uint64_t depth);
133 const std::function<
bool(
const Element&)>& iterator)
const;
147 const std::function<
bool(
const Entity&)>& iterator)
const;
189 required_mip_count_ = mip_count;
211 std::optional<Rect> coverage_limit)
const;
214 std::optional<Rect> coverage_limit)
const;
217 struct EntityResult {
233 Status status = kFailure;
235 static EntityResult Success(Entity e) {
return {std::move(e), kSuccess}; }
236 static EntityResult Failure() {
return {{}, kFailure}; }
237 static EntityResult Skip() {
return {{}, kSkip}; }
240 bool RenderElement(Entity& element_entity,
241 size_t clip_depth_floor,
242 InlinePassContext& pass_context,
244 ContentContext& renderer,
245 EntityPassClipStack& clip_coverage_stack,
246 Point global_pass_position)
const;
249 ContentContext& renderer,
251 InlinePassContext& pass_context,
252 ISize root_pass_size,
253 Point global_pass_position,
255 EntityPassClipStack& clip_coverage_stack,
256 size_t clip_depth_floor)
const;
315 bool OnRender(ContentContext& renderer,
317 ISize root_pass_size,
318 EntityPassTarget& pass_target,
319 Point global_pass_position,
320 Point local_pass_position,
322 EntityPassClipStack& clip_coverage_stack,
323 size_t clip_depth_floor = 0,
324 std::shared_ptr<Contents> backdrop_filter_contents =
nullptr,
325 const std::optional<InlinePassContext::RenderPassResult>&
326 collapsed_parent_pass = std::nullopt)
const;
330 std::vector<Element> elements_;
336 std::vector<size_t> active_clips_;
340 size_t clip_depth_ = 0u;
341 uint32_t new_clip_depth_ = 1u;
343 bool flood_clip_ =
false;
344 bool enable_offscreen_debug_checkerboard_ =
false;
345 std::optional<Rect> bounds_limit_;
347 int32_t required_mip_count_ = 1;
357 uint32_t advanced_blend_reads_from_pass_texture_ = 0;
358 uint32_t backdrop_filter_reads_from_pass_texture_ = 0;
360 uint32_t GetTotalPassReads(ContentContext& renderer)
const;
364 std::shared_ptr<EntityPassDelegate> delegate_ =
374 #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....
uint32_t GetNewClipDepth() const
void SetBackdropFilter(BackdropFilterProc proc)
std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> BackdropFilterProc
void PopAllClips(uint64_t depth)
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...
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
size_t GetSubpassesDepth() const
void SetNewClipDepth(size_t clip_depth)
bool GetBoundsLimitMightClipContent() const
Indicates if the bounds limit set using |SetBoundsLimit()| might clip the contents of the pass.
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...
bool GetBoundsLimitIsSnug() const
Indicates if the bounds limit set using |SetBoundsLimit()| is a reasonably tight estimate of the boun...
void IterateAllElements(const std::function< bool(Element &)> &iterator)
Iterate all elements (entities and subpasses) in this pass, recursively including elements of child p...
@ kUnknown
The caller makes no claims related to the size of the bounds.
std::optional< Rect > GetElementsCoverage(std::optional< Rect > coverage_limit) const
void SetClipDepth(size_t clip_depth)
void SetBlendMode(BlendMode blend_mode)
size_t GetClipDepth() const
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
std::variant< Entity, std::unique_ptr< EntityPass > > Element
int32_t GetRequiredMipCount() const
size_t GetElementCount() const
Return the number of elements on this pass.
void SetTransform(Matrix transform)
void SetBoundsLimit(std::optional< Rect > bounds_limit, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown)
Set the bounds limit, which is provided by the user when creating a SaveLayer. This is a hint that al...
void PopClips(size_t num_clips, uint64_t depth)
void PushClip(Entity entity)
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)
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
void SetRequiredMipCount(int32_t mip_count)
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.