#include <entity_pass.h>
Classes | |
| struct | ClipCoverageLayer |
Public Types | |
| using | Element = std::variant< Entity, std::unique_ptr< EntityPass > > |
| using | BackdropFilterProc = std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> |
| using | ClipCoverageStack = std::vector< ClipCoverageLayer > |
Public Member Functions | |
| EntityPass () | |
| ~EntityPass () | |
| void | SetDelegate (std::shared_ptr< EntityPassDelegate > delgate) |
| 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 allows the user to communicate that it's OK to not render content outside of the bounds. More... | |
| std::optional< Rect > | GetBoundsLimit () const |
| Get the bounds limit, which is provided by the user when creating a SaveLayer. More... | |
| size_t | GetSubpassesDepth () const |
| std::unique_ptr< EntityPass > | Clone () const |
| void | AddEntity (Entity entity) |
| Add an entity to the current entity pass. More... | |
| void | SetElements (std::vector< Element > elements) |
| EntityPass * | AddSubpass (std::unique_ptr< EntityPass > pass) |
| Appends a given pass as a subpass. More... | |
| void | AddSubpassInline (std::unique_ptr< EntityPass > pass) |
| Merges a given pass into this pass. Useful for drawing pre-recorded pictures that don't require rendering into a separate subpass. More... | |
| EntityPass * | GetSuperpass () const |
| bool | Render (ContentContext &renderer, const RenderTarget &render_target) const |
| void | IterateAllElements (const std::function< bool(Element &)> &iterator) |
| Iterate all elements (entities and subpasses) in this pass, recursively including elements of child passes. The iteration order is depth-first. Whenever a subpass elements is encountered, it's included in the stream before its children. More... | |
| void | IterateAllEntities (const std::function< bool(Entity &)> &iterator) |
| Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first. More... | |
| void | IterateAllEntities (const std::function< bool(const Entity &)> &iterator) const |
| Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first and does not allow modification of the entities. More... | |
| 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-ahead optimizations. More... | |
| size_t | GetElementCount () const |
| Return the number of elements on this pass. More... | |
| void | SetTransform (Matrix transform) |
| void | SetClipDepth (size_t clip_depth) |
| size_t | GetClipDepth () |
| void | SetBlendMode (BlendMode blend_mode) |
| std::optional< Color > | GetClearColor (ISize size=ISize::Infinite()) const |
| Return the premultiplied clear color of the pass entities, if any. More... | |
| Color | GetClearColorOrDefault (ISize size=ISize::Infinite()) const |
| Return the premultiplied clear color of the pass entities. More... | |
| void | SetBackdropFilter (BackdropFilterProc proc) |
| void | SetEnableOffscreenCheckerboard (bool enabled) |
| 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 subpass before it's rendered to and passed through the subpass ImageFilter, if any. More... | |
| std::optional< Rect > | GetElementsCoverage (std::optional< Rect > coverage_limit) const |
Static Public Attributes | |
| static const std::string | kCaptureDocumentName = "EntityPass" |
Definition at line 25 of file entity_pass.h.
| using impeller::EntityPass::BackdropFilterProc = std::function<std::shared_ptr<FilterContents>( FilterInput::Ref, const Matrix& effect_transform, Entity::RenderingMode rendering_mode)> |
Definition at line 43 of file entity_pass.h.
| using impeller::EntityPass::ClipCoverageStack = std::vector<ClipCoverageLayer> |
Definition at line 50 of file entity_pass.h.
| using impeller::EntityPass::Element = std::variant<Entity, std::unique_ptr<EntityPass> > |
Elements are renderable items in the EntityPass. Each can either be an Entity or a child EntityPass.
When the element is a child EntityPass, it may be rendered to an offscreen texture and converted into an Entity that draws the texture into the current pass, or its children may be collapsed into the current
EntityPass. Elements are converted to Entities in GetEntityForElement().
Definition at line 36 of file entity_pass.h.
|
default |
|
default |
| void impeller::EntityPass::AddEntity | ( | Entity | entity | ) |
Add an entity to the current entity pass.
Definition at line 70 of file entity_pass.cc.
References impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::Entity::kLastPipelineBlendMode, impeller::kSource, impeller::kSourceOver, and impeller::Entity::SetBlendMode().
Referenced by impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), and impeller::testing::TEST_P().
| EntityPass * impeller::EntityPass::AddSubpass | ( | std::unique_ptr< EntityPass > | pass | ) |
Appends a given pass as a subpass.
Definition at line 205 of file entity_pass.cc.
References impeller::Entity::kLastPipelineBlendMode.
Referenced by impeller::testing::TEST_P().
| void impeller::EntityPass::AddSubpassInline | ( | std::unique_ptr< EntityPass > | pass | ) |
Merges a given pass into this pass. Useful for drawing pre-recorded pictures that don't require rendering into a separate subpass.
Definition at line 224 of file entity_pass.cc.
Referenced by impeller::Canvas::DrawPicture().
| std::unique_ptr< EntityPass > impeller::EntityPass::Clone | ( | ) | const |
Definition at line 1080 of file entity_pass.cc.
| std::optional< Rect > impeller::EntityPass::GetBoundsLimit | ( | ) | const |
Get the bounds limit, which is provided by the user when creating a SaveLayer.
Definition at line 66 of file entity_pass.cc.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| std::optional< Color > impeller::EntityPass::GetClearColor | ( | ISize | size = ISize::Infinite() | ) | const |
Return the premultiplied clear color of the pass entities, if any.
Definition at line 1132 of file entity_pass.cc.
| Color impeller::EntityPass::GetClearColorOrDefault | ( | ISize | size = ISize::Infinite() | ) | const |
Return the premultiplied clear color of the pass entities.
If the entity pass has no clear color, this will return transparent black.
Definition at line 1128 of file entity_pass.cc.
| size_t impeller::EntityPass::GetClipDepth | ( | ) |
Definition at line 1119 of file entity_pass.cc.
| size_t impeller::EntityPass::GetElementCount | ( | ) | const |
Return the number of elements on this pass.
Definition at line 1076 of file entity_pass.cc.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| std::optional< Rect > impeller::EntityPass::GetElementsCoverage | ( | std::optional< Rect > | coverage_limit | ) | const |
Definition at line 97 of file entity_pass.cc.
References GetSubpassCoverage(), impeller::TRect< Scalar >::Intersection(), impeller::Entity::kSubpass, impeller::FilterInput::Make(), impeller::Entity::SetTransform(), impeller::TRect< Scalar >::Union(), and VALIDATION_LOG.
Referenced by GetSubpassCoverage(), and impeller::testing::TEST_P().
| std::optional< Rect > impeller::EntityPass::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 subpass before it's rendered to and passed through the subpass ImageFilter, if any.
| [in] | subpass | The EntityPass for which to compute pre-filteredcoverage. |
| [in] | coverage_limit | Confines coverage to a specified area. This hint is used to trim coverage to the root framebuffer area. std::nullopt means there is no limit. |
std::nullopt means rendering the subpass will have no effect on the color attachment. Definition at line 173 of file entity_pass.cc.
References GetElementsCoverage().
Referenced by GetElementsCoverage(), and impeller::testing::TEST_P().
| size_t impeller::EntityPass::GetSubpassesDepth | ( | ) | const |
Definition at line 86 of file entity_pass.cc.
| EntityPass * impeller::EntityPass::GetSuperpass | ( | ) | const |
Definition at line 201 of file entity_pass.cc.
Referenced by impeller::Canvas::Restore().
| void impeller::EntityPass::IterateAllElements | ( | const std::function< bool(Element &)> & | iterator | ) |
Iterate all elements (entities and subpasses) in this pass, recursively including elements of child passes. The iteration order is depth-first. Whenever a subpass elements is encountered, it's included in the stream before its children.
Definition at line 999 of file entity_pass.cc.
| void impeller::EntityPass::IterateAllEntities | ( | const std::function< bool(const Entity &)> & | iterator | ) | const |
Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first and does not allow modification of the entities.
Definition at line 1036 of file entity_pass.cc.
References IterateAllEntities().
| void impeller::EntityPass::IterateAllEntities | ( | const std::function< bool(Entity &)> & | iterator | ) |
Iterate all entities in this pass, recursively including entities of child passes. The iteration order is depth-first.
Definition at line 1015 of file entity_pass.cc.
Referenced by IterateAllEntities(), and Render().
| bool impeller::EntityPass::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-ahead optimizations.
Definition at line 1058 of file entity_pass.cc.
Referenced by impeller::OpacityPeepholePassDelegate::CanCollapseIntoParentPass().
| bool impeller::EntityPass::Render | ( | ContentContext & | renderer, |
| const RenderTarget & | render_target | ||
| ) | const |
Definition at line 304 of file entity_pass.cc.
References impeller::ContentContext::GetContext(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::ContentContext::GetRenderTargetCache(), IterateAllEntities(), kCaptureDocumentName, impeller::TRect< Scalar >::MakeSize(), and VALIDATION_LOG.
Referenced by impeller::EntityPlayground::OpenPlaygroundHere().
| void impeller::EntityPass::SetBackdropFilter | ( | BackdropFilterProc | proc | ) |
| void impeller::EntityPass::SetBlendMode | ( | BlendMode | blend_mode | ) |
Definition at line 1123 of file entity_pass.cc.
| void impeller::EntityPass::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 allows the user to communicate that it's OK to not render content outside of the bounds.
For consistency with Skia, we effectively treat this like a rectangle clip by forcing the subpass texture size to never exceed it.
Definition at line 62 of file entity_pass.cc.
| void impeller::EntityPass::SetClipDepth | ( | size_t | clip_depth | ) |
Definition at line 1115 of file entity_pass.cc.
| void impeller::EntityPass::SetDelegate | ( | std::shared_ptr< EntityPassDelegate > | delgate | ) |
Definition at line 55 of file entity_pass.cc.
| void impeller::EntityPass::SetElements | ( | std::vector< Element > | elements | ) |
Definition at line 82 of file entity_pass.cc.
| void impeller::EntityPass::SetEnableOffscreenCheckerboard | ( | bool | enabled | ) |
Definition at line 1162 of file entity_pass.cc.
| void impeller::EntityPass::SetTransform | ( | Matrix | transform | ) |
Definition at line 1111 of file entity_pass.cc.
|
static |
Definition at line 38 of file entity_pass.h.
Referenced by Render().