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);
126 const std::function<
bool(
const Element&)>& iterator)
const;
140 const std::function<
bool(
const Entity&)>& iterator)
const;
182 required_mip_count_ = mip_count;
204 std::optional<Rect> coverage_limit)
const;
207 std::optional<Rect> coverage_limit)
const;
210 struct EntityResult {
226 Status status = kFailure;
228 static EntityResult Success(Entity e) {
return {std::move(e),
kSuccess}; }
229 static EntityResult Failure() {
return {{},
kFailure}; }
230 static EntityResult Skip() {
return {{},
kSkip}; }
233 bool RenderElement(Entity& element_entity,
234 size_t clip_height_floor,
235 InlinePassContext& pass_context,
237 ContentContext& renderer,
238 EntityPassClipStack& clip_coverage_stack,
239 Point global_pass_position)
const;
242 ContentContext& renderer,
244 InlinePassContext& pass_context,
245 ISize root_pass_size,
246 Point global_pass_position,
248 EntityPassClipStack& clip_coverage_stack,
249 size_t clip_height_floor)
const;
308 bool OnRender(ContentContext& renderer,
310 ISize root_pass_size,
311 EntityPassTarget& pass_target,
312 Point global_pass_position,
313 Point local_pass_position,
315 EntityPassClipStack& clip_coverage_stack,
316 size_t clip_height_floor = 0,
317 std::shared_ptr<Contents> backdrop_filter_contents =
nullptr,
318 const std::optional<InlinePassContext::RenderPassResult>&
319 collapsed_parent_pass = std::nullopt)
const;
323 std::vector<Element> elements_;
329 std::vector<size_t> active_clips_;
333 size_t clip_height_ = 0u;
334 uint32_t clip_depth_ = 1u;
336 bool flood_clip_ =
false;
337 bool enable_offscreen_debug_checkerboard_ =
false;
338 std::optional<Rect> bounds_limit_;
340 int32_t required_mip_count_ = 1;
350 bool advanced_blend_reads_from_pass_texture_ =
false;
351 bool backdrop_filter_reads_from_pass_texture_ =
false;
353 bool DoesBackdropGetRead(ContentContext& renderer)
const;
357 std::shared_ptr<EntityPassDelegate> delegate_ =
static std::unique_ptr< EntityPassDelegate > MakeDefault()
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 SetElements(std::vector< Element > elements)
void IterateAllElements(const std::function< bool(Element &)> &iterator)
Iterate all elements (entities and subpasses) in this pass, recursively including elements of child p...
std::variant< Entity, std::unique_ptr< EntityPass > > Element
size_t GetElementCount() const
Return the number of elements on this pass.
void SetRequiredMipCount(int32_t mip_count)
bool GetBoundsLimitMightClipContent() const
Indicates if the bounds limit set using |SetBoundsLimit()| might clip the contents of the pass.
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 SetEnableOffscreenCheckerboard(bool enabled)
Color GetClearColorOrDefault(ISize size=ISize::Infinite()) const
Return the premultiplied clear color of the pass entities.
void SetClipDepth(size_t clip_depth)
void AddEntity(Entity entity)
Add an entity to the current entity pass.
size_t GetClipHeight() const
void SetBackdropFilter(BackdropFilterProc proc)
bool GetBoundsLimitIsSnug() const
Indicates if the bounds limit set using |SetBoundsLimit()| is a reasonably tight estimate of the boun...
static const std::string kCaptureDocumentName
std::optional< Rect > GetBoundsLimit() const
Get the bounds limit, which is provided by the user when creating a SaveLayer.
EntityPass * GetSuperpass() const
size_t GetSubpassesDepth() const
void PopClips(size_t num_clips, uint64_t depth)
int32_t GetRequiredMipCount() const
void SetClipHeight(size_t clip_height)
std::optional< Color > GetClearColor(ISize size=ISize::Infinite()) const
Return the premultiplied clear color of the pass entities, if any.
void SetBlendMode(BlendMode blend_mode)
void SetTransform(Matrix transform)
void IterateAllEntities(const std::function< bool(Entity &)> &iterator)
Iterate all entities in this pass, recursively including entities of child passes....
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...
void PopAllClips(uint64_t depth)
EntityPass * AddSubpass(std::unique_ptr< EntityPass > pass)
Appends a given pass as a subpass.
void SetDelegate(std::shared_ptr< EntityPassDelegate > delgate)
bool Render(ContentContext &renderer, const RenderTarget &render_target) const
std::optional< Rect > GetElementsCoverage(std::optional< Rect > coverage_limit) const
void PushClip(Entity entity)
uint32_t GetClipDepth() const
std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> BackdropFilterProc
@ kFailure
Failed to make the egl context for the surface current.
@ kUnknown
The caller makes no claims related to the size of the bounds.
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
A 4x4 matrix using column-major storage.
static constexpr TSize Infinite()