25 return sigma * scalar;
36 corner_radii_ = corner_radii;
44 color_ =
color.Premultiply();
52 const Entity& entity)
const {
53 if (!rect_.has_value()) {
59 return rect_->Expand(radius).TransformBounds(entity.
GetTransform());
65 if (!rect_.has_value()) {
80 auto blur_radius = PadForSigma(blur_sigma);
81 auto positive_rect = rect_->GetPositive();
83 auto left = -blur_radius;
84 auto top = -blur_radius;
85 auto right = positive_rect.GetWidth() + blur_radius;
86 auto bottom = positive_rect.GetHeight() + blur_radius;
91 {
Point(left, bottom)},
92 {
Point(right, bottom)},
104 VS::FrameInfo frame_info;
110 FS::FragInfo frag_info;
111 frag_info.color =
color;
112 frag_info.blur_sigma = blur_sigma;
113 frag_info.rect_size =
Point(positive_rect.GetSize());
115 positive_rect.GetWidth() * 0.5f),
117 positive_rect.GetHeight() * 0.5f)};
123 VS::BindFrameInfo(pass,
124 renderer.GetTransientsBuffer().EmplaceUniform(frame_info));
125 FS::BindFragInfo(pass,
126 renderer.GetTransientsBuffer().EmplaceUniform(frag_info));
137 color_ = color_filter_proc(color_);
static unsigned clamp(SkFixed fx, int max)
std::function< Color(Color)> ColorFilterProc
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
BlendMode GetBlendMode() const
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
float GetShaderClipDepth() const
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 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.
VertexShader_ VertexShader
FragmentShader_ FragmentShader
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.
bool ApplyColorFilter(const ColorFilterProc &color_filter_proc) override
If possible, applies a color filter to this contents inputs on the CPU.
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
void SetSigma(Sigma sigma)
~SolidRRectBlurContents() override
void SetColor(Color color)
void SetRRect(std::optional< Rect > rect, Size corner_radii={})
VertexBuffer CreateVertexBuffer(HostBuffer &host_buffer) const
VertexBufferBuilder & AddVertices(std::initializer_list< VertexType_ > vertices)
static float min(float r, float g, float b)
sk_sp< SkBlender > blender SkRect rect
constexpr float kEhCloseEnough
ContentContextOptions OptionsFromPassAndEntity(const RenderPass &pass, const Entity &entity)
static constexpr Color White()
PrimitiveType primitive_type
bool is_for_rrect_blur_clear
static constexpr Matrix MakeTranslation(const Vector3 &t)
In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of t...