| Flutter Impeller |

dl_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_DISPLAY_LIST_DL_VERTICES_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_DL_VERTICES_GEOMETRY_H_
7
8 #include "flutter/display_list/dl_vertices.h"
9 #include "impeller/core/formats.h"
10 #include "impeller/entity/geometry/vertices_geometry.h"
11
12 namespace impeller {
13
14 /// @brief A geometry that is created from a DlVertices object.
15 class DlVerticesGeometry final : public VerticesGeometry {
16 public:
17 DlVerticesGeometry(const std::shared_ptr<const flutter::DlVertices>& vertices,
18 const ContentContext& renderer);
19
20 ~DlVerticesGeometry() = default;
21
22 GeometryResult GetPositionUVColorBuffer(Rect texture_coverage,
23 Matrix effect_transform,
24 const ContentContext& renderer,
25 const Entity& entity,
26 RenderPass& pass) const override;
27
28 // |Geometry|
29 GeometryResult GetPositionBuffer(const ContentContext& renderer,
30 const Entity& entity,
31 RenderPass& pass) const override;
32
33 // |Geometry|
34 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
35
36 bool HasVertexColors() const override;
37
38 bool HasTextureCoordinates() const override;
39
40 std::optional<Rect> GetTextureCoordinateCoverage() const override;
41
42 private:
43 PrimitiveType GetPrimitiveType() const;
44
45 /// @brief Check if index normalization is required, returning whether or
46 /// not it was performed.
47 ///
48 /// If true, [indices_] should be used in place of the vertices object's
49 /// indices.
50 bool MaybePerformIndexNormalization(const ContentContext& renderer);
51
52 const std::shared_ptr<const flutter::DlVertices> vertices_;
53 std::vector<uint16_t> indices_;
54 bool performed_normalization_ = false;
55 Rect bounds_;
56 };
57
58 } // namespace impeller
59
60 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_DL_VERTICES_GEOMETRY_H_
impeller::ContentContext
Definition: content_context.h:138
impeller::DlVerticesGeometry
A geometry that is created from a DlVertices object.
Definition: dl_vertices_geometry.h:15
impeller::DlVerticesGeometry::HasTextureCoordinates
bool HasTextureCoordinates() const override
Definition: dl_vertices_geometry.cc:87
impeller::DlVerticesGeometry::GetCoverage
std::optional< Rect > GetCoverage(const Matrix &transform) const override
Definition: dl_vertices_geometry.cc:208
impeller::DlVerticesGeometry::~DlVerticesGeometry
~DlVerticesGeometry()=default
impeller::DlVerticesGeometry::DlVerticesGeometry
DlVerticesGeometry(const std::shared_ptr< const flutter::DlVertices > &vertices, const ContentContext &renderer)
Definition: dl_vertices_geometry.cc:60
impeller::DlVerticesGeometry::GetTextureCoordinateCoverage
std::optional< Rect > GetTextureCoordinateCoverage() const override
Definition: dl_vertices_geometry.cc:91
impeller::DlVerticesGeometry::GetPositionUVColorBuffer
GeometryResult GetPositionUVColorBuffer(Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: dl_vertices_geometry.cc:147
impeller::DlVerticesGeometry::GetPositionBuffer
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: dl_vertices_geometry.cc:115
impeller::DlVerticesGeometry::HasVertexColors
bool HasVertexColors() const override
Definition: dl_vertices_geometry.cc:83
impeller::Entity
Definition: entity.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller::VerticesGeometry
A geometry that is created from a vertices object.
Definition: vertices_geometry.h:13
formats.h
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
impeller
Definition: allocation.cc:12
impeller::PrimitiveType
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:352
impeller::GeometryResult
Definition: geometry.h:21
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TRect< Scalar >
vertices_geometry.h