 |
Flutter Impeller
|
|
Go to the documentation of this file.
5 #ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
8 #include "fml/logging.h"
107 std::function<std::shared_ptr<Pipeline<PipelineDescriptor>>(
127 template <
typename VertexShaderT>
132 typename VertexShaderT::FrameInfo frame_info,
134 bool force_stencil =
false,
140 bool do_cover_draw =
false;
141 Rect cover_area = {};
143 bool is_stencil_then_cover =
146 if (!is_stencil_then_cover && force_stencil) {
148 is_stencil_then_cover =
true;
151 if (is_stencil_then_cover) {
162 options.primitive_type = stencil_geometry_result.
type;
165 switch (stencil_geometry_result.
mode) {
168 options.stencil_mode =
173 options.stencil_mode =
179 options.stencil_mode =
186 ClipPipeline::VertexShader::FrameInfo clip_frame_info;
188 clip_frame_info.mvp = stencil_geometry_result.
transform;
189 ClipPipeline::VertexShader::BindFrameInfo(
192 if (!pass.
Draw().ok()) {
201 if (!maybe_cover_area.has_value()) {
204 do_cover_draw =
true;
205 cover_area = maybe_cover_area.value();
211 geometry_result = create_geom_callback(renderer, entity, pass, &geom);
214 create_geom_callback(renderer, entity, pass,
GetGeometry());
221 options.primitive_type = geometry_result.
type;
230 frame_info.mvp = geometry_result.
transform;
237 options.stencil_mode =
242 VertexShaderT::BindFrameInfo(
249 if (!bind_fragment_callback(pass)) {
255 if (!pass.
Draw().ok()) {
266 return restore.
Render(renderer, restore_entity, pass);
272 const Geometry* geometry_ =
nullptr;
275 Scalar inherited_opacity_ = 1.0;
284 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_COLOR_SOURCE_CONTENTS_H_
std::function< std::shared_ptr< Pipeline< PipelineDescriptor > >(ContentContextOptions)> PipelineBuilderCallback
Scalar GetOpacityFactor() const
Get the opacity factor for this color source.
virtual bool IsSolidColor() const
void SetInheritedOpacity(Scalar opacity) override
Inherit the provided opacity.
float GetShaderClipDepth() const
void SetEffectTransform(Matrix matrix)
Set the effect transform for this color source.
@ kOverdrawPreventionIncrement
virtual std::optional< Rect > GetCoverage(const Matrix &transform) const =0
std::shared_ptr< Pipeline< PipelineDescriptor > > GetClipPipeline(ContentContextOptions opts) const
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
static GeometryResult DefaultCreateGeometryCallback(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry *geom)
virtual GeometryResult::Mode GetResultMode() const
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
virtual fml::Status Draw()
Record the currently pending command.
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
~ColorSourceContents() override
bool Render(const ContentContext &renderer, RenderPass &parent_pass) const
void SetGeometry(const Geometry *geometry)
Set the geometry that this contents will use to render.
virtual GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const =0
std::function< GeometryResult(const ContentContext &renderer, const Entity &entity, RenderPass &pass, const Geometry *geom)> CreateGeometryCallback
virtual void SetStencilReference(uint32_t value)
BlendMode GetBlendMode() const
const Geometry * GetGeometry() const
Get the geometry that this contents will use to render.
Render passes encode render commands directed as one specific render target into an underlying comman...
std::shared_ptr< Pipeline< PipelineDescriptor > >(impeller::ContentContext::*)(ContentContextOptions) const PipelineBuilderMethod
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
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< bool(RenderPass &pass)> BindFragmentCallback
BufferView EmplaceUniform(const UniformType &uniform)
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirement...
virtual void SetPipeline(const std::shared_ptr< Pipeline< PipelineDescriptor >> &pipeline)
The pipeline to use for this command.
bool AppliesAlphaForStrokeCoverage(const Matrix &transform) const
Whether the entity should be treated as non-opaque due to stroke geometry requiring alpha for coverag...
void SetOpacityFactor(Scalar opacity)
Set the opacity factor for this color source.
VertexBuffer vertex_buffer
A 4x4 matrix using column-major storage.
const Matrix & GetInverseEffectTransform() const
Set the inverted effect transform for this color source.
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.