Flutter Engine
The Flutter Engine
device_buffer.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_LIB_GPU_DEVICE_BUFFER_H_
6#define FLUTTER_LIB_GPU_DEVICE_BUFFER_H_
7
8#include "flutter/lib/gpu/context.h"
9#include "flutter/lib/gpu/export.h"
10#include "flutter/lib/ui/dart_wrapper.h"
11
13
14namespace flutter {
15namespace gpu {
16
17class DeviceBuffer : public RefCountedDartWrappable<DeviceBuffer> {
18 DEFINE_WRAPPERTYPEINFO();
19 FML_FRIEND_MAKE_REF_COUNTED(DeviceBuffer);
20
21 public:
22 explicit DeviceBuffer(std::shared_ptr<impeller::DeviceBuffer> device_buffer);
23
24 ~DeviceBuffer() override;
25
26 std::shared_ptr<impeller::DeviceBuffer> GetBuffer();
27
28 bool Overwrite(const tonic::DartByteData& source_bytes,
29 size_t destination_offset_in_bytes);
30
31 private:
32 std::shared_ptr<impeller::DeviceBuffer> device_buffer_;
33
34 FML_DISALLOW_COPY_AND_ASSIGN(DeviceBuffer);
35};
36
37} // namespace gpu
38} // namespace flutter
39
40//----------------------------------------------------------------------------
41/// Exports
42///
43
44extern "C" {
45
48 Dart_Handle wrapper,
49 flutter::gpu::Context* gpu_context,
50 int storage_mode,
51 int size_in_bytes);
52
55 Dart_Handle wrapper,
56 flutter::gpu::Context* gpu_context,
57 Dart_Handle byte_data);
58
62 Dart_Handle source_byte_data,
63 int destination_offset_in_bytes);
64
65} // extern "C"
66
67#endif // FLUTTER_LIB_GPU_DEVICE_BUFFER_H_
bool Overwrite(const tonic::DartByteData &source_bytes, size_t destination_offset_in_bytes)
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
DeviceBuffer(std::shared_ptr< impeller::DeviceBuffer > device_buffer)
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
#define FLUTTER_GPU_EXPORT
Definition: export.h:13
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_DeviceBuffer_InitializeWithHostData(Dart_Handle wrapper, flutter::gpu::Context *gpu_context, Dart_Handle byte_data)
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_DeviceBuffer_Initialize(Dart_Handle wrapper, flutter::gpu::Context *gpu_context, int storage_mode, int size_in_bytes)
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_DeviceBuffer_Overwrite(flutter::gpu::DeviceBuffer *wrapper, Dart_Handle source_byte_data, int destination_offset_in_bytes)