5#ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
6#define FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
46 void SetGeometry(std::shared_ptr<Geometry> geometry);
51 const std::shared_ptr<Geometry>&
GetGeometry()
const;
113 std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>(
129 template <
typename VertexShaderT>
134 typename VertexShaderT::FrameInfo frame_info,
136 bool force_stencil =
false,
144 bool is_stencil_then_cover =
147 if (!is_stencil_then_cover && force_stencil) {
149 is_stencil_then_cover =
true;
152 if (is_stencil_then_cover) {
163 options.primitive_type = stencil_geometry_result.
type;
166 switch (stencil_geometry_result.
mode) {
187 ClipPipeline::VertexShader::FrameInfo clip_frame_info;
189 clip_frame_info.mvp = stencil_geometry_result.
transform;
190 ClipPipeline::VertexShader::BindFrameInfo(
191 pass,
renderer.GetTransientsBuffer().EmplaceUniform(clip_frame_info));
201 std::optional<Rect> maybe_cover_area =
GetGeometry()->GetCoverage({});
202 if (!maybe_cover_area.has_value()) {
209 create_geom_callback(
renderer, entity, pass, geometry);
218 frame_info.mvp = geometry_result.
transform;
230 VertexShaderT::BindFrameInfo(
231 pass,
renderer.GetTransientsBuffer().EmplaceUniform(frame_info));
237 if (!bind_fragment_callback(pass)) {
260 std::shared_ptr<Geometry> geometry_;
263 Scalar inherited_opacity_ = 1.0;
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
bool DrawGeometry(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const PipelineBuilderCallback &pipeline_callback, typename VertexShaderT::FrameInfo frame_info, const BindFragmentCallback &bind_fragment_callback, bool force_stencil=false, const CreateGeometryCallback &create_geom_callback=DefaultCreateGeometryCallback) const
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.
std::function< GeometryResult(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry &geom)> CreateGeometryCallback
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.
const std::shared_ptr< Geometry > & GetGeometry() const
Get the geometry that this contents will use to render.
static GeometryResult DefaultCreateGeometryCallback(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry &geom)
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()
Dart_NativeFunction function
unsigned useCenter Optional< SkMatrix > matrix
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
@ kOverdrawPreventionIncrement
VertexBuffer vertex_buffer
A 4x4 matrix using column-major storage.