@nativescript/canvas 2.0.0-webgpu.4 → 2.0.0-webgpu.41
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 +5 -10
- package/Canvas/common.js +61 -144
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +6 -5
- package/Canvas/index.android.js +63 -42
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +13 -3
- package/Canvas/index.ios.d.ts +9 -1
- package/Canvas/index.ios.js +117 -66
- 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 +3 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +2 -4
- 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.d.ts +4 -2
- package/ImageAsset/index.js +151 -37
- 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/common.d.ts +1 -1
- package/WebGL/WebGLRenderingContext/index.js +76 -32
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.js +5 -5
- 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 +5 -3
- 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 +75 -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 +65 -14
- 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 +5 -1
- package/WebGPU/GPURenderPassEncoder.js +14 -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 +226 -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/fesm2022/nativescript-canvas-angular.mjs.map +1 -1
- package/common.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- 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 +61 -30
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -176
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +342 -72
- 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 +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/NSCCanvas.nib +0 -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 +681 -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 +122 -60
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -176
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +342 -72
- 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 +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1928 -630
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +85 -23
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/NSCCanvas.nib +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +40 -29
- 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 +683 -646
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +736 -684
- package/platforms/ios/src/NSOperationQueueWrapper.h +1 -1
- package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
- package/platforms/ios/src/cpp/AsyncCallback.h +16 -8
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +310 -801
- package/platforms/ios/src/cpp/CanvasJSIModule.h +2 -0
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +578 -413
- package/platforms/ios/src/cpp/ImageAssetImpl.h +7 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +10 -3
- package/platforms/ios/src/cpp/PromiseCallback.h +1 -2
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +7 -11
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +106 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +26 -23
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +31 -5
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +41 -7
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +4 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +11 -5
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +28 -1
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +75 -79
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +4 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +56 -23
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1606 -681
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +2 -1
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +3 -1
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +1 -2
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +83 -14
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +66 -34
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +151 -52
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +7 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +25 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +4 -1
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +24 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +34 -8
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +2 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +26 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +3 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
- package/utils.d.ts +1 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include "Helpers.h"
|
|
12
12
|
#include "Common.h"
|
|
13
13
|
|
|
14
|
-
ImageAssetImpl::ImageAssetImpl(ImageAsset *asset) : asset_(asset) {
|
|
14
|
+
ImageAssetImpl::ImageAssetImpl(const ImageAsset *asset) : asset_(asset) {
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
ImageAssetImpl::~ImageAssetImpl() {
|
|
@@ -23,11 +23,11 @@ void ImageAssetImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isola
|
|
|
23
23
|
v8::Locker locker(isolate);
|
|
24
24
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
25
25
|
v8::HandleScope handle_scope(isolate);
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
auto ctor = GetCtor(isolate);
|
|
28
28
|
auto context = isolate->GetCurrentContext();
|
|
29
29
|
auto func = ctor->GetFunction(context).ToLocalChecked();
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
canvasModule->Set(context, ConvertToV8String(isolate, "ImageAsset"), func).IsJust();
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -45,93 +45,102 @@ v8::Local<v8::FunctionTemplate> ImageAssetImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
45
45
|
if (ctor != nullptr) {
|
|
46
46
|
return ctor->Get(isolate);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate, Ctor);
|
|
50
50
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
51
51
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "ImageAsset"));
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
54
54
|
tmpl->SetInternalFieldCount(2);
|
|
55
55
|
tmpl->SetAccessor(
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
ConvertToV8String(isolate, "width"),
|
|
57
|
+
GetWidth);
|
|
58
58
|
tmpl->SetAccessor(
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
ConvertToV8String(isolate, "height"),
|
|
60
|
+
GetHeight);
|
|
61
61
|
tmpl->SetAccessor(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
ConvertToV8String(isolate, "error"),
|
|
63
|
+
GetError);
|
|
64
|
+
|
|
65
65
|
tmpl->SetAccessor(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
ConvertToV8String(isolate, "__addr"),
|
|
67
|
+
GetAddr);
|
|
68
|
+
|
|
69
69
|
tmpl->Set(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// tmpl->Set(
|
|
76
|
-
// ConvertToV8String(isolate, "scale"),
|
|
77
|
-
// v8::FunctionTemplate::New(isolate, &Scale));
|
|
78
|
-
|
|
70
|
+
ConvertToV8String(isolate, "__getRef"),
|
|
71
|
+
v8::FunctionTemplate::New(isolate, GetReference));
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// tmpl->Set(
|
|
76
|
+
// ConvertToV8String(isolate, "scale"),
|
|
77
|
+
// v8::FunctionTemplate::New(isolate, &Scale));
|
|
78
|
+
|
|
79
79
|
tmpl->Set(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
ConvertToV8String(isolate, "fromUrlSync"),
|
|
81
|
+
v8::FunctionTemplate::New(isolate, &FromUrlSync));
|
|
82
|
+
|
|
83
83
|
tmpl->Set(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
ConvertToV8String(isolate, "fromUrlCb"),
|
|
85
|
+
v8::FunctionTemplate::New(isolate, &FromUrlCb));
|
|
86
|
+
|
|
87
|
+
|
|
88
88
|
tmpl->Set(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
ConvertToV8String(isolate, "fromFileSync"),
|
|
90
|
+
v8::FunctionTemplate::New(isolate, &FromFileSync));
|
|
91
|
+
|
|
92
92
|
tmpl->Set(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
ConvertToV8String(isolate, "fromFileCb"),
|
|
94
|
+
v8::FunctionTemplate::New(isolate, &FromFileCb));
|
|
95
|
+
|
|
96
|
+
|
|
97
97
|
tmpl->Set(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
ConvertToV8String(isolate, "fromBytesSync"),
|
|
99
|
+
v8::FunctionTemplate::New(isolate, &FromBytesSync));
|
|
100
|
+
|
|
101
101
|
tmpl->Set(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
ConvertToV8String(isolate, "fromBytesCb"),
|
|
103
|
+
v8::FunctionTemplate::New(isolate, &FromBytesCb));
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
tmpl->Set(
|
|
107
|
+
ConvertToV8String(isolate, "fromEncodedBytesSync"),
|
|
108
|
+
v8::FunctionTemplate::New(isolate, &FromEncodedBytesSync));
|
|
109
|
+
|
|
110
|
+
tmpl->Set(
|
|
111
|
+
ConvertToV8String(isolate, "fromEncodedBytesCb"),
|
|
112
|
+
v8::FunctionTemplate::New(isolate, &FromEncodedBytesCb));
|
|
113
|
+
|
|
114
|
+
|
|
106
115
|
/* tmpl->Set(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
ConvertToV8String(isolate, "saveSync"),
|
|
117
|
+
v8::FunctionTemplate::New(isolate, &SaveSync));
|
|
118
|
+
|
|
119
|
+
tmpl->Set(
|
|
120
|
+
ConvertToV8String(isolate, "saveCb"),
|
|
121
|
+
v8::FunctionTemplate::New(isolate, &SaveCb));
|
|
122
|
+
*/
|
|
123
|
+
|
|
115
124
|
cache->ImageAssetTmpl =
|
|
116
|
-
|
|
125
|
+
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
117
126
|
return ctorTmpl;
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
void ImageAssetImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
121
130
|
auto isolate = args.GetIsolate();
|
|
122
|
-
|
|
131
|
+
|
|
123
132
|
auto ret = args.This();
|
|
124
|
-
|
|
133
|
+
|
|
125
134
|
auto image_asset = canvas_native_image_asset_create();
|
|
126
|
-
|
|
135
|
+
|
|
127
136
|
auto object = new ImageAssetImpl(image_asset);
|
|
128
|
-
|
|
137
|
+
|
|
129
138
|
SetNativeType(object, NativeType::ImageAsset);
|
|
130
|
-
|
|
139
|
+
|
|
131
140
|
ret->SetAlignedPointerInInternalField(0, object);
|
|
132
|
-
|
|
141
|
+
|
|
133
142
|
object->BindFinalizer(isolate, ret);
|
|
134
|
-
|
|
143
|
+
|
|
135
144
|
args.GetReturnValue().Set(ret);
|
|
136
145
|
}
|
|
137
146
|
|
|
@@ -184,7 +193,7 @@ ImageAssetImpl::GetReference(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
184
193
|
args.GetReturnValue().Set(ConvertToV8String(isolate, ret));
|
|
185
194
|
return;
|
|
186
195
|
}
|
|
187
|
-
|
|
196
|
+
|
|
188
197
|
args.GetReturnValue().SetEmptyString();
|
|
189
198
|
}
|
|
190
199
|
|
|
@@ -210,9 +219,9 @@ void ImageAssetImpl::FromUrlSync(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
210
219
|
}
|
|
211
220
|
auto isolate = args.GetIsolate();
|
|
212
221
|
auto url = ConvertFromV8String(isolate, args[0]);
|
|
213
|
-
|
|
222
|
+
|
|
214
223
|
auto done = canvas_native_image_asset_load_from_url(ptr->GetImageAsset(), url.c_str());
|
|
215
|
-
|
|
224
|
+
|
|
216
225
|
args.GetReturnValue().Set(done);
|
|
217
226
|
}
|
|
218
227
|
|
|
@@ -221,92 +230,90 @@ void ImageAssetImpl::FromUrlCb(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
221
230
|
if (ptr == nullptr) {
|
|
222
231
|
return;
|
|
223
232
|
}
|
|
224
|
-
|
|
233
|
+
|
|
225
234
|
auto isolate = args.GetIsolate();
|
|
226
|
-
|
|
235
|
+
|
|
227
236
|
if (args.Length() < 2) {
|
|
228
237
|
return;
|
|
229
238
|
}
|
|
230
|
-
|
|
239
|
+
|
|
231
240
|
auto url = ConvertFromV8String(isolate, args[0]);
|
|
232
|
-
|
|
241
|
+
|
|
233
242
|
auto asset = canvas_native_image_asset_reference(ptr->asset_);
|
|
234
|
-
|
|
243
|
+
|
|
235
244
|
auto callback = args[1].As<v8::Function>();
|
|
236
|
-
|
|
245
|
+
|
|
237
246
|
auto jsi_callback = new JSICallback(isolate, callback);
|
|
238
|
-
|
|
247
|
+
|
|
239
248
|
#ifdef __ANDROID__
|
|
240
|
-
|
|
249
|
+
|
|
241
250
|
ALooper_addFd(jsi_callback->looper_,
|
|
242
251
|
jsi_callback->fd_[0],
|
|
243
|
-
|
|
252
|
+
0,
|
|
244
253
|
ALOOPER_EVENT_INPUT,
|
|
245
254
|
[](int fd, int events,
|
|
246
255
|
void *data) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
256
|
+
auto cb = static_cast<JSICallback *>(data);
|
|
257
|
+
bool done;
|
|
258
|
+
read(fd, &done,
|
|
259
|
+
sizeof(bool));
|
|
260
|
+
|
|
261
|
+
v8::Isolate *isolate = cb->isolate_;
|
|
262
|
+
v8::Locker locker(isolate);
|
|
263
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
264
|
+
v8::HandleScope handle_scope(isolate);
|
|
265
|
+
v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
|
|
266
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
267
|
+
v8::Context::Scope context_scope(context);
|
|
268
|
+
|
|
269
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
270
|
+
|
|
271
|
+
// v8::TryCatch tc(isolate);
|
|
272
|
+
|
|
273
|
+
callback->Call(context, context->Global(), 1,
|
|
274
|
+
args); // ignore JS return value
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
delete static_cast<JSICallback *>(data);
|
|
278
|
+
return 0;
|
|
279
|
+
}, jsi_callback);
|
|
280
|
+
|
|
281
|
+
|
|
275
282
|
std::thread thread(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
[jsi_callback, asset](
|
|
284
|
+
const std::string &url) {
|
|
285
|
+
auto done = canvas_native_image_asset_load_from_url(asset, url.c_str());
|
|
286
|
+
|
|
287
|
+
canvas_native_image_asset_release(asset);
|
|
288
|
+
|
|
289
|
+
write(jsi_callback->fd_[1],
|
|
290
|
+
&done,
|
|
291
|
+
sizeof(bool));
|
|
292
|
+
|
|
293
|
+
}, std::move(url));
|
|
294
|
+
|
|
288
295
|
thread.detach();
|
|
289
|
-
|
|
296
|
+
|
|
290
297
|
#endif
|
|
291
|
-
|
|
292
|
-
|
|
298
|
+
|
|
299
|
+
|
|
293
300
|
#ifdef __APPLE__
|
|
294
|
-
|
|
301
|
+
|
|
295
302
|
auto current_queue = new NSOperationQueueWrapper(true);
|
|
296
|
-
|
|
303
|
+
|
|
297
304
|
auto queue = new NSOperationQueueWrapper(false);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
301
308
|
/* std::thread task([jsi_callback, current_queue, asset](std::string url) {
|
|
302
|
-
|
|
303
|
-
|
|
309
|
+
|
|
310
|
+
|
|
304
311
|
auto done = canvas_native_image_asset_load_from_url(asset, url.c_str());
|
|
305
|
-
|
|
306
|
-
|
|
312
|
+
|
|
313
|
+
|
|
307
314
|
auto main_task = [jsi_callback, current_queue, url, done]() {
|
|
308
|
-
|
|
309
|
-
|
|
315
|
+
|
|
316
|
+
|
|
310
317
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
311
318
|
v8::Locker locker(isolate);
|
|
312
319
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -314,43 +321,43 @@ void ImageAssetImpl::FromUrlCb(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
314
321
|
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
315
322
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
316
323
|
v8::Context::Scope context_scope(context);
|
|
317
|
-
|
|
324
|
+
|
|
318
325
|
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
319
|
-
|
|
326
|
+
|
|
320
327
|
// v8::TryCatch tc(isolate);
|
|
321
|
-
|
|
328
|
+
|
|
322
329
|
callback->Call(context, context->Global(), 1,
|
|
323
330
|
args); // ignore JS return value
|
|
324
|
-
|
|
325
|
-
|
|
331
|
+
|
|
332
|
+
|
|
326
333
|
delete jsi_callback;
|
|
327
334
|
// delete queue;
|
|
328
335
|
delete current_queue;
|
|
329
|
-
|
|
330
|
-
|
|
336
|
+
|
|
337
|
+
|
|
331
338
|
};
|
|
332
|
-
|
|
339
|
+
|
|
333
340
|
current_queue->addOperation(main_task);
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
|
|
342
|
+
|
|
336
343
|
}, std::move(url));
|
|
337
|
-
|
|
344
|
+
|
|
338
345
|
task.detach();
|
|
339
|
-
|
|
346
|
+
|
|
340
347
|
*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
346
353
|
auto task = [jsi_callback, current_queue, queue, asset, url]() {
|
|
347
|
-
|
|
354
|
+
|
|
348
355
|
auto done = canvas_native_image_asset_load_from_url(asset, url.c_str());
|
|
349
356
|
canvas_native_image_asset_release(asset);
|
|
350
|
-
|
|
357
|
+
|
|
351
358
|
auto main_task = [jsi_callback, current_queue, queue, url, done]() {
|
|
352
|
-
|
|
353
|
-
|
|
359
|
+
|
|
360
|
+
|
|
354
361
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
355
362
|
v8::Locker locker(isolate);
|
|
356
363
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -358,31 +365,31 @@ void ImageAssetImpl::FromUrlCb(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
358
365
|
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
359
366
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
360
367
|
v8::Context::Scope context_scope(context);
|
|
361
|
-
|
|
368
|
+
|
|
362
369
|
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
363
|
-
|
|
370
|
+
|
|
364
371
|
// v8::TryCatch tc(isolate);
|
|
365
|
-
|
|
372
|
+
|
|
366
373
|
callback->Call(context, context->Global(), 1,
|
|
367
374
|
args); // ignore JS return value
|
|
368
|
-
|
|
369
|
-
|
|
375
|
+
|
|
376
|
+
|
|
370
377
|
delete jsi_callback;
|
|
371
378
|
delete queue;
|
|
372
379
|
delete current_queue;
|
|
373
|
-
|
|
374
|
-
|
|
380
|
+
|
|
381
|
+
|
|
375
382
|
};
|
|
376
|
-
|
|
383
|
+
|
|
377
384
|
current_queue->addOperation(main_task);
|
|
378
|
-
|
|
385
|
+
|
|
379
386
|
};
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
383
390
|
queue->addOperation(task);
|
|
384
391
|
#endif
|
|
385
|
-
|
|
392
|
+
|
|
386
393
|
}
|
|
387
394
|
|
|
388
395
|
void ImageAssetImpl::FromFileSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
@@ -393,9 +400,9 @@ void ImageAssetImpl::FromFileSync(const v8::FunctionCallbackInfo<v8::Value> &arg
|
|
|
393
400
|
}
|
|
394
401
|
auto isolate = args.GetIsolate();
|
|
395
402
|
auto path = ConvertFromV8String(isolate, args[0]);
|
|
396
|
-
|
|
403
|
+
|
|
397
404
|
auto done = canvas_native_image_asset_load_from_path(ptr->GetImageAsset(), path.c_str());
|
|
398
|
-
|
|
405
|
+
|
|
399
406
|
args.GetReturnValue().Set(done);
|
|
400
407
|
}
|
|
401
408
|
|
|
@@ -405,87 +412,85 @@ void ImageAssetImpl::FromFileCb(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
405
412
|
return;
|
|
406
413
|
}
|
|
407
414
|
auto isolate = args.GetIsolate();
|
|
408
|
-
|
|
415
|
+
|
|
409
416
|
if (args.Length() < 2) {
|
|
410
417
|
return;
|
|
411
418
|
}
|
|
412
|
-
|
|
419
|
+
|
|
413
420
|
auto path = ConvertFromV8String(isolate, args[0]);
|
|
414
|
-
|
|
415
|
-
auto asset = canvas_native_image_asset_reference(
|
|
416
|
-
|
|
417
|
-
|
|
421
|
+
|
|
422
|
+
auto asset = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
423
|
+
|
|
418
424
|
auto callback = args[1].As<v8::Function>();
|
|
419
|
-
|
|
420
|
-
|
|
425
|
+
|
|
421
426
|
auto jsi_callback = new JSICallback(isolate, callback);
|
|
422
|
-
|
|
427
|
+
|
|
423
428
|
#ifdef __ANDROID__
|
|
424
|
-
|
|
429
|
+
|
|
425
430
|
ALooper_addFd(jsi_callback->looper_,
|
|
426
431
|
jsi_callback->fd_[0],
|
|
427
|
-
|
|
432
|
+
0,
|
|
428
433
|
ALOOPER_EVENT_INPUT,
|
|
429
434
|
[](int fd, int events,
|
|
430
435
|
void *data) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
436
|
+
auto cb = static_cast<JSICallback *>(data);
|
|
437
|
+
bool done;
|
|
438
|
+
read(fd, &done,
|
|
439
|
+
sizeof(bool));
|
|
440
|
+
|
|
441
|
+
v8::Isolate *isolate = cb->isolate_;
|
|
442
|
+
v8::Locker locker(isolate);
|
|
443
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
444
|
+
v8::HandleScope handle_scope(isolate);
|
|
445
|
+
v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
|
|
446
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
447
|
+
v8::Context::Scope context_scope(context);
|
|
448
|
+
|
|
449
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
450
|
+
|
|
451
|
+
v8::TryCatch tc(isolate);
|
|
452
|
+
|
|
453
|
+
callback->Call(context, context->Global(), 1,
|
|
454
|
+
args); // ignore JS return value
|
|
455
|
+
|
|
456
|
+
delete static_cast<JSICallback *>(data);
|
|
457
|
+
return 0;
|
|
458
|
+
}, jsi_callback);
|
|
459
|
+
|
|
460
|
+
|
|
458
461
|
std::thread thread(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
462
|
+
[jsi_callback, asset](
|
|
463
|
+
const std::string path) {
|
|
464
|
+
|
|
465
|
+
auto done = canvas_native_image_asset_load_from_path(asset, path.c_str());
|
|
466
|
+
|
|
467
|
+
write(jsi_callback->fd_[1],
|
|
468
|
+
&done,
|
|
469
|
+
sizeof(bool));
|
|
470
|
+
|
|
471
|
+
canvas_native_image_asset_release(asset);
|
|
472
|
+
|
|
473
|
+
}, std::move(path));
|
|
474
|
+
|
|
475
|
+
thread.detach();
|
|
476
|
+
|
|
472
477
|
#endif
|
|
473
|
-
|
|
474
|
-
|
|
478
|
+
|
|
479
|
+
|
|
475
480
|
#ifdef __APPLE__
|
|
476
|
-
|
|
481
|
+
|
|
477
482
|
auto current_queue = new NSOperationQueueWrapper(true);
|
|
478
|
-
|
|
483
|
+
|
|
479
484
|
auto queue = new NSOperationQueueWrapper(false);
|
|
480
|
-
|
|
485
|
+
|
|
481
486
|
auto task = [jsi_callback, current_queue, queue, asset, path]() {
|
|
482
|
-
|
|
487
|
+
|
|
483
488
|
auto done = canvas_native_image_asset_load_from_path(asset, path.c_str());
|
|
484
|
-
|
|
489
|
+
|
|
485
490
|
canvas_native_image_asset_release(asset);
|
|
486
|
-
|
|
491
|
+
|
|
487
492
|
auto main_task = [jsi_callback, current_queue, queue, done]() {
|
|
488
|
-
|
|
493
|
+
|
|
489
494
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
490
495
|
v8::Locker locker(isolate);
|
|
491
496
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -493,27 +498,27 @@ void ImageAssetImpl::FromFileCb(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
493
498
|
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
494
499
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
495
500
|
v8::Context::Scope context_scope(context);
|
|
496
|
-
|
|
501
|
+
|
|
497
502
|
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
498
|
-
|
|
503
|
+
|
|
499
504
|
// v8::TryCatch tc(isolate);
|
|
500
|
-
|
|
505
|
+
|
|
501
506
|
callback->Call(context, context->Global(), 1,
|
|
502
507
|
args); // ignore JS return value
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
delete jsi_callback;
|
|
508
|
+
|
|
506
509
|
delete queue;
|
|
507
510
|
delete current_queue;
|
|
508
|
-
|
|
509
|
-
|
|
511
|
+
delete jsi_callback;
|
|
512
|
+
|
|
510
513
|
};
|
|
511
|
-
|
|
514
|
+
|
|
512
515
|
current_queue->addOperation(main_task);
|
|
513
|
-
|
|
516
|
+
|
|
514
517
|
};
|
|
515
|
-
|
|
518
|
+
|
|
516
519
|
queue->addOperation(task);
|
|
520
|
+
|
|
521
|
+
|
|
517
522
|
#endif
|
|
518
523
|
}
|
|
519
524
|
|
|
@@ -523,24 +528,32 @@ void ImageAssetImpl::FromBytesSync(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
523
528
|
args.GetReturnValue().Set(false);
|
|
524
529
|
return;
|
|
525
530
|
}
|
|
526
|
-
|
|
527
|
-
auto value = args[
|
|
528
|
-
|
|
531
|
+
auto context = args.GetIsolate()->GetCurrentContext();
|
|
532
|
+
auto value = args[2];
|
|
533
|
+
|
|
529
534
|
if (value->IsObject()) {
|
|
530
535
|
if (!value->IsArrayBuffer()) {
|
|
531
536
|
args.GetReturnValue().Set(false);
|
|
532
537
|
return;
|
|
533
538
|
}
|
|
534
539
|
auto buf = value.As<v8::ArrayBuffer>();
|
|
535
|
-
|
|
540
|
+
|
|
536
541
|
auto size = (uintptr_t) buf->ByteLength();
|
|
537
542
|
auto data = (uint8_t *) buf->GetBackingStore()->Data();
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
543
|
+
|
|
544
|
+
uint32_t width;
|
|
545
|
+
uint32_t height;
|
|
546
|
+
bool done = false;
|
|
547
|
+
if(args[0]->Uint32Value(context).To(&width)
|
|
548
|
+
&& args[1]->Uint32Value(context).To(&height)
|
|
549
|
+
) {
|
|
550
|
+
done = canvas_native_image_asset_load_from_raw(ptr->GetImageAsset(), width, height, data, size);
|
|
551
|
+
}
|
|
552
|
+
|
|
541
553
|
args.GetReturnValue().Set(done);
|
|
554
|
+
return;
|
|
542
555
|
}
|
|
543
|
-
|
|
556
|
+
|
|
544
557
|
args.GetReturnValue().Set(false);
|
|
545
558
|
}
|
|
546
559
|
|
|
@@ -550,92 +563,96 @@ void ImageAssetImpl::FromBytesCb(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
550
563
|
return;
|
|
551
564
|
}
|
|
552
565
|
auto isolate = args.GetIsolate();
|
|
553
|
-
|
|
566
|
+
|
|
554
567
|
if (args.Length() < 2) {
|
|
555
568
|
return;
|
|
556
569
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
auto bytes = args[
|
|
560
|
-
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
auto bytes = args[2].As<v8::ArrayBuffer>();
|
|
573
|
+
|
|
561
574
|
auto size = bytes->ByteLength();
|
|
562
|
-
|
|
575
|
+
|
|
563
576
|
auto data = (uint8_t *) bytes->GetBackingStore()->Data();
|
|
564
|
-
|
|
577
|
+
|
|
565
578
|
auto asset = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
566
|
-
|
|
567
|
-
auto
|
|
568
|
-
|
|
579
|
+
|
|
580
|
+
auto context = args.GetIsolate()->GetCurrentContext();
|
|
581
|
+
|
|
582
|
+
uint32_t width;
|
|
583
|
+
uint32_t height;
|
|
584
|
+
args[0]->Uint32Value(context).To(&width);
|
|
585
|
+
args[1]->Uint32Value(context).To(&height);
|
|
586
|
+
|
|
587
|
+
auto callback = args[3].As<v8::Function>();
|
|
588
|
+
|
|
569
589
|
auto jsi_callback = new JSICallback(isolate, callback);
|
|
570
|
-
|
|
590
|
+
|
|
571
591
|
#ifdef __ANDROID__
|
|
572
|
-
|
|
592
|
+
|
|
573
593
|
ALooper_addFd(jsi_callback->looper_,
|
|
574
594
|
jsi_callback->fd_[0],
|
|
575
|
-
|
|
595
|
+
0,
|
|
576
596
|
ALOOPER_EVENT_INPUT,
|
|
577
597
|
[](int fd, int events,
|
|
578
598
|
void *data) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
ALooper_wake(jsi_callback->looper_);
|
|
604
|
-
|
|
605
|
-
|
|
599
|
+
auto cb = static_cast<JSICallback *>(data);
|
|
600
|
+
bool done;
|
|
601
|
+
read(fd, &done,
|
|
602
|
+
sizeof(bool));
|
|
603
|
+
|
|
604
|
+
v8::Isolate *isolate = cb->isolate_;
|
|
605
|
+
v8::Locker locker(isolate);
|
|
606
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
607
|
+
v8::HandleScope handle_scope(isolate);
|
|
608
|
+
v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
|
|
609
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
610
|
+
v8::Context::Scope context_scope(context);
|
|
611
|
+
|
|
612
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
613
|
+
|
|
614
|
+
// v8::TryCatch tc(isolate);
|
|
615
|
+
|
|
616
|
+
callback->Call(context, context->Global(), 1,
|
|
617
|
+
args); // ignore JS return value
|
|
618
|
+
|
|
619
|
+
delete static_cast<JSICallback *>(data);
|
|
620
|
+
return 0;
|
|
621
|
+
}, jsi_callback);
|
|
622
|
+
|
|
606
623
|
std::thread thread(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
624
|
+
[jsi_callback, asset, width, height, data, size]() {
|
|
625
|
+
|
|
626
|
+
auto done = canvas_native_image_asset_load_from_raw(asset, width, height, data, size);
|
|
627
|
+
|
|
628
|
+
canvas_native_image_asset_release(asset);
|
|
629
|
+
|
|
630
|
+
write(jsi_callback->fd_[1],
|
|
631
|
+
&done,
|
|
632
|
+
sizeof(bool));
|
|
633
|
+
|
|
634
|
+
});
|
|
635
|
+
|
|
619
636
|
thread.detach();
|
|
620
|
-
|
|
637
|
+
|
|
621
638
|
#endif
|
|
622
|
-
|
|
623
|
-
|
|
639
|
+
|
|
640
|
+
|
|
624
641
|
#ifdef __APPLE__
|
|
625
|
-
|
|
642
|
+
|
|
626
643
|
auto current_queue = new NSOperationQueueWrapper(true);
|
|
627
|
-
|
|
644
|
+
|
|
628
645
|
auto queue = new NSOperationQueueWrapper(false);
|
|
629
|
-
|
|
630
|
-
auto task = [jsi_callback, current_queue, queue, asset, data, size]() {
|
|
631
|
-
|
|
632
|
-
auto done = canvas_native_image_asset_load_from_raw(asset, data, size);
|
|
633
|
-
|
|
646
|
+
|
|
647
|
+
auto task = [jsi_callback, current_queue, queue, asset, width, height,data, size]() {
|
|
648
|
+
|
|
649
|
+
auto done = canvas_native_image_asset_load_from_raw(asset, width, height, data, size);
|
|
650
|
+
|
|
634
651
|
canvas_native_image_asset_release(asset);
|
|
635
|
-
|
|
652
|
+
|
|
636
653
|
auto main_task = [jsi_callback, current_queue, queue, done]() {
|
|
637
|
-
|
|
638
|
-
|
|
654
|
+
|
|
655
|
+
|
|
639
656
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
640
657
|
v8::Locker locker(isolate);
|
|
641
658
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -643,144 +660,150 @@ void ImageAssetImpl::FromBytesCb(const v8::FunctionCallbackInfo<v8::Value> &args
|
|
|
643
660
|
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
644
661
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
645
662
|
v8::Context::Scope context_scope(context);
|
|
646
|
-
|
|
663
|
+
|
|
647
664
|
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
648
|
-
|
|
665
|
+
|
|
649
666
|
// v8::TryCatch tc(isolate);
|
|
650
|
-
|
|
667
|
+
|
|
651
668
|
callback->Call(context, context->Global(), 1,
|
|
652
669
|
args); // ignore JS return value
|
|
653
|
-
|
|
654
|
-
|
|
670
|
+
|
|
671
|
+
|
|
655
672
|
delete jsi_callback;
|
|
656
673
|
delete queue;
|
|
657
674
|
delete current_queue;
|
|
658
|
-
|
|
659
|
-
|
|
675
|
+
|
|
676
|
+
|
|
660
677
|
};
|
|
661
|
-
|
|
678
|
+
|
|
662
679
|
current_queue->addOperation(main_task);
|
|
663
|
-
|
|
680
|
+
|
|
664
681
|
};
|
|
665
|
-
|
|
682
|
+
|
|
666
683
|
queue->addOperation(task);
|
|
667
684
|
#endif
|
|
668
|
-
|
|
685
|
+
|
|
669
686
|
}
|
|
670
687
|
|
|
671
|
-
|
|
672
|
-
void ImageAssetImpl::
|
|
688
|
+
|
|
689
|
+
void ImageAssetImpl::FromEncodedBytesSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
673
690
|
ImageAssetImpl *ptr = GetPointer(args.This());
|
|
674
691
|
if (ptr == nullptr) {
|
|
675
692
|
args.GetReturnValue().Set(false);
|
|
676
693
|
return;
|
|
677
694
|
}
|
|
678
|
-
|
|
679
|
-
auto
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
695
|
+
|
|
696
|
+
auto value = args[0];
|
|
697
|
+
|
|
698
|
+
if (value->IsObject()) {
|
|
699
|
+
if (!value->IsArrayBuffer()) {
|
|
700
|
+
args.GetReturnValue().Set(false);
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
auto buf = value.As<v8::ArrayBuffer>();
|
|
704
|
+
|
|
705
|
+
auto size = (uintptr_t) buf->ByteLength();
|
|
706
|
+
auto data = (uint8_t *) buf->GetBackingStore()->Data();
|
|
707
|
+
|
|
708
|
+
auto done = canvas_native_image_asset_load_from_raw_encoded(ptr->GetImageAsset(), data,
|
|
709
|
+
size);
|
|
710
|
+
|
|
711
|
+
args.GetReturnValue().Set(done);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
args.GetReturnValue().Set(false);
|
|
686
716
|
}
|
|
687
717
|
|
|
688
|
-
void ImageAssetImpl::
|
|
718
|
+
void ImageAssetImpl::FromEncodedBytesCb(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
689
719
|
ImageAssetImpl *ptr = GetPointer(args.This());
|
|
690
720
|
if (ptr == nullptr) {
|
|
691
721
|
return;
|
|
692
722
|
}
|
|
693
723
|
auto isolate = args.GetIsolate();
|
|
694
|
-
|
|
724
|
+
|
|
695
725
|
if (args.Length() < 2) {
|
|
696
726
|
return;
|
|
697
727
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
auto
|
|
701
|
-
|
|
702
|
-
auto
|
|
703
|
-
|
|
704
|
-
auto
|
|
705
|
-
|
|
706
|
-
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
auto bytes = args[0].As<v8::ArrayBuffer>();
|
|
731
|
+
|
|
732
|
+
auto size = bytes->ByteLength();
|
|
733
|
+
|
|
734
|
+
auto data = (uint8_t *) bytes->GetBackingStore()->Data();
|
|
735
|
+
|
|
736
|
+
auto asset = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
737
|
+
|
|
707
738
|
auto callback = args[1].As<v8::Function>();
|
|
708
|
-
|
|
739
|
+
|
|
709
740
|
auto jsi_callback = new JSICallback(isolate, callback);
|
|
710
|
-
|
|
711
|
-
|
|
741
|
+
|
|
712
742
|
#ifdef __ANDROID__
|
|
713
|
-
|
|
743
|
+
|
|
714
744
|
ALooper_addFd(jsi_callback->looper_,
|
|
715
745
|
jsi_callback->fd_[0],
|
|
716
|
-
|
|
746
|
+
0,
|
|
717
747
|
ALOOPER_EVENT_INPUT,
|
|
718
748
|
[](int fd, int events,
|
|
719
749
|
void *data) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
ALooper_wake(jsi_callback->looper_);
|
|
745
|
-
|
|
746
|
-
|
|
750
|
+
auto cb = static_cast<JSICallback *>(data);
|
|
751
|
+
bool done;
|
|
752
|
+
read(fd, &done,
|
|
753
|
+
sizeof(bool));
|
|
754
|
+
|
|
755
|
+
v8::Isolate *isolate = cb->isolate_;
|
|
756
|
+
v8::Locker locker(isolate);
|
|
757
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
758
|
+
v8::HandleScope handle_scope(isolate);
|
|
759
|
+
v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
|
|
760
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
761
|
+
v8::Context::Scope context_scope(context);
|
|
762
|
+
|
|
763
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
764
|
+
|
|
765
|
+
// v8::TryCatch tc(isolate);
|
|
766
|
+
|
|
767
|
+
callback->Call(context, context->Global(), 1,
|
|
768
|
+
args); // ignore JS return value
|
|
769
|
+
|
|
770
|
+
delete static_cast<JSICallback *>(data);
|
|
771
|
+
return 0;
|
|
772
|
+
}, jsi_callback);
|
|
773
|
+
|
|
747
774
|
std::thread thread(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}, std::move(path));
|
|
762
|
-
|
|
763
|
-
|
|
775
|
+
[jsi_callback, asset, data, size]() {
|
|
776
|
+
|
|
777
|
+
auto done = canvas_native_image_asset_load_from_raw_encoded(asset, data, size);
|
|
778
|
+
|
|
779
|
+
canvas_native_image_asset_release(asset);
|
|
780
|
+
|
|
781
|
+
write(jsi_callback->fd_[1],
|
|
782
|
+
&done,
|
|
783
|
+
sizeof(bool));
|
|
784
|
+
|
|
785
|
+
});
|
|
786
|
+
|
|
764
787
|
thread.detach();
|
|
765
|
-
|
|
788
|
+
|
|
766
789
|
#endif
|
|
767
|
-
|
|
768
|
-
|
|
790
|
+
|
|
791
|
+
|
|
769
792
|
#ifdef __APPLE__
|
|
770
|
-
|
|
793
|
+
|
|
771
794
|
auto current_queue = new NSOperationQueueWrapper(true);
|
|
772
|
-
|
|
795
|
+
|
|
773
796
|
auto queue = new NSOperationQueueWrapper(false);
|
|
774
|
-
|
|
775
|
-
auto task = [jsi_callback, current_queue, queue, asset,
|
|
776
|
-
|
|
777
|
-
auto done =
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
797
|
+
|
|
798
|
+
auto task = [jsi_callback, current_queue, queue, asset, data, size]() {
|
|
799
|
+
|
|
800
|
+
auto done = canvas_native_image_asset_load_from_raw_encoded(asset, data, size);
|
|
801
|
+
|
|
802
|
+
canvas_native_image_asset_release(asset);
|
|
803
|
+
|
|
781
804
|
auto main_task = [jsi_callback, current_queue, queue, done]() {
|
|
782
|
-
|
|
783
|
-
|
|
805
|
+
|
|
806
|
+
|
|
784
807
|
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
785
808
|
v8::Locker locker(isolate);
|
|
786
809
|
v8::Isolate::Scope isolate_scope(isolate);
|
|
@@ -788,32 +811,174 @@ void ImageAssetImpl::SaveCb(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
788
811
|
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
789
812
|
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
790
813
|
v8::Context::Scope context_scope(context);
|
|
791
|
-
|
|
814
|
+
|
|
792
815
|
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
793
|
-
|
|
816
|
+
|
|
794
817
|
// v8::TryCatch tc(isolate);
|
|
795
|
-
|
|
818
|
+
|
|
796
819
|
callback->Call(context, context->Global(), 1,
|
|
797
820
|
args); // ignore JS return value
|
|
798
|
-
|
|
799
|
-
|
|
821
|
+
|
|
822
|
+
|
|
800
823
|
delete jsi_callback;
|
|
801
824
|
delete queue;
|
|
802
825
|
delete current_queue;
|
|
803
|
-
|
|
804
|
-
|
|
826
|
+
|
|
827
|
+
|
|
805
828
|
};
|
|
829
|
+
|
|
806
830
|
current_queue->addOperation(main_task);
|
|
831
|
+
|
|
807
832
|
};
|
|
808
|
-
|
|
833
|
+
|
|
809
834
|
queue->addOperation(task);
|
|
810
835
|
#endif
|
|
811
|
-
|
|
812
|
-
|
|
836
|
+
|
|
813
837
|
}
|
|
814
|
-
*/
|
|
815
838
|
|
|
816
|
-
|
|
839
|
+
/*
|
|
840
|
+
void ImageAssetImpl::SaveSync(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
841
|
+
ImageAssetImpl *ptr = GetPointer(args.This());
|
|
842
|
+
if (ptr == nullptr) {
|
|
843
|
+
args.GetReturnValue().Set(false);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
auto isolate = args.GetIsolate();
|
|
848
|
+
auto context = isolate->GetCurrentContext();
|
|
849
|
+
auto path = ConvertFromV8String(isolate, args[0]);
|
|
850
|
+
auto format = args[1]->Uint32Value(context).ToChecked();
|
|
851
|
+
auto done = canvas_native_image_asset_save_path(ptr->GetImageAsset(), path.c_str(), format);
|
|
852
|
+
|
|
853
|
+
args.GetReturnValue().Set(done);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
void ImageAssetImpl::SaveCb(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
857
|
+
ImageAssetImpl *ptr = GetPointer(args.This());
|
|
858
|
+
if (ptr == nullptr) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
auto isolate = args.GetIsolate();
|
|
862
|
+
auto context = isolate->GetCurrentContext();
|
|
863
|
+
if (args.Length() < 2) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
auto path = ConvertFromV8String(isolate, args[0]);
|
|
869
|
+
|
|
870
|
+
auto format = args[1]->Uint32Value(context).ToChecked();
|
|
871
|
+
|
|
872
|
+
auto asset = canvas_native_image_asset_shared_clone(
|
|
873
|
+
ptr->GetImageAsset());
|
|
874
|
+
|
|
875
|
+
auto callback = args[1].As<v8::Function>();
|
|
876
|
+
|
|
877
|
+
auto jsi_callback = new JSICallback(isolate, callback);
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
#ifdef __ANDROID__
|
|
881
|
+
|
|
882
|
+
ALooper_addFd(jsi_callback->looper_,
|
|
883
|
+
jsi_callback->fd_[0],
|
|
884
|
+
0,
|
|
885
|
+
ALOOPER_EVENT_INPUT,
|
|
886
|
+
[](int fd, int events,
|
|
887
|
+
void *data) {
|
|
888
|
+
auto cb = static_cast<JSICallback *>(data);
|
|
889
|
+
bool done;
|
|
890
|
+
read(fd, &done,
|
|
891
|
+
sizeof(bool));
|
|
892
|
+
|
|
893
|
+
v8::Isolate *isolate = cb->isolate_;
|
|
894
|
+
v8::Locker locker(isolate);
|
|
895
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
896
|
+
v8::HandleScope handle_scope(isolate);
|
|
897
|
+
v8::Local<v8::Function> callback = cb->callback_->Get(isolate);
|
|
898
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
899
|
+
v8::Context::Scope context_scope(context);
|
|
900
|
+
|
|
901
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
902
|
+
|
|
903
|
+
// v8::TryCatch tc(isolate);
|
|
904
|
+
|
|
905
|
+
callback->Call(context, context->Global(), 1,
|
|
906
|
+
args); // ignore JS return value
|
|
907
|
+
|
|
908
|
+
delete static_cast<JSICallback *>(data);
|
|
909
|
+
return 0;
|
|
910
|
+
}, jsi_callback);
|
|
911
|
+
|
|
912
|
+
std::thread thread(
|
|
913
|
+
[jsi_callback, asset, format](
|
|
914
|
+
const std::string &path) {
|
|
915
|
+
|
|
916
|
+
auto done = canvas_native_image_asset_save_path(asset,
|
|
917
|
+
path.c_str(),
|
|
918
|
+
format);
|
|
919
|
+
|
|
920
|
+
canvas_native_image_asset_destroy(asset);
|
|
921
|
+
|
|
922
|
+
write(jsi_callback->fd_[1],
|
|
923
|
+
&done,
|
|
924
|
+
sizeof(bool));
|
|
925
|
+
|
|
926
|
+
}, std::move(path));
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
thread.detach();
|
|
930
|
+
|
|
931
|
+
#endif
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
#ifdef __APPLE__
|
|
935
|
+
|
|
936
|
+
auto current_queue = new NSOperationQueueWrapper(true);
|
|
937
|
+
|
|
938
|
+
auto queue = new NSOperationQueueWrapper(false);
|
|
939
|
+
|
|
940
|
+
auto task = [jsi_callback, current_queue, queue, asset, path, format]() {
|
|
941
|
+
|
|
942
|
+
auto done = canvas_native_image_asset_save_path(asset, path.c_str(), format);
|
|
943
|
+
|
|
944
|
+
canvas_native_image_asset_destroy(asset);
|
|
945
|
+
|
|
946
|
+
auto main_task = [jsi_callback, current_queue, queue, done]() {
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
v8::Isolate *isolate = jsi_callback->isolate_;
|
|
950
|
+
v8::Locker locker(isolate);
|
|
951
|
+
v8::Isolate::Scope isolate_scope(isolate);
|
|
952
|
+
v8::HandleScope handle_scope(isolate);
|
|
953
|
+
v8::Local<v8::Function> callback = jsi_callback->callback_->Get(isolate);
|
|
954
|
+
v8::Local<v8::Context> context = callback->GetCreationContextChecked();
|
|
955
|
+
v8::Context::Scope context_scope(context);
|
|
956
|
+
|
|
957
|
+
v8::Local<v8::Value> args[1] = {v8::Boolean::New(isolate, done)};
|
|
958
|
+
|
|
959
|
+
// v8::TryCatch tc(isolate);
|
|
960
|
+
|
|
961
|
+
callback->Call(context, context->Global(), 1,
|
|
962
|
+
args); // ignore JS return value
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
delete jsi_callback;
|
|
966
|
+
delete queue;
|
|
967
|
+
delete current_queue;
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
};
|
|
971
|
+
current_queue->addOperation(main_task);
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
queue->addOperation(task);
|
|
975
|
+
#endif
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
}
|
|
979
|
+
*/
|
|
980
|
+
|
|
981
|
+
const ImageAsset *ImageAssetImpl::GetImageAsset() {
|
|
817
982
|
return this->asset_;
|
|
818
983
|
}
|
|
819
984
|
|