26#include <GLES2/gl2ext.h>
27#include <emscripten/html5_webgl.h>
41 case PixelFormat::rgba8888:
43 case PixelFormat::bgra8888:
45 case PixelFormat::rgbaFloat32:
52 case PixelFormat::rgba8888:
53 case PixelFormat::bgra8888:
55 case PixelFormat::rgbaFloat32:
64 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
65 : _backendTexture(backendTexture),
66 _textureId(textureId),
67 _webGLContext(context) {}
73 glDeleteTextures(1, &_textureId);
79 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE _webGLContext;
89 _textureSourceWrapper(
90 surface->createTextureSourceWrapper(textureSource)) {}
97 _textureSourceWrapper->getTextureSource(),
fInfo.
width(),
100 glInfo.
fTarget = GL_TEXTURE_2D;
108 return std::make_unique<ExternalWebGLTexture>(
109 backendTexture, glInfo.
fID, emscripten_webgl_get_current_context());
113 std::unique_ptr<Skwasm::TextureSourceWrapper> _textureSourceWrapper;
120 nullptr,
nullptr, BitDepth::kU8,
129 size_t rowByteCount) {
132 colorTypeForPixelFormat(pixelFormat),
133 alphaTypeForPixelFormat(pixelFormat),
144 std::unique_ptr<TextureSourceImageGenerator>(
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kTextureBinding_GrGLBackendState
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
sk_sp< T > sk_ref_sp(T *obj)
void resetContext(uint32_t state=kAll_GrBackendState)
virtual GrBackendTexture getBackendTexture()=0
static sk_sp< SkColorSpace > MakeSRGB()
std::unique_ptr< GrExternalTexture > generateExternalTexture(GrRecordingContext *context, skgpu::Mipmapped mipmapped) override
TextureSourceImageGenerator(SkImageInfo ii, SkwasmObject textureSource, Skwasm::Surface *surface)
uint32_t uint32_t * format
SKWASM_EXPORT void image_dispose(SkImage *image)
SKWASM_EXPORT SkImage * image_createFromPicture(SkPicture *picture, int32_t width, int32_t height)
SKWASM_EXPORT int image_getWidth(SkImage *image)
SKWASM_EXPORT SkImage * image_createFromPixels(SkData *data, int width, int height, PixelFormat pixelFormat, size_t rowByteCount)
SKWASM_EXPORT int image_getHeight(SkImage *image)
SKWASM_EXPORT SkImage * image_createFromTextureSource(SkwasmObject textureSource, int width, int height, Skwasm::Surface *surface)
SKWASM_EXPORT void image_ref(SkImage *image)
SK_API GrBackendTexture MakeGL(int width, int height, skgpu::Mipmapped, const GrGLTextureInfo &glInfo, std::string_view label={})
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
SK_API sk_sp< SkImage > DeferredFromTextureGenerator(std::unique_ptr< GrTextureGenerator > gen)
SK_API sk_sp< SkImage > RasterFromData(const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
__externref_t SkwasmObject
unsigned int skwasm_createGlTextureFromTextureSource(SkwasmObject textureSource, int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
std::shared_ptr< const fml::Mapping > data