Flutter Engine
The Flutter Engine
GrMeshBuffers.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrMeshBuffers_DEFINED
9#define GrMeshBuffers_DEFINED
10
15#include "src/core/SkMeshPriv.h"
17
18#include <cstddef>
19
20template <typename Base, GrGpuBufferType> class GrMeshBuffer final : public Base {
21public:
22 GrMeshBuffer() = default;
23
24 ~GrMeshBuffer() override;
25
26 static sk_sp<Base> Make(GrDirectContext*, const void* data, size_t size);
27
28 size_t size() const override {
29 SkASSERT(fBuffer);
30 return fBuffer->size();
31 }
32
33 bool isGaneshBacked() const override { return true; }
34
35 sk_sp<const GrGpuBuffer> asGpuBuffer() const { return fBuffer; }
36
37private:
38 bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) override;
39
40 sk_sp<GrGpuBuffer> fBuffer;
42};
43
44namespace SkMeshPriv {
47} // namespace SkMeshPriv
48
49#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
size_t size() const final
Definition: GrGpuBuffer.h:34
bool isGaneshBacked() const override
Definition: GrMeshBuffers.h:33
GrMeshBuffer()=default
size_t size() const override
Definition: GrMeshBuffers.h:28
~GrMeshBuffer() override
static sk_sp< Base > Make(GrDirectContext *, const void *data, size_t size)
sk_sp< const GrGpuBuffer > asGpuBuffer() const
Definition: GrMeshBuffers.h:35
SeparatedVector2 offset
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63