Flutter Engine
The Flutter Engine
texture.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_TEXTURE_H_
6#define FLUTTER_LIB_GPU_TEXTURE_H_
7
8#include "flutter/lib/gpu/context.h"
9#include "flutter/lib/gpu/export.h"
10#include "flutter/lib/ui/dart_wrapper.h"
13
14namespace flutter {
15namespace gpu {
16
17class Texture : public RefCountedDartWrappable<Texture> {
18 DEFINE_WRAPPERTYPEINFO();
19 FML_FRIEND_MAKE_REF_COUNTED(Texture);
20
21 public:
22 explicit Texture(std::shared_ptr<impeller::Texture> texture);
23
24 ~Texture() override;
25
26 std::shared_ptr<impeller::Texture> GetTexture();
27
29
30 bool Overwrite(const tonic::DartByteData& source_bytes);
31
32 size_t GetBytesPerTexel();
33
34 Dart_Handle AsImage() const;
35
36 private:
37 std::shared_ptr<impeller::Texture> texture_;
38
39 FML_DISALLOW_COPY_AND_ASSIGN(Texture);
40};
41
42} // namespace gpu
43} // namespace flutter
44
45//----------------------------------------------------------------------------
46/// Exports
47///
48
49extern "C" {
50
53 Dart_Handle wrapper,
54 flutter::gpu::Context* gpu_context,
55 int storage_mode,
56 int format,
57 int width,
58 int height,
59 int sample_count,
60 int coordinate_system,
61 bool enable_render_target_usage,
62 bool enable_shader_read_usage,
63 bool enable_shader_write_usage);
64
67 flutter::gpu::Texture* wrapper,
68 int coordinate_system);
69
72 Dart_Handle source_byte_data);
73
76 flutter::gpu::Texture* wrapper);
77
80 flutter::gpu::Texture* wrapper);
81
82} // extern "C"
83
84#endif // FLUTTER_LIB_GPU_TEXTURE_H_
Texture(std::shared_ptr< impeller::Texture > texture)
Definition: texture.cc:21
size_t GetBytesPerTexel()
Definition: texture.cc:47
std::shared_ptr< impeller::Texture > GetTexture()
Definition: texture.cc:26
bool Overwrite(const tonic::DartByteData &source_bytes)
Definition: texture.cc:35
Dart_Handle AsImage() const
Definition: texture.cc:52
void SetCoordinateSystem(impeller::TextureCoordinateSystem coordinate_system)
Definition: texture.cc:30
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
uint32_t uint32_t * format
#define FLUTTER_GPU_EXPORT
Definition: export.h:13
FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Texture_AsImage(flutter::gpu::Texture *wrapper)
Definition: texture.cc:144
FLUTTER_GPU_EXPORT void InternalFlutterGpu_Texture_SetCoordinateSystem(flutter::gpu::Texture *wrapper, int coordinate_system)
Definition: texture.cc:127
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Initialize(Dart_Handle wrapper, flutter::gpu::Context *gpu_context, int storage_mode, int format, int width, int height, int sample_count, int coordinate_system, bool enable_render_target_usage, bool enable_shader_read_usage, bool enable_shader_write_usage)
Definition: texture.cc:74
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Overwrite(flutter::gpu::Texture *wrapper, Dart_Handle source_byte_data)
Definition: texture.cc:134
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Texture_BytesPerTexel(flutter::gpu::Texture *wrapper)
Definition: texture.cc:139
FlTexture * texture
TextureCoordinateSystem
Definition: formats.h:327
int32_t height
int32_t width