Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
checkerboard_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
6
11
12namespace impeller {
13
15
17
19 const Entity& entity,
20 RenderPass& pass) const {
21 auto& host_buffer = renderer.GetTransientsBuffer();
22
23 using VS = CheckerboardPipeline::VertexShader;
24 using FS = CheckerboardPipeline::FragmentShader;
25
26 auto options = OptionsFromPass(pass);
30
32 vtx_builder.AddVertices({
33 {Point(-1, -1)},
34 {Point(1, -1)},
35 {Point(-1, 1)},
36 {Point(1, 1)},
37 });
38
39 pass.SetCommandLabel("Checkerboard");
40 pass.SetPipeline(renderer.GetCheckerboardPipeline(options));
41 pass.SetVertexBuffer(vtx_builder.CreateVertexBuffer(host_buffer));
42
43 FS::FragInfo frag_info;
44 frag_info.color = color_;
45 frag_info.square_size = square_size_;
46 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
47
48 return pass.Draw().ok();
49}
50
52 const Entity& entity) const {
53 return std::nullopt;
54}
55
59
61 square_size_ = square_size;
62}
63
64} // namespace impeller
const char * options
SkColor4f color
bool ok() const
Definition status.h:71
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
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.
void SetSquareSize(Scalar square_size)
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
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.
VertexBuffer CreateVertexBuffer(HostBuffer &host_buffer) const
VertexBufferBuilder & AddVertices(std::initializer_list< VertexType_ > vertices)
float Scalar
Definition scalar.h:18
SolidFillVertexShader VS
TPoint< Scalar > Point
Definition point.h:316
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition contents.cc:20