@nativescript/canvas 2.0.0-webgpu.2 → 2.0.0-webgpu.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Canvas/common.d.ts +3 -4
- package/Canvas/common.js +35 -125
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +0 -1
- package/Canvas/index.android.js +45 -38
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +11 -3
- package/Canvas/index.ios.js +49 -40
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas/utils.d.ts +3 -0
- package/Canvas/utils.js +85 -0
- package/Canvas/utils.js.map +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Dom/Group.d.ts +1 -2
- package/Dom/Group.js.map +1 -1
- package/Dom/Image.js +0 -1
- package/Dom/Image.js.map +1 -1
- package/Dom/Paint.d.ts +1 -1
- package/Dom/shapes/Path.d.ts +1 -1
- package/ImageAsset/index.js +77 -33
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/index.js +107 -20
- package/ImageBitmap/index.js.map +1 -1
- package/README.md +2 -4
- package/WebGL/WebGLRenderingContext/index.js +73 -31
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +4 -4
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/GPU.js +4 -3
- package/WebGPU/GPU.js.map +1 -1
- package/WebGPU/GPUAdapter.d.ts +6 -3
- package/WebGPU/GPUAdapter.js +31 -0
- package/WebGPU/GPUAdapter.js.map +1 -1
- package/WebGPU/GPUBindGroup.d.ts +1 -0
- package/WebGPU/GPUBindGroup.js +3 -0
- package/WebGPU/GPUBindGroup.js.map +1 -1
- package/WebGPU/GPUBindGroupLayout.d.ts +1 -0
- package/WebGPU/GPUBindGroupLayout.js +3 -0
- package/WebGPU/GPUBindGroupLayout.js.map +1 -1
- package/WebGPU/GPUBuffer.js +10 -2
- package/WebGPU/GPUBuffer.js.map +1 -1
- package/WebGPU/GPUCanvasContext.d.ts +3 -2
- package/WebGPU/GPUCanvasContext.js +52 -10
- package/WebGPU/GPUCanvasContext.js.map +1 -1
- package/WebGPU/GPUCommandBuffer.d.ts +1 -0
- package/WebGPU/GPUCommandBuffer.js +3 -0
- package/WebGPU/GPUCommandBuffer.js.map +1 -1
- package/WebGPU/GPUCommandEncoder.d.ts +3 -9
- package/WebGPU/GPUCommandEncoder.js +94 -41
- package/WebGPU/GPUCommandEncoder.js.map +1 -1
- package/WebGPU/GPUComputePassEncoder.d.ts +1 -0
- package/WebGPU/GPUComputePassEncoder.js +3 -0
- package/WebGPU/GPUComputePassEncoder.js.map +1 -1
- package/WebGPU/GPUComputePipeline.d.ts +1 -0
- package/WebGPU/GPUComputePipeline.js +3 -0
- package/WebGPU/GPUComputePipeline.js.map +1 -1
- package/WebGPU/GPUDevice.d.ts +17 -79
- package/WebGPU/GPUDevice.js +72 -91
- package/WebGPU/GPUDevice.js.map +1 -1
- package/WebGPU/GPUExternalTexture.d.ts +1 -0
- package/WebGPU/GPUExternalTexture.js +3 -0
- package/WebGPU/GPUExternalTexture.js.map +1 -1
- package/WebGPU/GPUPipelineLayout.d.ts +1 -0
- package/WebGPU/GPUPipelineLayout.js +3 -0
- package/WebGPU/GPUPipelineLayout.js.map +1 -1
- package/WebGPU/GPUQuerySet.d.ts +1 -0
- package/WebGPU/GPUQuerySet.js +3 -0
- package/WebGPU/GPUQuerySet.js.map +1 -1
- package/WebGPU/GPUQueue.d.ts +1 -0
- package/WebGPU/GPUQueue.js +45 -7
- package/WebGPU/GPUQueue.js.map +1 -1
- package/WebGPU/GPURenderBundle.d.ts +1 -0
- package/WebGPU/GPURenderBundle.js +3 -0
- package/WebGPU/GPURenderBundle.js.map +1 -1
- package/WebGPU/GPURenderBundleEncoder.d.ts +4 -2
- package/WebGPU/GPURenderBundleEncoder.js +7 -3
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
- package/WebGPU/GPURenderPassEncoder.d.ts +2 -1
- package/WebGPU/GPURenderPassEncoder.js +5 -2
- package/WebGPU/GPURenderPassEncoder.js.map +1 -1
- package/WebGPU/GPURenderPipeline.d.ts +1 -0
- package/WebGPU/GPURenderPipeline.js +3 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -1
- package/WebGPU/GPUSampler.d.ts +1 -0
- package/WebGPU/GPUSampler.js +3 -0
- package/WebGPU/GPUSampler.js.map +1 -1
- package/WebGPU/GPUShaderModule.d.ts +1 -1
- package/WebGPU/GPUShaderModule.js +2 -2
- package/WebGPU/GPUShaderModule.js.map +1 -1
- package/WebGPU/GPUTexture.d.ts +1 -0
- package/WebGPU/GPUTexture.js +3 -0
- package/WebGPU/GPUTexture.js.map +1 -1
- package/WebGPU/GPUTextureView.d.ts +1 -0
- package/WebGPU/GPUTextureView.js +3 -0
- package/WebGPU/GPUTextureView.js.map +1 -1
- package/WebGPU/Interfaces.d.ts +95 -4
- package/WebGPU/Types.d.ts +9 -1
- package/WebGPU/Utils.d.ts +6 -0
- package/WebGPU/Utils.js +221 -0
- package/WebGPU/Utils.js.map +1 -1
- package/angular/esm2022/index.mjs +4 -4
- package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
- package/angular/package.json +20 -0
- package/package.json +1 -3
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +9 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +226 -61
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +656 -644
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +18 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +226 -61
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +6871 -5995
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +7 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +27 -27
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +658 -646
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +696 -684
- package/platforms/ios/src/NSOperationQueueWrapper.h +3 -1
- package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
- package/platforms/ios/src/cpp/AsyncCallback.h +214 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +123 -47
- package/platforms/ios/src/cpp/Helpers.h +2 -164
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +18 -26
- package/platforms/ios/src/cpp/ImageAssetImpl.h +3 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +12 -4
- package/platforms/ios/src/cpp/NativeType.h +87 -0
- package/platforms/ios/src/cpp/ObjectWrapperImpl.h +50 -0
- package/platforms/ios/src/cpp/PromiseCallback.h +197 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +7 -6
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +1 -1
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +6 -6
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +18 -13
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +2 -2
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +1 -1
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +10 -10
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +6 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
- package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLProgram.h +3 -3
- package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +3 -3
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +106 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLShader.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +5 -5
- package/platforms/ios/src/cpp/webgl/WebGLTexture.h +3 -2
- package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +5 -5
- package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +2 -2
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +1 -1
- package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +142 -73
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +32 -6
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +80 -32
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +8 -4
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +11 -5
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +29 -2
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +101 -106
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +5 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +42 -14
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1683 -733
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +53 -39
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +8 -5
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +2 -3
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +88 -36
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +43 -14
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +40 -14
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +26 -1
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +25 -1
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +2 -2
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +34 -8
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +6 -4
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +27 -1
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +5 -2
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
- package/utils.d.ts +1 -1
|
@@ -145,6 +145,7 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
145
145
|
Path2D::Init(canvasMod, isolate);
|
|
146
146
|
ImageDataImpl::Init(canvasMod, isolate);
|
|
147
147
|
ImageAssetImpl::Init(canvasMod, isolate);
|
|
148
|
+
ImageBitmapImpl::Init(canvasMod, isolate);
|
|
148
149
|
CanvasGradient::Init(canvasMod, isolate);
|
|
149
150
|
CanvasPattern::Init(canvasMod, isolate);
|
|
150
151
|
MatrixImpl::Init(canvasMod, isolate);
|
|
@@ -285,7 +286,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
285
286
|
|
|
286
287
|
if (image->IsNullOrUndefined()) {
|
|
287
288
|
v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate, "Failed to load image"),
|
|
288
|
-
v8::
|
|
289
|
+
v8::Null(isolate)};
|
|
289
290
|
|
|
290
291
|
cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
|
|
291
292
|
return;
|
|
@@ -295,7 +296,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
295
296
|
|
|
296
297
|
v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate,
|
|
297
298
|
"Failed to execute 'createImageBitmap' : The crop rect width is 0"),
|
|
298
|
-
v8::
|
|
299
|
+
v8::Null(isolate)};
|
|
299
300
|
|
|
300
301
|
cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
|
|
301
302
|
|
|
@@ -304,7 +305,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
304
305
|
if (len >= 5 && (sh->IsNumber() && sh->IsNumber() == 0)) {
|
|
305
306
|
v8::Local<v8::Value> ret[2] = {ConvertToV8String(isolate,
|
|
306
307
|
"Failed to execute 'createImageBitmap' : The crop rect height is 0"),
|
|
307
|
-
v8::
|
|
308
|
+
v8::Null(isolate)};
|
|
308
309
|
|
|
309
310
|
cb.As<v8::Function>()->Call(context, context->Global(), 2, ret);
|
|
310
311
|
return;
|
|
@@ -338,16 +339,18 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
338
339
|
#ifdef __ANDROID__
|
|
339
340
|
ALooper_addFd(jsi_callback->looper_,
|
|
340
341
|
jsi_callback->fd_[0],
|
|
341
|
-
|
|
342
|
+
0,
|
|
342
343
|
ALOOPER_EVENT_INPUT,
|
|
343
344
|
[](int fd, int events,
|
|
344
345
|
void *data) {
|
|
346
|
+
if(data == nullptr){
|
|
347
|
+
return 1;
|
|
348
|
+
}
|
|
345
349
|
auto cb = static_cast<JSICallback *>(data);
|
|
346
350
|
bool done;
|
|
347
351
|
read(fd, &done,
|
|
348
352
|
sizeof(bool));
|
|
349
353
|
|
|
350
|
-
|
|
351
354
|
v8::Isolate *isolate = cb->isolate_;
|
|
352
355
|
v8::Locker locker(isolate);
|
|
353
356
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -372,23 +375,23 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
372
375
|
args[1] = v8::Null(isolate);
|
|
373
376
|
}
|
|
374
377
|
|
|
375
|
-
|
|
376
378
|
callback->Call(context, context->Global(), 2, args);
|
|
377
379
|
|
|
378
380
|
delete static_cast<JSICallback *>(data);
|
|
379
381
|
return 0;
|
|
380
382
|
}, jsi_callback);
|
|
381
383
|
|
|
382
|
-
ALooper_wake(jsi_callback->looper_);
|
|
383
|
-
|
|
384
384
|
if (isArrayBuffer) {
|
|
385
|
+
// converting to Uint8Array
|
|
385
386
|
auto arrayBuffer = imageObject.As<v8::ArrayBuffer>();
|
|
386
|
-
auto
|
|
387
|
+
auto size = arrayBuffer->ByteLength();
|
|
388
|
+
imageObject = v8::Uint8Array::New(arrayBuffer, 0, size);
|
|
389
|
+
/* auto store = arrayBuffer->GetBackingStore();
|
|
387
390
|
auto dataBuffer = (uint8_t *) store->Data();
|
|
388
|
-
|
|
391
|
+
|
|
389
392
|
std::thread thread(
|
|
390
|
-
[&dataBuffer, jsi_callback, &options, store, shared_asset](
|
|
391
|
-
v8::Global<v8::ArrayBuffer> ab
|
|
393
|
+
[&dataBuffer, jsi_callback, &options, store, shared_asset, size](
|
|
394
|
+
v8::Global<v8::ArrayBuffer> ab) {
|
|
392
395
|
|
|
393
396
|
|
|
394
397
|
auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
|
|
@@ -401,23 +404,24 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
401
404
|
options.resizeHeight,
|
|
402
405
|
shared_asset);
|
|
403
406
|
|
|
404
|
-
canvas_native_image_asset_release(shared_asset);
|
|
405
|
-
|
|
406
407
|
write(jsi_callback->fd_[1],
|
|
407
408
|
&done,
|
|
408
409
|
sizeof(bool));
|
|
409
410
|
|
|
411
|
+
// canvas_native_image_asset_release(shared_asset);
|
|
410
412
|
|
|
411
|
-
|
|
413
|
+
|
|
414
|
+
});
|
|
412
415
|
|
|
413
416
|
thread.detach();
|
|
414
417
|
return;
|
|
418
|
+
|
|
419
|
+
*/
|
|
415
420
|
}
|
|
416
421
|
|
|
417
422
|
|
|
418
423
|
auto ta = imageObject.As<v8::ArrayBufferView>();
|
|
419
424
|
|
|
420
|
-
|
|
421
425
|
auto array = ta->Buffer();
|
|
422
426
|
auto offset = ta->ByteOffset();
|
|
423
427
|
auto size = ta->ByteLength();
|
|
@@ -440,12 +444,12 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
440
444
|
options.resizeHeight,
|
|
441
445
|
shared_asset);
|
|
442
446
|
|
|
443
|
-
canvas_native_image_asset_release(shared_asset);
|
|
444
|
-
|
|
445
447
|
write(jsi_callback->fd_[1],
|
|
446
448
|
&done,
|
|
447
449
|
sizeof(bool));
|
|
448
450
|
|
|
451
|
+
// canvas_native_image_asset_release(shared_asset);
|
|
452
|
+
|
|
449
453
|
|
|
450
454
|
}, std::move(ab));
|
|
451
455
|
thread.detach();
|
|
@@ -464,9 +468,74 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
464
468
|
auto dataBuffer = (uint8_t *) store->Data();
|
|
465
469
|
v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
|
|
466
470
|
|
|
471
|
+
auto size = arrayBuffer->ByteLength();
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
auto thread_queue = new NSOperationQueueWrapper(false);
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
thread_queue->addOperation([&dataBuffer, jsi_callback, &options, store, shared_asset, current_queue, &ab, size]() {
|
|
478
|
+
|
|
479
|
+
auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
|
|
480
|
+
dataBuffer, size,
|
|
481
|
+
options.flipY,
|
|
482
|
+
options.premultiplyAlpha,
|
|
483
|
+
options.colorSpaceConversion,
|
|
484
|
+
options.resizeQuality,
|
|
485
|
+
options.resizeWidth,
|
|
486
|
+
options.resizeHeight,
|
|
487
|
+
shared_asset);
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
auto main_task = [jsi_callback, current_queue, done, shared_asset]() {
|
|
492
|
+
|
|
493
|
+
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
494
|
+
v8::Locker locker(isolate);
|
|
495
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
496
|
+
v8::HandleScope handle_scope(isolate);
|
|
497
|
+
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
498
|
+
v8::Local<v8::External> cbData = jsi_callback->data_->Get(
|
|
499
|
+
isolate).As<v8::External>();
|
|
500
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
501
|
+
v8::Context::Scope context_scope(context);
|
|
502
|
+
|
|
503
|
+
auto ret = ImageBitmapImpl::NewInstance(isolate, cbData);
|
|
504
|
+
|
|
505
|
+
v8::Local<v8::Value> args[2];
|
|
506
|
+
|
|
507
|
+
if (done) {
|
|
508
|
+
args[0] = v8::Null(isolate);
|
|
509
|
+
args[1] = ret;
|
|
510
|
+
|
|
511
|
+
} else {
|
|
512
|
+
args[0] = v8::Exception::Error(
|
|
513
|
+
ConvertToV8String(isolate, "Failed to load image"));
|
|
514
|
+
args[1] = v8::Null(isolate);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
callback->Call(context, context->Global(), 2, args);
|
|
519
|
+
|
|
520
|
+
delete jsi_callback;
|
|
521
|
+
delete current_queue;
|
|
522
|
+
|
|
523
|
+
canvas_native_image_asset_release(shared_asset);
|
|
524
|
+
|
|
525
|
+
};
|
|
526
|
+
current_queue->addOperation(main_task);
|
|
527
|
+
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
/*
|
|
467
536
|
std::thread thread(
|
|
468
|
-
[&dataBuffer, jsi_callback, &options, store, shared_asset, current_queue](
|
|
469
|
-
v8::Global<v8::ArrayBuffer> ab
|
|
537
|
+
[&dataBuffer, jsi_callback, &options, store, &shared_asset, current_queue, size](
|
|
538
|
+
v8::Global<v8::ArrayBuffer> ab
|
|
470
539
|
) {
|
|
471
540
|
|
|
472
541
|
auto done = canvas_native_image_bitmap_create_from_encoded_bytes_with_output(
|
|
@@ -479,10 +548,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
479
548
|
options.resizeHeight,
|
|
480
549
|
shared_asset);
|
|
481
550
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
auto main_task = [jsi_callback, current_queue, done]() {
|
|
551
|
+
auto main_task = [jsi_callback, current_queue, done, shared_asset]() {
|
|
486
552
|
|
|
487
553
|
|
|
488
554
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
@@ -516,12 +582,17 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
516
582
|
delete jsi_callback;
|
|
517
583
|
delete current_queue;
|
|
518
584
|
|
|
585
|
+
canvas_native_image_asset_release(shared_asset);
|
|
586
|
+
|
|
519
587
|
};
|
|
520
588
|
current_queue->addOperation(main_task);
|
|
521
589
|
|
|
522
|
-
}, std::move(ab)
|
|
590
|
+
}, std::move(ab));
|
|
591
|
+
|
|
592
|
+
thread.detach();
|
|
523
593
|
|
|
524
|
-
|
|
594
|
+
|
|
595
|
+
*/
|
|
525
596
|
|
|
526
597
|
return;
|
|
527
598
|
}
|
|
@@ -553,9 +624,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
553
624
|
options.resizeHeight,
|
|
554
625
|
shared_asset);
|
|
555
626
|
|
|
556
|
-
canvas_native_image_asset_release(shared_asset);
|
|
557
627
|
|
|
558
|
-
auto main_task = [jsi_callback, current_queue, done]() {
|
|
628
|
+
auto main_task = [jsi_callback, current_queue, done, shared_asset]() {
|
|
559
629
|
|
|
560
630
|
|
|
561
631
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
@@ -587,6 +657,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
587
657
|
delete jsi_callback;
|
|
588
658
|
delete current_queue;
|
|
589
659
|
|
|
660
|
+
canvas_native_image_asset_release(shared_asset);
|
|
661
|
+
|
|
590
662
|
};
|
|
591
663
|
current_queue->addOperation(main_task);
|
|
592
664
|
|
|
@@ -617,7 +689,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
617
689
|
#ifdef __ANDROID__
|
|
618
690
|
ALooper_addFd(jsi_callback->looper_,
|
|
619
691
|
jsi_callback->fd_[0],
|
|
620
|
-
|
|
692
|
+
0,
|
|
621
693
|
ALOOPER_EVENT_INPUT,
|
|
622
694
|
[](int fd, int events,
|
|
623
695
|
void *data) {
|
|
@@ -655,11 +727,13 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
655
727
|
return 0;
|
|
656
728
|
}, jsi_callback);
|
|
657
729
|
|
|
658
|
-
ALooper_wake(jsi_callback->looper_);
|
|
659
|
-
|
|
660
730
|
auto bufferValue = args[0];
|
|
661
731
|
|
|
662
732
|
if (isArrayBuffer) {
|
|
733
|
+
auto arrayBuffer = bufferValue.As<v8::ArrayBuffer>();
|
|
734
|
+
auto size = arrayBuffer->ByteLength();
|
|
735
|
+
imageObject = v8::Uint8Array::New(arrayBuffer, 0, size);
|
|
736
|
+
/*
|
|
663
737
|
auto arrayBuffer = bufferValue.As<v8::ArrayBuffer>();
|
|
664
738
|
auto dataBuffer = (uint8_t *) arrayBuffer->GetBackingStore()->Data();
|
|
665
739
|
v8::Global<v8::ArrayBuffer> ab(isolate, arrayBuffer);
|
|
@@ -686,13 +760,12 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
686
760
|
options.resizeWidth,
|
|
687
761
|
options.resizeHeight, shared_asset);
|
|
688
762
|
|
|
689
|
-
canvas_native_image_asset_release(shared_asset);
|
|
690
|
-
|
|
691
|
-
|
|
692
763
|
write(jsi_callback->fd_[1],
|
|
693
764
|
&done,
|
|
694
765
|
sizeof(bool));
|
|
695
766
|
|
|
767
|
+
canvas_native_image_asset_release(shared_asset);
|
|
768
|
+
|
|
696
769
|
},
|
|
697
770
|
(float) sx_or_options->NumberValue(context).ToChecked(),
|
|
698
771
|
(float) sy->NumberValue(context).ToChecked(),
|
|
@@ -703,6 +776,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
703
776
|
thread.detach();
|
|
704
777
|
|
|
705
778
|
return;
|
|
779
|
+
*/
|
|
706
780
|
}
|
|
707
781
|
|
|
708
782
|
auto ta = bufferValue.As<v8::ArrayBufferView>();
|
|
@@ -736,13 +810,13 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
736
810
|
options.resizeWidth,
|
|
737
811
|
options.resizeHeight, shared_asset);
|
|
738
812
|
|
|
739
|
-
canvas_native_image_asset_release(shared_asset);
|
|
740
|
-
|
|
741
813
|
|
|
742
814
|
write(jsi_callback->fd_[1],
|
|
743
815
|
&done,
|
|
744
816
|
sizeof(bool));
|
|
745
817
|
|
|
818
|
+
canvas_native_image_asset_release(shared_asset);
|
|
819
|
+
|
|
746
820
|
},
|
|
747
821
|
(float) sx_or_options->NumberValue(context).ToChecked(),
|
|
748
822
|
(float) sy->NumberValue(context).ToChecked(),
|
|
@@ -786,10 +860,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
786
860
|
options.resizeWidth,
|
|
787
861
|
options.resizeHeight, shared_asset);
|
|
788
862
|
|
|
789
|
-
canvas_native_image_asset_release(shared_asset);
|
|
790
|
-
|
|
791
863
|
|
|
792
|
-
auto main_task = [jsi_callback, current_queue, done]() {
|
|
864
|
+
auto main_task = [jsi_callback, current_queue, done,shared_asset]() {
|
|
793
865
|
|
|
794
866
|
|
|
795
867
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
@@ -823,6 +895,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
823
895
|
delete jsi_callback;
|
|
824
896
|
delete current_queue;
|
|
825
897
|
|
|
898
|
+
canvas_native_image_asset_release(shared_asset);
|
|
899
|
+
|
|
826
900
|
};
|
|
827
901
|
current_queue->addOperation(main_task);
|
|
828
902
|
|
|
@@ -871,9 +945,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
871
945
|
options.resizeWidth,
|
|
872
946
|
options.resizeHeight, shared_asset);
|
|
873
947
|
|
|
874
|
-
canvas_native_image_asset_release(shared_asset);
|
|
875
948
|
|
|
876
|
-
auto main_task = [jsi_callback, current_queue, done]() {
|
|
949
|
+
auto main_task = [jsi_callback, current_queue, done, shared_asset]() {
|
|
877
950
|
|
|
878
951
|
|
|
879
952
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
@@ -905,6 +978,8 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
905
978
|
delete jsi_callback;
|
|
906
979
|
delete current_queue;
|
|
907
980
|
|
|
981
|
+
canvas_native_image_asset_release(shared_asset);
|
|
982
|
+
|
|
908
983
|
};
|
|
909
984
|
current_queue->addOperation(main_task);
|
|
910
985
|
|
|
@@ -927,7 +1002,7 @@ void CanvasJSIModule::CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value
|
|
|
927
1002
|
}
|
|
928
1003
|
}
|
|
929
1004
|
|
|
930
|
-
auto type = GetNativeType(image);
|
|
1005
|
+
auto type = ObjectWrapperImpl::GetNativeType(image);
|
|
931
1006
|
|
|
932
1007
|
if (len == 1 || len == 2) {
|
|
933
1008
|
if (len == 2) {
|
|
@@ -1080,11 +1155,15 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1080
1155
|
#ifdef __ANDROID__
|
|
1081
1156
|
ALooper_addFd(jsi_callback->looper_,
|
|
1082
1157
|
jsi_callback->fd_[0],
|
|
1083
|
-
|
|
1158
|
+
0,
|
|
1084
1159
|
ALOOPER_EVENT_INPUT,
|
|
1085
1160
|
[](int fd, int events,
|
|
1086
1161
|
void *data) {
|
|
1087
1162
|
|
|
1163
|
+
if(data == 0){
|
|
1164
|
+
return 0;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1088
1167
|
auto cb = static_cast<JSIReadFileCallback *>(data);
|
|
1089
1168
|
bool done;
|
|
1090
1169
|
read(fd, &done,
|
|
@@ -1154,7 +1233,6 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1154
1233
|
}
|
|
1155
1234
|
return 0;
|
|
1156
1235
|
}
|
|
1157
|
-
LogToConsole(ConvertFromV8String(isolate, stackV8Str));
|
|
1158
1236
|
|
|
1159
1237
|
}
|
|
1160
1238
|
}
|
|
@@ -1165,15 +1243,13 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1165
1243
|
return 0;
|
|
1166
1244
|
}, jsi_callback);
|
|
1167
1245
|
|
|
1168
|
-
ALooper_wake(jsi_callback->looper_);
|
|
1169
|
-
|
|
1170
1246
|
std::thread thread(
|
|
1171
1247
|
[jsi_callback](const std::string &file) {
|
|
1172
1248
|
bool done = false;
|
|
1173
1249
|
auto ret = canvas_native_helper_read_file(file.c_str());
|
|
1174
1250
|
|
|
1175
1251
|
if (!canvas_native_helper_read_file_has_error(ret)) {
|
|
1176
|
-
auto buf =
|
|
1252
|
+
auto buf = canvas_native_helper_read_file_take_data(ret);
|
|
1177
1253
|
|
|
1178
1254
|
jsi_callback->SetData(buf);
|
|
1179
1255
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#include "Common.h"
|
|
9
9
|
#include "OneByteStringResource.h"
|
|
10
10
|
#include "v8-fast-api-calls.h"
|
|
11
|
+
#include "AsyncCallback.h"
|
|
12
|
+
#include "PromiseCallback.h"
|
|
11
13
|
//#ifdef __APPLE__
|
|
12
14
|
//#ifdef __OBJC__
|
|
13
15
|
//#include <Foundation/Foundation.h>
|
|
@@ -17,19 +19,6 @@
|
|
|
17
19
|
//#endif
|
|
18
20
|
//#endif
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
struct AsyncCallback {
|
|
22
|
-
v8::Isolate *isolate;
|
|
23
|
-
v8::Global<v8::Function> callback;
|
|
24
|
-
void *data;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
struct PromiseCallback {
|
|
28
|
-
v8::Isolate *isolate;
|
|
29
|
-
v8::Global<v8::Promise::Resolver> callback;
|
|
30
|
-
void *data;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
22
|
static const char *LOG_TAG = "JS";
|
|
34
23
|
static int m_maxLogcatObjectSize = 4096;
|
|
35
24
|
|
|
@@ -81,89 +70,6 @@ static void LogToConsole(const std::string &message) {
|
|
|
81
70
|
#endif
|
|
82
71
|
}
|
|
83
72
|
|
|
84
|
-
enum class NativeMask {
|
|
85
|
-
Type = 1
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
enum class NativeType {
|
|
89
|
-
None,
|
|
90
|
-
CanvasGradient,
|
|
91
|
-
CanvasPattern,
|
|
92
|
-
ImageData,
|
|
93
|
-
ImageAsset,
|
|
94
|
-
CanvasRenderingContext2D,
|
|
95
|
-
WebGLRenderingContextBase,
|
|
96
|
-
Path2D,
|
|
97
|
-
Matrix,
|
|
98
|
-
ImageBitmap,
|
|
99
|
-
TextMetrics,
|
|
100
|
-
|
|
101
|
-
WebGLQuery,
|
|
102
|
-
WebGLProgram,
|
|
103
|
-
WebGLShader,
|
|
104
|
-
WebGLBuffer,
|
|
105
|
-
WebGLFramebuffer,
|
|
106
|
-
WebGLRenderbuffer,
|
|
107
|
-
WebGLTexture,
|
|
108
|
-
WebGLActiveInfo,
|
|
109
|
-
OES_fbo_render_mipmap,
|
|
110
|
-
EXT_blend_minmax,
|
|
111
|
-
EXT_color_buffer_half_float,
|
|
112
|
-
EXT_disjoint_timer_query,
|
|
113
|
-
EXT_sRGB,
|
|
114
|
-
EXT_shader_texture_lod,
|
|
115
|
-
EXT_texture_filter_anisotropic,
|
|
116
|
-
OES_element_index_uint,
|
|
117
|
-
OES_standard_derivatives,
|
|
118
|
-
OES_texture_float,
|
|
119
|
-
OES_texture_float_linear,
|
|
120
|
-
OES_texture_half_float_linear,
|
|
121
|
-
OES_texture_half_float,
|
|
122
|
-
WEBGL_color_buffer_float,
|
|
123
|
-
OES_vertex_array_object,
|
|
124
|
-
WebGLVertexArrayObject,
|
|
125
|
-
WEBGL_compressed_texture_atc,
|
|
126
|
-
WEBGL_compressed_texture_etc1,
|
|
127
|
-
WEBGL_compressed_texture_s3tc,
|
|
128
|
-
WEBGL_compressed_texture_s3tc_srgb,
|
|
129
|
-
WEBGL_compressed_texture_etc,
|
|
130
|
-
WEBGL_compressed_texture_pvrtc,
|
|
131
|
-
WEBGL_lose_context,
|
|
132
|
-
ANGLE_instanced_arrays,
|
|
133
|
-
WEBGL_depth_texture,
|
|
134
|
-
WEBGL_draw_buffers,
|
|
135
|
-
WebGLShaderPrecisionFormat,
|
|
136
|
-
WebGLUniformLocation,
|
|
137
|
-
WebGLSampler,
|
|
138
|
-
WebGLTransformFeedback,
|
|
139
|
-
WebGLSync,
|
|
140
|
-
|
|
141
|
-
GPUAdapter,
|
|
142
|
-
GPUSupportedLimits,
|
|
143
|
-
GPUDevice,
|
|
144
|
-
GPUQueue,
|
|
145
|
-
GPUBuffer,
|
|
146
|
-
GPUInstance,
|
|
147
|
-
GPUCanvasContext,
|
|
148
|
-
GPUTexture,
|
|
149
|
-
GPUAdapterInfo,
|
|
150
|
-
GPUCommandEncoder,
|
|
151
|
-
GPUComputePass,
|
|
152
|
-
GPUQuerySet,
|
|
153
|
-
GPUShaderModule,
|
|
154
|
-
GPUPipelineLayout,
|
|
155
|
-
GPURenderPipeline,
|
|
156
|
-
GPUBindGroupLayout,
|
|
157
|
-
GPUTextureView,
|
|
158
|
-
GPURenderPassEncoder,
|
|
159
|
-
GPUCommandBuffer,
|
|
160
|
-
GPUBindGroup,
|
|
161
|
-
GPUComputePipeline,
|
|
162
|
-
GPUSampler,
|
|
163
|
-
GPURenderBundleEncoder,
|
|
164
|
-
GPURenderBundle
|
|
165
|
-
};
|
|
166
|
-
|
|
167
73
|
inline static v8::Local<v8::String>
|
|
168
74
|
ConvertToV8OneByteString(v8::Isolate *isolate, std::string string) {
|
|
169
75
|
auto value = new OneByteStringResource(std::move(string));
|
|
@@ -207,74 +113,6 @@ ConvertFromV8String(v8::Isolate *isolate, const v8::Local<v8::Value> &value) {
|
|
|
207
113
|
}
|
|
208
114
|
|
|
209
115
|
|
|
210
|
-
static void SetPrivateValue(v8::Isolate *isolate, const v8::Local<v8::Object> &obj,
|
|
211
|
-
const v8::Local<v8::String> &propName,
|
|
212
|
-
const v8::Local<v8::Value> &value) {
|
|
213
|
-
v8::Local<v8::Context> context;
|
|
214
|
-
auto succcess = obj->GetCreationContext().ToLocal(&context);
|
|
215
|
-
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, propName);
|
|
216
|
-
obj->SetPrivate(context, privateKey, value);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
static v8::Local<v8::Value>
|
|
220
|
-
GetPrivateValue(v8::Isolate *isolate, const v8::Local<v8::Object> &obj,
|
|
221
|
-
const v8::Local<v8::String> &propName) {
|
|
222
|
-
v8::Local<v8::Context> context;
|
|
223
|
-
auto succcess = obj->GetCreationContext().ToLocal(&context);
|
|
224
|
-
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, propName);
|
|
225
|
-
|
|
226
|
-
v8::Maybe<bool> hasPrivate = obj->HasPrivate(context, privateKey);
|
|
227
|
-
|
|
228
|
-
if (!hasPrivate.FromMaybe(false)) {
|
|
229
|
-
return {};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
v8::Local<v8::Value> result;
|
|
233
|
-
|
|
234
|
-
succcess = obj->GetPrivate(context, privateKey).ToLocal(&result);
|
|
235
|
-
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
static void SetNativeType(const v8::Local<v8::Object> &obj, NativeType type) {
|
|
240
|
-
auto value = (int32_t) type;
|
|
241
|
-
obj->SetAlignedPointerInInternalField(1, new int32_t(value));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
inline static NativeType GetNativeType(const v8::Local<v8::Value> &obj) {
|
|
245
|
-
if (!obj.IsEmpty() && !obj->IsNullOrUndefined() && obj->IsObject() &&
|
|
246
|
-
obj.As<v8::Object>()->InternalFieldCount() > 1) {
|
|
247
|
-
auto info = obj.As<v8::Object>()->GetAlignedPointerFromInternalField(1);
|
|
248
|
-
|
|
249
|
-
if (info != nullptr) {
|
|
250
|
-
auto value = *static_cast<int32_t *>(info);
|
|
251
|
-
auto ret = value;
|
|
252
|
-
if (ret >= (int) NativeType::CanvasGradient &&
|
|
253
|
-
ret <= (int) NativeType::GPURenderBundle) {
|
|
254
|
-
return (NativeType) ret;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return NativeType::None;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
//template<class T>
|
|
264
|
-
//static inline void Finalizer(const v8::WeakCallbackInfo<T> &data) {
|
|
265
|
-
// auto *pThis = data.GetParameter();
|
|
266
|
-
// pThis->weakHandle_.Reset();
|
|
267
|
-
// delete pThis;
|
|
268
|
-
//}
|
|
269
|
-
|
|
270
|
-
//static inline void BindFinalizer(v8::Isolate *isolate, v8::Global<v8::Object> &weakHandle, const v8::Local<v8::Object> &object) {
|
|
271
|
-
// v8::HandleScope scopedHandle(isolate);
|
|
272
|
-
// weakHandle.Reset(isolate, object);
|
|
273
|
-
// weakHandle.SetWeak(this, Finalizer, v8::WeakCallbackType::kParameter);
|
|
274
|
-
//}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
116
|
static void SetFastMethod(v8::Isolate *isolate,
|
|
279
117
|
v8::Local<v8::Template> that,
|
|
280
118
|
const char *name,
|