Flutter Engine
The Flutter Engine
vertices_geometry.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_GEOMETRY_VERTICES_GEOMETRY_H_
6#define FLUTTER_IMPELLER_ENTITY_GEOMETRY_VERTICES_GEOMETRY_H_
7
9
10namespace impeller {
11
12/// @brief A geometry that is created from a vertices object.
13class VerticesGeometry final : public Geometry {
14 public:
15 enum class VertexMode {
16 kTriangles,
17 kTriangleStrip,
18 kTriangleFan,
19 };
20
21 VerticesGeometry(std::vector<Point> vertices,
22 std::vector<uint16_t> indices,
23 std::vector<Point> texture_coordinates,
24 std::vector<Color> colors,
27
28 ~VerticesGeometry() = default;
29
31 Matrix effect_transform,
33 const Entity& entity,
34 RenderPass& pass) const;
35
36 // |Geometry|
38 const Entity& entity,
39 RenderPass& pass) const override;
40
41 // |Geometry|
42 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
43
44 bool HasVertexColors() const;
45
46 bool HasTextureCoordinates() const;
47
48 std::optional<Rect> GetTextureCoordinateCoverge() const;
49
50 private:
51 void NormalizeIndices();
52
53 PrimitiveType GetPrimitiveType() const;
54
55 std::vector<Point> vertices_;
56 std::vector<Color> colors_;
57 std::vector<Point> texture_coordinates_;
58 std::vector<uint16_t> indices_;
59 Rect bounds_;
60 VerticesGeometry::VertexMode vertex_mode_ =
62};
63
64} // namespace impeller
65
66#endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_VERTICES_GEOMETRY_H_
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
A geometry that is created from a vertices object.
std::optional< Rect > GetCoverage(const Matrix &transform) const override
std::optional< Rect > GetTextureCoordinateCoverge() const
GeometryResult GetPositionUVColorBuffer(Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass) const
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
VerticesGeometry(std::vector< Point > vertices, std::vector< uint16_t > indices, std::vector< Point > texture_coordinates, std::vector< Color > colors, Rect bounds, VerticesGeometry::VertexMode vertex_mode)
Optional< SkRect > bounds
Definition: SkRecords.h:189
PODArray< SkColor > colors
Definition: SkRecords.h:276
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
A 4x4 matrix using column-major storage.
Definition: matrix.h:37