| Flutter Impeller |

solid_rrect_blur_contents.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/entity/contents/solid_rrect_blur_contents.h"
6 #include <optional>
7
8 #include "impeller/entity/contents/content_context.h"
9 #include "impeller/entity/entity.h"
10 #include "impeller/geometry/color.h"
11 #include "impeller/geometry/constants.h"
12 #include "impeller/renderer/render_pass.h"
13 #include "impeller/renderer/vertex_buffer_builder.h"
14
15 namespace impeller {
16
17 bool SolidRRectBlurContents::SetPassInfo(RenderPass& pass,
18 const ContentContext& renderer,
19 PassContext& pass_context) const {
20 using FS = RRectBlurPipeline::FragmentShader;
21
22 FS::FragInfo frag_info;
23 frag_info.color = GetColor();
24 frag_info.center_adjust = Concat(pass_context.center, pass_context.adjust);
25 frag_info.r1_exponent_exponentInv =
26 Vector3(pass_context.r1, pass_context.exponent, pass_context.exponentInv);
27 frag_info.sInv_minEdge_scale =
28 Vector3(pass_context.sInv, pass_context.minEdge, pass_context.scale);
29
30 auto& host_buffer = renderer.GetTransientsBuffer();
31 pass.SetCommandLabel("RRect Shadow");
32 pass.SetPipeline(renderer.GetRRectBlurPipeline(pass_context.opts));
33
34 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
35 return true;
36 }
37
38 SolidRRectBlurContents::SolidRRectBlurContents() = default;
39
40 SolidRRectBlurContents::~SolidRRectBlurContents() = default;
41
42 } // namespace impeller
impeller::ContentContext
Definition: content_context.h:138
impeller::ContentContext::GetTransientsBuffer
HostBuffer & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
Definition: content_context.h:297
impeller::ContentContext::GetRRectBlurPipeline
PipelineRef GetRRectBlurPipeline(ContentContextOptions opts) const
Definition: content_context.cc:1088
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::RenderPass::SetPipeline
virtual void SetPipeline(PipelineRef pipeline)
The pipeline to use for this command.
Definition: render_pass.cc:86
impeller::RenderPass::SetCommandLabel
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
Definition: render_pass.cc:97
impeller::RenderPipelineHandle::FragmentShader
FragmentShader_ FragmentShader
Definition: pipeline.h:164
impeller::SolidRRectBlurContents::SolidRRectBlurContents
SolidRRectBlurContents()
impeller::SolidRRectBlurContents::~SolidRRectBlurContents
~SolidRRectBlurContents() override
impeller::SolidRRectBlurContents::SetPassInfo
bool SetPassInfo(RenderPass &pass, const ContentContext &renderer, PassContext &pass_context) const override
Definition: solid_rrect_blur_contents.cc:17
impeller::SolidRRectLikeBlurContents::GetColor
Color GetColor() const
Definition: solid_rrect_like_blur_contents.cc:46
impeller::SolidRRectLikeBlurContents::Concat
static Vector4 Concat(Vector2 &a, Vector2 &b)
Definition: solid_rrect_like_blur_contents.cc:193
color.h
content_context.h
entity.h
constants.h
impeller
Definition: allocation.cc:12
impeller::FS
LinePipeline::FragmentShader FS
Definition: line_contents.cc:14
render_pass.h
solid_rrect_blur_contents.h
impeller::SolidRRectLikeBlurContents::PassContext
Definition: solid_rrect_like_blur_contents.h:45
impeller::SolidRRectLikeBlurContents::PassContext::scale
Scalar scale
Definition: solid_rrect_like_blur_contents.h:56
impeller::SolidRRectLikeBlurContents::PassContext::r1
Scalar r1
Definition: solid_rrect_like_blur_contents.h:52
impeller::SolidRRectLikeBlurContents::PassContext::adjust
Point adjust
Definition: solid_rrect_like_blur_contents.h:50
impeller::SolidRRectLikeBlurContents::PassContext::exponentInv
Scalar exponentInv
Definition: solid_rrect_like_blur_contents.h:55
impeller::SolidRRectLikeBlurContents::PassContext::sInv
Scalar sInv
Definition: solid_rrect_like_blur_contents.h:54
impeller::SolidRRectLikeBlurContents::PassContext::opts
ContentContextOptions opts
Definition: solid_rrect_like_blur_contents.h:47
impeller::SolidRRectLikeBlurContents::PassContext::minEdge
Scalar minEdge
Definition: solid_rrect_like_blur_contents.h:51
impeller::SolidRRectLikeBlurContents::PassContext::exponent
Scalar exponent
Definition: solid_rrect_like_blur_contents.h:53
impeller::SolidRRectLikeBlurContents::PassContext::center
Point center
Definition: solid_rrect_like_blur_contents.h:49
impeller::Vector3
Definition: vector.h:20
vertex_buffer_builder.h