Flutter Impeller
vertices_contents.h
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 #ifndef FLUTTER_IMPELLER_ENTITY_CONTENTS_VERTICES_CONTENTS_H_
6 #define FLUTTER_IMPELLER_ENTITY_CONTENTS_VERTICES_CONTENTS_H_
7 
8 #include <memory>
9 
12 #include "impeller/entity/entity.h"
15 
16 namespace impeller {
17 
18 /// A vertices contents for (optional) per-color vertices + texture and any
19 /// blend mode.
20 class VerticesSimpleBlendContents final : public Contents {
21  public:
23 
25 
26  using LazyTexture =
27  std::function<std::shared_ptr<Texture>(const ContentContext& renderer)>;
28 
29  void SetGeometry(std::shared_ptr<VerticesGeometry> geometry);
30 
31  void SetAlpha(Scalar alpha);
32 
33  void SetBlendMode(BlendMode blend_mode);
34 
35  void SetTexture(std::shared_ptr<Texture> texture);
36 
37  void SetLazyTexture(const LazyTexture& lazy_texture);
38 
39  void SetSamplerDescriptor(SamplerDescriptor descriptor);
40 
41  void SetTileMode(Entity::TileMode tile_mode_x, Entity::TileMode tile_mode_y);
42 
44 
45  // |Contents|
46  std::optional<Rect> GetCoverage(const Entity& entity) const override;
47 
48  // |Contents|
49  bool Render(const ContentContext& renderer,
50  const Entity& entity,
51  RenderPass& pass) const override;
52 
53  private:
54  Scalar alpha_ = 1.0;
55  std::shared_ptr<VerticesGeometry> geometry_;
56  std::shared_ptr<Texture> texture_;
57  BlendMode blend_mode_ = BlendMode::kSource;
58  SamplerDescriptor descriptor_ = {};
61  Matrix inverse_matrix_ = {};
62  LazyTexture lazy_texture_;
63 
65 
67  delete;
68 };
69 
70 } // namespace impeller
71 
72 #endif // FLUTTER_IMPELLER_ENTITY_CONTENTS_VERTICES_CONTENTS_H_
impeller::Entity::TileMode::kClamp
@ kClamp
contents.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::VerticesSimpleBlendContents::SetEffectTransform
void SetEffectTransform(Matrix transform)
Definition: vertices_contents.cc:83
impeller::VerticesSimpleBlendContents::GetCoverage
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.
Definition: vertices_contents.cc:67
entity.h
impeller::BlendMode
BlendMode
Definition: color.h:59
impeller::BlendMode::kSource
@ kSource
impeller::VerticesSimpleBlendContents::SetAlpha
void SetAlpha(Scalar alpha)
Definition: vertices_contents.cc:55
impeller::VerticesSimpleBlendContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: vertices_contents.cc:92
impeller::VerticesSimpleBlendContents::SetTexture
void SetTexture(std::shared_ptr< Texture > texture)
Definition: vertices_contents.cc:63
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
impeller::Entity
Definition: entity.h:20
impeller::VerticesSimpleBlendContents::LazyTexture
std::function< std::shared_ptr< Texture >(const ContentContext &renderer)> LazyTexture
Definition: vertices_contents.h:27
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:231
impeller::VerticesSimpleBlendContents::SetLazyTexture
void SetLazyTexture(const LazyTexture &lazy_texture)
Definition: vertices_contents.cc:87
impeller::VerticesSimpleBlendContents::SetGeometry
void SetGeometry(std::shared_ptr< VerticesGeometry > geometry)
Definition: vertices_contents.cc:50
impeller::Entity::TileMode
TileMode
Definition: entity.h:42
vertices_geometry.h
impeller::VerticesSimpleBlendContents
Definition: vertices_contents.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
impeller::VerticesSimpleBlendContents::VerticesSimpleBlendContents
VerticesSimpleBlendContents()
Definition: vertices_contents.cc:46
sampler_descriptor.h
impeller::VerticesSimpleBlendContents::SetTileMode
void SetTileMode(Entity::TileMode tile_mode_x, Entity::TileMode tile_mode_y)
Definition: vertices_contents.cc:77
color.h
impeller::VerticesSimpleBlendContents::SetBlendMode
void SetBlendMode(BlendMode blend_mode)
Definition: vertices_contents.cc:59
impeller::VerticesSimpleBlendContents::~VerticesSimpleBlendContents
~VerticesSimpleBlendContents() override
Definition: vertices_contents.cc:48
impeller::Contents
Definition: contents.h:31
impeller
Definition: aiks_blend_unittests.cc:18
impeller::ContentContext
Definition: content_context.h:366
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::VerticesSimpleBlendContents::SetSamplerDescriptor
void SetSamplerDescriptor(SamplerDescriptor descriptor)
Definition: vertices_contents.cc:72