Flutter Engine
The Flutter Engine
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
12
13struct TESStesselator;
14
15namespace impeller {
16
17void DestroyTessellator(TESStesselator* tessellator);
18
20 std::unique_ptr<TESStesselator, decltype(&DestroyTessellator)>;
21
22//------------------------------------------------------------------------------
23/// @brief An extended tessellator that offers arbitrary/concave
24/// tessellation via the libtess2 library.
25///
26/// This object is not thread safe, and its methods must not be
27/// called from multiple threads.
28///
30 public:
32
34
35 enum class Result {
38 kTessellationError,
39 };
40
41 /// @brief A callback that returns the results of the tessellation.
42 ///
43 /// The index buffer may not be populated, in which case [indices] will
44 /// be nullptr and indices_count will be 0.
45 using BuilderCallback = std::function<bool(const float* vertices,
46 size_t vertices_count,
47 const uint16_t* indices,
48 size_t indices_count)>;
49
50 //----------------------------------------------------------------------------
51 /// @brief Generates filled triangles from the path. A callback is
52 /// invoked once for the entire tessellation.
53 ///
54 /// @param[in] path The path to tessellate.
55 /// @param[in] tolerance The tolerance value for conversion of the path to
56 /// a polyline. This value is often derived from the
57 /// Matrix::GetMaxBasisLength of the CTM applied to the
58 /// path for rendering.
59 /// @param[in] callback The callback, return false to indicate failure.
60 ///
61 /// @return The result status of the tessellation.
62 ///
64 Scalar tolerance,
66
67 private:
68 CTessellator c_tessellator_;
69
71
72 TessellatorLibtess& operator=(const TessellatorLibtess&) = delete;
73};
74
75} // namespace impeller
76
77#endif // FLUTTER_IMPELLER_TESSELLATOR_TESSELLATOR_LIBTESS_H_
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:52
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.
TessellatorLibtess::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.
@ kSuccess
Definition: embedder.h:73
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
float Scalar
Definition: scalar.h:18
void DestroyTessellator(TESStesselator *tessellator)
std::unique_ptr< TESStesselator, decltype(&DestroyTessellator)> CTessellator