Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
tessellator_libtess.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_TESSELLATOR_TESSELLATOR_LIBTESS_H_
6#define FLUTTER_IMPELLER_TESSELLATOR_TESSELLATOR_LIBTESS_H_
7
8#include <functional>
9#include <memory>
10
13
14struct TESStesselator;
15
16namespace impeller {
17
18void DestroyTessellator(TESStesselator* tessellator);
19
21 std::unique_ptr<TESStesselator, decltype(&DestroyTessellator)>;
22
23//------------------------------------------------------------------------------
24/// @brief An extended tessellator that offers arbitrary/concave
25/// tessellation via the libtess2 library.
26///
27/// This object is not thread safe, and its methods must not be
28/// called from multiple threads.
29///
31 public:
33
35
36 /// @brief A callback that returns the results of the tessellation.
37 ///
38 /// The index buffer may not be populated, in which case [indices] will
39 /// be nullptr and indices_count will be 0.
40 using BuilderCallback = std::function<bool(const float* vertices,
41 size_t vertices_count,
42 const uint16_t* indices,
43 size_t indices_count)>;
44
45 //----------------------------------------------------------------------------
46 /// @brief Generates filled triangles from the path. A callback is
47 /// invoked once for the entire tessellation.
48 ///
49 /// @param[in] path The path to tessellate.
50 /// @param[in] tolerance The tolerance value for conversion of the path to
51 /// a polyline. This value is often derived from the
52 /// Matrix::GetMaxBasisLength of the CTM applied to the
53 /// path for rendering.
54 /// @param[in] callback The callback, return false to indicate failure.
55 ///
56 /// @return The result status of the tessellation.
57 ///
59 Scalar tolerance,
61
62 private:
63 CTessellator c_tessellator_;
64
66
67 TessellatorLibtess& operator=(const TessellatorLibtess&) = delete;
68};
69
70} // namespace impeller
71
72#endif // FLUTTER_IMPELLER_TESSELLATOR_TESSELLATOR_LIBTESS_H_
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition path.h:51
An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library.
std::function< bool(const float *vertices, size_t vertices_count, const uint16_t *indices, size_t indices_count)> BuilderCallback
A callback that returns the results of the tessellation.
Tessellator::Result Tessellate(const Path &path, Scalar tolerance, const BuilderCallback &callback)
Generates filled triangles from the path. A callback is invoked once for the entire tessellation.
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
Definition tessellator.h:29
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
float Scalar
Definition scalar.h:18
void DestroyTessellator(TESStesselator *tessellator)
std::unique_ptr< TESStesselator, decltype(&DestroyTessellator)> CTessellator