5#ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
45 void SetGeometry(std::shared_ptr<Geometry> geometry);
50 const std::shared_ptr<Geometry>&
GetGeometry()
const;
112 std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>(
115 template <
typename VertexShaderT>
120 typename VertexShaderT::FrameInfo frame_info,
127 const bool is_stencil_then_cover =
130 if (is_stencil_then_cover) {
136 GetGeometry()->GetPositionBuffer(renderer, entity, pass);
141 options.primitive_type = stencil_geometry_result.
type;
144 switch (stencil_geometry_result.
mode) {
159 ClipPipeline::VertexShader::FrameInfo clip_frame_info;
161 clip_frame_info.mvp = stencil_geometry_result.
transform;
162 ClipPipeline::VertexShader::BindFrameInfo(
163 pass, renderer.GetTransientsBuffer().EmplaceUniform(clip_frame_info));
173 std::optional<Rect> maybe_cover_area =
GetGeometry()->GetCoverage({});
174 if (!maybe_cover_area.has_value()) {
190 frame_info.mvp = geometry_result.
transform;
202 VertexShaderT::BindFrameInfo(
203 pass, renderer.GetTransientsBuffer().EmplaceUniform(frame_info));
209 if (!bind_fragment_callback(pass)) {
226 return restore.
Render(renderer, restore_entity, pass);
232 std::shared_ptr<Geometry> geometry_;
235 Scalar inherited_opacity_ = 1.0;
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
Scalar GetOpacityFactor() const
Get the opacity factor for this color source.
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
std::function< std::shared_ptr< Pipeline< PipelineDescriptor > >(ContentContextOptions)> PipelineBuilderCallback
~ColorSourceContents() override
std::shared_ptr< Pipeline< PipelineDescriptor > >(impeller::ContentContext::*)(ContentContextOptions) const PipelineBuilderMethod
void SetEffectTransform(Matrix matrix)
Set the effect transform for this color source.
bool CanInheritOpacity(const Entity &entity) const override
Whether or not this contents can accept the opacity peephole optimization.
const Matrix & GetInverseEffectTransform() const
Set the inverted effect transform for this color source.
virtual bool IsSolidColor() const
std::function< bool(RenderPass &pass)> BindFragmentCallback
void SetOpacityFactor(Scalar opacity)
Set the opacity factor for this color source.
void SetGeometry(std::shared_ptr< Geometry > geometry)
Set the geometry that this contents will use to render.
bool DrawGeometry(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const PipelineBuilderCallback &pipeline_callback, typename VertexShaderT::FrameInfo frame_info, const BindFragmentCallback &bind_fragment_callback) const
const std::shared_ptr< Geometry > & GetGeometry() const
Get the geometry that this contents will use to render.
BlendMode GetBlendMode() const
bool Render(const ContentContext &renderer, RenderPass &parent_pass) const
float GetShaderClipDepth() const
virtual GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const =0
Render passes encode render commands directed as one specific render target into an underlying comman...
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
virtual void SetStencilReference(uint32_t value)
virtual void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor > > &pipeline)
The pipeline to use for this command.
virtual fml::Status Draw()
Record the currently pending command.
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
#define FML_UNREACHABLE()
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
@ kOverdrawPreventionIncrement
VertexBuffer vertex_buffer
A 4x4 matrix using column-major storage.