Flutter Engine
The Flutter Engine
Namespaces | Functions
texture.cc File Reference
#include "flutter/lib/gpu/texture.h"
#include "flutter/lib/gpu/formats.h"
#include "flutter/lib/ui/painting/image.h"
#include "fml/mapping.h"
#include "impeller/core/allocator.h"
#include "impeller/core/formats.h"
#include "impeller/core/texture.h"
#include "impeller/display_list/dl_image_impeller.h"
#include "third_party/tonic/typed_data/dart_byte_data.h"

Go to the source code of this file.

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

 flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Texture)
 
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)
 
void InternalFlutterGpu_Texture_SetCoordinateSystem (flutter::gpu::Texture *wrapper, int coordinate_system)
 
bool InternalFlutterGpu_Texture_Overwrite (flutter::gpu::Texture *texture, Dart_Handle source_byte_data)
 
int InternalFlutterGpu_Texture_BytesPerTexel (flutter::gpu::Texture *wrapper)
 
Dart_Handle InternalFlutterGpu_Texture_AsImage (flutter::gpu::Texture *wrapper)
 

Function Documentation

◆ InternalFlutterGpu_Texture_AsImage()

Dart_Handle InternalFlutterGpu_Texture_AsImage ( flutter::gpu::Texture wrapper)

Definition at line 144 of file texture.cc.

144 {
145 return wrapper->AsImage();
146}
Dart_Handle AsImage() const
Definition: texture.cc:52

◆ InternalFlutterGpu_Texture_BytesPerTexel()

int InternalFlutterGpu_Texture_BytesPerTexel ( flutter::gpu::Texture wrapper)

Definition at line 139 of file texture.cc.

140 {
141 return wrapper->GetBytesPerTexel();
142}
size_t GetBytesPerTexel()
Definition: texture.cc:47

◆ InternalFlutterGpu_Texture_Initialize()

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 
)

Exports

Definition at line 74 of file texture.cc.

84 {
86 desc.storage_mode = flutter::gpu::ToImpellerStorageMode(storage_mode);
87 desc.size = {width, height};
89 desc.usage = {};
90 if (enable_render_target_usage) {
92 }
93 if (enable_shader_read_usage) {
95 }
96 if (enable_shader_write_usage) {
98 }
99 switch (sample_count) {
100 case 1:
103 break;
104 case 4:
107 break;
108 default:
109 return false;
110 }
111 auto texture =
112 gpu_context->GetContext()->GetResourceAllocator()->CreateTexture(desc);
113 if (!texture) {
114 FML_LOG(ERROR) << "Failed to create texture.";
115 return false;
116 }
117
118 texture->SetCoordinateSystem(
120
121 auto res = fml::MakeRefCounted<flutter::gpu::Texture>(std::move(texture));
122 res->AssociateWithDartWrapper(wrapper);
123
124 return true;
125}
std::shared_ptr< impeller::Context > GetContext()
Definition: context.cc:65
uint32_t uint32_t * format
#define FML_LOG(severity)
Definition: logging.h:82
FlTexture * texture
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition: formats.h:60
constexpr impeller::TextureCoordinateSystem ToImpellerTextureCoordinateSystem(FlutterGPUTextureCoordinateSystem value)
Definition: formats.h:145
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
Definition: formats.h:25
int32_t height
int32_t width
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
#define ERROR(message)
Definition: elf_loader.cc:260

◆ InternalFlutterGpu_Texture_Overwrite()

bool InternalFlutterGpu_Texture_Overwrite ( flutter::gpu::Texture texture,
Dart_Handle  source_byte_data 
)

Definition at line 134 of file texture.cc.

135 {
136 return texture->Overwrite(tonic::DartByteData(source_byte_data));
137}

◆ InternalFlutterGpu_Texture_SetCoordinateSystem()

void InternalFlutterGpu_Texture_SetCoordinateSystem ( flutter::gpu::Texture wrapper,
int  coordinate_system 
)

Definition at line 127 of file texture.cc.

129 {
130 return wrapper->SetCoordinateSystem(
132}
void SetCoordinateSystem(impeller::TextureCoordinateSystem coordinate_system)
Definition: texture.cc:30