5#define GL_GLEXT_PROTOTYPES
13#include "third_party/skia/include/core/SkData.h"
21#include <emscripten/wasm_worker.h>
36 const std::shared_ptr<impeller::Context>&
context)
const override {
40 bool isOpaque()
const override {
return false; }
76 texture_source_wrapper_(
77 surface->CreateTextureSourceWrapper(texture_source)) {}
80 const std::shared_ptr<impeller::Context>&
context)
const override {
83 texture_source_wrapper_->GetTextureSource(),
width_,
height_);
98 gles_context->GetReactor(), desc, std::move(external_handle));
103 std::unique_ptr<Skwasm::TextureSourceWrapper> texture_source_wrapper_;
112 size_t row_byte_count)
114 data_(
std::move(data)),
116 row_byte_count_(row_byte_count) {}
119 const std::shared_ptr<impeller::Context>&
context)
const override {
136 auto texture =
context->GetResourceAllocator()->CreateTexture(desc);
141 if (!
texture->SetContents(
static_cast<const uint8_t*
>(data_->bytes()),
151 size_t row_byte_count_;
158 sk_sp<flutter::DisplayList> display_list)
160 display_list_(
std::move(display_list)) {}
163 const std::shared_ptr<impeller::Context>&
context)
const override {
170 sk_sp<flutter::DisplayList> display_list_;
176 return sk_make_sp<DlWimpImageFromPicture>(
width,
height,
177 sk_ref_sp(display_list));
184 return sk_sp<flutter::DlImage>(
192 size_t row_byte_count) {
193 return sk_make_sp<DlWimpImageFromPixels>(
width,
height, sk_ref_sp(data),
194 pixel_format, row_byte_count);
DlWimpImageBase(int width, int height)
flutter::DlColorSpace GetColorSpace() const override
Gets the color space of the image.
flutter::DlISize GetSize() const override
virtual ~DlWimpImageBase()
std::shared_ptr< impeller::Texture > GetImpellerTexture(const std::shared_ptr< impeller::Context > &context) const override
bool isOpaque() const override
If the pixel format of this image ignores alpha, this returns true. This method might conservatively ...
size_t GetApproximateByteSize() const override
bool isUIThreadSafe() const override
If the underlying platform image held by this object has no threading requirements for the release of...
DlWimpImageFromPicture(int width, int height, sk_sp< flutter::DisplayList > display_list)
std::shared_ptr< impeller::Texture > GetImpellerTexture(const std::shared_ptr< impeller::Context > &context) const override
DlWimpImageFromPixels(int width, int height, sk_sp< SkData > data, Skwasm::PixelFormat format, size_t row_byte_count)
std::shared_ptr< impeller::Texture > GetImpellerTexture(const std::shared_ptr< impeller::Context > &context) const override
std::shared_ptr< impeller::Texture > GetImpellerTexture(const std::shared_ptr< impeller::Context > &context) const override
DlWimpImageFromTexture(int width, int height, SkwasmObject texture_source, Skwasm::Surface *surface)
static ContextGLES & Cast(Context &base)
Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can b...
static std::shared_ptr< TextureGLES > WrapTexture(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc, HandleGLES external_handle)
Create a texture by wrapping an external OpenGL texture handle. Ownership of the texture handle is as...
uint32_t uint32_t * format
void skwasm_disposeDlImageOnWorker(void *dl_image_ptr)
void skwasm_dispatchDisposeDlImage(unsigned long thread_id, void *pointer)
sk_sp< flutter::DlImage > MakeImageFromTexture(SkwasmObject texture_source, int width, int height, Skwasm::Surface *surface)
__externref_t SkwasmObject
unsigned long GetRasterThread()
sk_sp< flutter::DlImage > MakeImageFromPicture(flutter::DisplayList *display_list, int32_t width, int32_t height)
sk_sp< flutter::DlImage > MakeImageFromPixels(SkData *data, int width, int height, PixelFormat pixel_format, size_t row_byte_count)
std::shared_ptr< Texture > DisplayListToTexture(const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer, bool generate_mips, std::optional< PixelFormat > target_pixel_format)
Render the provided display list to a texture with the given size.
std::shared_ptr< ContextGLES > context
unsigned int skwasm_createGlTextureFromTextureSource(SkwasmObject texture_source, int width, int height)
static constexpr TSize MakeWH(Type width, Type height)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...