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_LIB_UI_PAINTING_VERTICES_H_
6#define FLUTTER_LIB_UI_PAINTING_VERTICES_H_
7
8#include "flutter/lib/ui/dart_wrapper.h"
9#include "third_party/skia/include/core/SkVertices.h"
10#include "third_party/tonic/typed_data/typed_list.h"
11
12namespace tonic {
13class DartLibraryNatives;
14} // namespace tonic
15
16namespace flutter {
17
18class Vertices : public RefCountedDartWrappable<Vertices> {
19 DEFINE_WRAPPERTYPEINFO();
20 FML_FRIEND_MAKE_REF_COUNTED(Vertices);
21
22 public:
23 ~Vertices() override;
24
25 static void RegisterNatives(tonic::DartLibraryNatives* natives);
26
27 static bool init(Dart_Handle vertices_handle,
28 SkVertices::VertexMode vertex_mode,
29 const tonic::Float32List& positions,
30 const tonic::Float32List& texture_coordinates,
31 const tonic::Int32List& colors,
32 const tonic::Uint16List& indices);
33
34 const sk_sp<SkVertices>& vertices() const { return vertices_; }
35
36 size_t GetAllocationSize() const override;
37
38 private:
39 Vertices();
40
41 sk_sp<SkVertices> vertices_;
42};
43
44} // namespace flutter
45
46#endif // FLUTTER_LIB_UI_PAINTING_VERTICES_H_
47