@nativescript/canvas 2.0.0-beta.9 → 2.0.0-rc.0
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 +15 -24
- package/Canvas/common.js +147 -203
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +13 -15
- package/Canvas/index.android.js +152 -151
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +23 -11
- package/Canvas/index.ios.d.ts +14 -6
- package/Canvas/index.ios.js +213 -124
- 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 +4 -2
- package/Canvas2D/CanvasRenderingContext2D/index.js +79 -85
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.d.ts +14 -0
- package/Canvas2D/DOMMatrix/index.js +62 -0
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/ImageData/index.js +4 -6
- package/Canvas2D/ImageData/index.js.map +1 -1
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/Dom/Dom.js +8 -1
- package/Dom/Dom.js.map +1 -1
- package/Dom/Group.d.ts +1 -2
- package/Dom/Group.js.map +1 -1
- package/Dom/Image.d.ts +4 -1
- package/Dom/Image.js +15 -2
- package/Dom/Image.js.map +1 -1
- package/Dom/Paint.d.ts +1 -1
- package/Dom/Paint.js.map +1 -1
- package/Dom/Text.js.map +1 -1
- package/Dom/shaders/LinearGradient.js.map +1 -1
- package/Dom/shaders/TwoPointConicalGradient.js.map +1 -1
- package/Dom/shapes/Atlas.js.map +1 -1
- package/Dom/shapes/Circle.js.map +1 -1
- package/Dom/shapes/Line.js.map +1 -1
- package/Dom/shapes/Oval.js.map +1 -1
- package/Dom/shapes/Path.d.ts +1 -1
- package/Dom/shapes/Path.js.map +1 -1
- package/Dom/shapes/Rect.js.map +1 -1
- package/Dom/shapes/RoundedRect.js.map +1 -1
- package/Dom/shapes/index.js.map +1 -1
- package/Fonts/FontFace.android.d.ts +46 -0
- package/Fonts/FontFace.android.js +197 -0
- package/Fonts/FontFace.android.js.map +1 -0
- package/Fonts/FontFace.ios.d.ts +45 -0
- package/Fonts/FontFace.ios.js +169 -0
- package/Fonts/FontFace.ios.js.map +1 -0
- package/Fonts/FontFaceSet.android.d.ts +31 -0
- package/Fonts/FontFaceSet.android.js +119 -0
- package/Fonts/FontFaceSet.android.js.map +1 -0
- package/Fonts/FontFaceSet.ios.d.ts +31 -0
- package/Fonts/FontFaceSet.ios.js +109 -0
- package/Fonts/FontFaceSet.ios.js.map +1 -0
- package/Fonts/index.d.ts +2 -0
- package/Fonts/index.js +3 -0
- package/Fonts/index.js.map +1 -0
- package/ImageAsset/index.d.ts +8 -3
- package/ImageAsset/index.js +206 -11
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/index.js +110 -23
- package/ImageBitmap/index.js.map +1 -1
- package/README.md +62 -3
- package/TextDecoder/index.js +3 -3
- package/TextDecoder/index.js.map +1 -1
- package/TextEncoder/index.js +3 -3
- package/TextEncoder/index.js.map +1 -1
- package/WebGL/WebGLExtensions/index.js +5 -5
- package/WebGL/WebGLExtensions/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/common.d.ts +1 -1
- package/WebGL/WebGLRenderingContext/common.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +1 -0
- package/WebGL/WebGLRenderingContext/index.js +144 -46
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -0
- package/WebGL2/WebGL2RenderingContext/index.js +7 -8
- package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
- package/WebGPU/Constants.d.ts +36 -0
- package/WebGPU/Constants.js +42 -0
- package/WebGPU/Constants.js.map +1 -0
- package/WebGPU/Errors.d.ts +18 -0
- package/WebGPU/Errors.js +21 -0
- package/WebGPU/Errors.js.map +1 -0
- package/WebGPU/GPU.d.ts +13 -0
- package/WebGPU/GPU.js +36 -0
- package/WebGPU/GPU.js.map +1 -0
- package/WebGPU/GPUAdapter.d.ts +26 -0
- package/WebGPU/GPUAdapter.js +93 -0
- package/WebGPU/GPUAdapter.js.map +1 -0
- package/WebGPU/GPUAdapterInfo.d.ts +9 -0
- package/WebGPU/GPUAdapterInfo.js +24 -0
- package/WebGPU/GPUAdapterInfo.js.map +1 -0
- package/WebGPU/GPUBindGroup.d.ts +6 -0
- package/WebGPU/GPUBindGroup.js +15 -0
- package/WebGPU/GPUBindGroup.js.map +1 -0
- package/WebGPU/GPUBindGroupLayout.d.ts +6 -0
- package/WebGPU/GPUBindGroupLayout.js +15 -0
- package/WebGPU/GPUBindGroupLayout.js.map +1 -0
- package/WebGPU/GPUBuffer.d.ts +15 -0
- package/WebGPU/GPUBuffer.js +66 -0
- package/WebGPU/GPUBuffer.js.map +1 -0
- package/WebGPU/GPUCanvasContext.d.ts +42 -0
- package/WebGPU/GPUCanvasContext.js +149 -0
- package/WebGPU/GPUCanvasContext.js.map +1 -0
- package/WebGPU/GPUCommandBuffer.d.ts +6 -0
- package/WebGPU/GPUCommandBuffer.js +15 -0
- package/WebGPU/GPUCommandBuffer.js.map +1 -0
- package/WebGPU/GPUCommandEncoder.d.ts +35 -0
- package/WebGPU/GPUCommandEncoder.js +163 -0
- package/WebGPU/GPUCommandEncoder.js.map +1 -0
- package/WebGPU/GPUComputePassEncoder.d.ts +17 -0
- package/WebGPU/GPUComputePassEncoder.js +53 -0
- package/WebGPU/GPUComputePassEncoder.js.map +1 -0
- package/WebGPU/GPUComputePipeline.d.ts +8 -0
- package/WebGPU/GPUComputePipeline.js +19 -0
- package/WebGPU/GPUComputePipeline.js.map +1 -0
- package/WebGPU/GPUDevice.d.ts +111 -0
- package/WebGPU/GPUDevice.js +341 -0
- package/WebGPU/GPUDevice.js.map +1 -0
- package/WebGPU/GPUDeviceLostInfo.d.ts +1 -0
- package/WebGPU/GPUDeviceLostInfo.js +10 -0
- package/WebGPU/GPUDeviceLostInfo.js.map +1 -0
- package/WebGPU/GPUExternalTexture.d.ts +6 -0
- package/WebGPU/GPUExternalTexture.js +15 -0
- package/WebGPU/GPUExternalTexture.js.map +1 -0
- package/WebGPU/GPUPipelineLayout.d.ts +6 -0
- package/WebGPU/GPUPipelineLayout.js +15 -0
- package/WebGPU/GPUPipelineLayout.js.map +1 -0
- package/WebGPU/GPUQuerySet.d.ts +6 -0
- package/WebGPU/GPUQuerySet.js +15 -0
- package/WebGPU/GPUQuerySet.js.map +1 -0
- package/WebGPU/GPUQueue.d.ts +15 -0
- package/WebGPU/GPUQueue.js +128 -0
- package/WebGPU/GPUQueue.js.map +1 -0
- package/WebGPU/GPURenderBundle.d.ts +6 -0
- package/WebGPU/GPURenderBundle.js +15 -0
- package/WebGPU/GPURenderBundle.js.map +1 -0
- package/WebGPU/GPURenderBundleEncoder.d.ts +22 -0
- package/WebGPU/GPURenderBundleEncoder.js +65 -0
- package/WebGPU/GPURenderBundleEncoder.js.map +1 -0
- package/WebGPU/GPURenderPassEncoder.d.ts +33 -0
- package/WebGPU/GPURenderPassEncoder.js +106 -0
- package/WebGPU/GPURenderPassEncoder.js.map +1 -0
- package/WebGPU/GPURenderPipeline.d.ts +8 -0
- package/WebGPU/GPURenderPipeline.js +19 -0
- package/WebGPU/GPURenderPipeline.js.map +1 -0
- package/WebGPU/GPUSampler.d.ts +6 -0
- package/WebGPU/GPUSampler.js +15 -0
- package/WebGPU/GPUSampler.js.map +1 -0
- package/WebGPU/GPUShaderModule.d.ts +6 -0
- package/WebGPU/GPUShaderModule.js +15 -0
- package/WebGPU/GPUShaderModule.js.map +1 -0
- package/WebGPU/GPUTexture.d.ts +18 -0
- package/WebGPU/GPUTexture.js +47 -0
- package/WebGPU/GPUTexture.js.map +1 -0
- package/WebGPU/GPUTextureView.d.ts +6 -0
- package/WebGPU/GPUTextureView.js +15 -0
- package/WebGPU/GPUTextureView.js.map +1 -0
- package/WebGPU/Interfaces.d.ts +246 -0
- package/WebGPU/Interfaces.js +2 -0
- package/WebGPU/Interfaces.js.map +1 -0
- package/WebGPU/Types.d.ts +47 -0
- package/WebGPU/Types.js +2 -0
- package/WebGPU/Types.js.map +1 -0
- package/WebGPU/Utils.d.ts +7 -0
- package/WebGPU/Utils.js +301 -0
- package/WebGPU/Utils.js.map +1 -0
- package/WebGPU/index.d.ts +28 -0
- package/WebGPU/index.js +29 -0
- package/WebGPU/index.js.map +1 -0
- package/angular/{esm2020 → esm2022}/index.mjs +5 -5
- package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs +4 -4
- package/angular/{fesm2015 → fesm2022}/nativescript-canvas-angular.mjs.map +1 -1
- package/angular/package.json +4 -10
- package/common.d.ts +0 -3
- package/common.js +1 -5
- package/common.js.map +1 -1
- package/helpers.js.map +1 -1
- package/index.d.ts +4 -2
- package/index.js +37 -3
- package/index.js.map +1 -1
- package/package.json +2 -5
- 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 +194 -56
- 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 +152 -151
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2901 -411
- 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 +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +259 -52
- 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 +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Black.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraLight.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Light.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoMath-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-BoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Italic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-MediumItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBoldItalic.ttf +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 +994 -663
- 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 +388 -112
- 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 +152 -151
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2901 -411
- 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 +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +259 -52
- 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 +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +10901 -8099
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +259 -52
- 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 +259 -52
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +143 -33
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Black.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-ExtraLight.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Light.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/Noto_Serif_CJK/NotoSerifTC-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoMath-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Bold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-BoldItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Italic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Medium.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-MediumItalic.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-Regular.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBold.ttf +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/fonts/STIXTwoMath/STIXTwoText-SemiBoldItalic.ttf +0 -0
- 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 +993 -662
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +1037 -641
- package/platforms/ios/build.xcconfig +3 -1
- 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/Caches.h +69 -1
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +647 -1166
- package/platforms/ios/src/cpp/CanvasJSIModule.h +11 -1
- package/platforms/ios/src/cpp/Helpers.h +2 -129
- package/platforms/ios/src/cpp/ImageAssetImpl.cpp +600 -437
- package/platforms/ios/src/cpp/ImageAssetImpl.h +18 -10
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +63 -6
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +12 -4
- package/platforms/ios/src/cpp/JSIReadFileCallback.h +4 -4
- package/platforms/ios/src/cpp/NativeType.h +87 -0
- package/platforms/ios/src/cpp/ObjectWrapperImpl.h +50 -0
- package/platforms/ios/src/cpp/OneByteStringResource.cpp +2 -2
- package/platforms/ios/src/cpp/PromiseCallback.h +197 -0
- package/platforms/ios/src/cpp/RafImpl.h +2 -2
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +0 -6
- package/platforms/ios/src/cpp/TextDecoderImpl.h +3 -3
- package/platforms/ios/src/cpp/TextEncoderImpl.cpp +1 -1
- package/platforms/ios/src/cpp/TextEncoderImpl.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +8 -7
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +1 -11
- package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +3 -3
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +193 -90
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +77 -23
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +5 -6
- package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +4 -4
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +409 -3
- package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +29 -2
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +6 -3
- package/platforms/ios/src/cpp/canvas2d/Path2D.h +7 -7
- package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +3 -3
- 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 +247 -160
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +1 -1
- package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
- 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.cpp +1067 -960
- 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 +371 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.h +63 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.cpp +174 -0
- package/platforms/ios/src/cpp/webgpu/GPUAdapterInfoImpl.h +58 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +277 -0
- package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +63 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +379 -0
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +57 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +81 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1217 -0
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +73 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +293 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +65 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +109 -0
- package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +51 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +3701 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +97 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +200 -0
- package/platforms/ios/src/cpp/webgpu/GPUImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +80 -0
- package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +136 -0
- package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +55 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +605 -0
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +59 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +501 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +74 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +78 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +723 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +92 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +109 -0
- package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +52 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +80 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.cpp +1304 -0
- package/platforms/ios/src/cpp/webgpu/GPUSupportedLimitsImpl.h +288 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +386 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +77 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +79 -0
- package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +48 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +756 -0
- package/react/index.d.ts +1 -1
- package/utils.d.ts +1 -1
- package/utils.js.map +1 -1
- package/SVG/Circle.d.ts +0 -11
- package/SVG/Circle.js +0 -21
- package/SVG/Circle.js.map +0 -1
- package/SVG/ClipPath.d.ts +0 -4
- package/SVG/ClipPath.js +0 -9
- package/SVG/ClipPath.js.map +0 -1
- package/SVG/Defs.d.ts +0 -4
- package/SVG/Defs.js +0 -9
- package/SVG/Defs.js.map +0 -1
- package/SVG/Ellipse.d.ts +0 -13
- package/SVG/Ellipse.js +0 -26
- package/SVG/Ellipse.js.map +0 -1
- package/SVG/G.d.ts +0 -7
- package/SVG/G.js +0 -9
- package/SVG/G.js.map +0 -1
- package/SVG/Image.d.ts +0 -11
- package/SVG/Image.js +0 -40
- package/SVG/Image.js.map +0 -1
- package/SVG/Line.d.ts +0 -13
- package/SVG/Line.js +0 -26
- package/SVG/Line.js.map +0 -1
- package/SVG/LinearGradient.d.ts +0 -10
- package/SVG/LinearGradient.js +0 -13
- package/SVG/LinearGradient.js.map +0 -1
- package/SVG/Path.d.ts +0 -7
- package/SVG/Path.js +0 -14
- package/SVG/Path.js.map +0 -1
- package/SVG/Pattern.d.ts +0 -4
- package/SVG/Pattern.js +0 -9
- package/SVG/Pattern.js.map +0 -1
- package/SVG/Polygon.d.ts +0 -7
- package/SVG/Polygon.js +0 -14
- package/SVG/Polygon.js.map +0 -1
- package/SVG/Polyline.d.ts +0 -7
- package/SVG/Polyline.js +0 -14
- package/SVG/Polyline.js.map +0 -1
- package/SVG/Rect.d.ts +0 -8
- package/SVG/Rect.js +0 -13
- package/SVG/Rect.js.map +0 -1
- package/SVG/SVG.d.ts +0 -32
- package/SVG/SVG.js +0 -204
- package/SVG/SVG.js.map +0 -1
- package/SVG/SVGItem.d.ts +0 -5
- package/SVG/SVGItem.js +0 -8
- package/SVG/SVGItem.js.map +0 -1
- package/SVG/Stop.d.ts +0 -5
- package/SVG/Stop.js +0 -9
- package/SVG/Stop.js.map +0 -1
- package/SVG/Symbol.d.ts +0 -4
- package/SVG/Symbol.js +0 -9
- package/SVG/Symbol.js.map +0 -1
- package/SVG/Text.d.ts +0 -14
- package/SVG/Text.js +0 -26
- package/SVG/Text.js.map +0 -1
- package/SVG/Use.d.ts +0 -4
- package/SVG/Use.js +0 -9
- package/SVG/Use.js.map +0 -1
- package/SVG/index.d.ts +0 -18
- package/SVG/index.js +0 -19
- package/SVG/index.js.map +0 -1
- package/angular/fesm2020/nativescript-canvas-angular.mjs +0 -24
- package/angular/fesm2020/nativescript-canvas-angular.mjs.map +0 -1
- package/platforms/ios/src/cpp/PerIsolateData.cpp +0 -49
- package/platforms/ios/src/cpp/PerIsolateData.h +0 -54
- package/platforms/ios/src/cpp/URLImpl.cpp +0 -464
- package/platforms/ios/src/cpp/URLImpl.h +0 -121
- package/typings/objc!CanvasNative.d.ts +0 -2038
- package/typings/objc!CanvasNative.js +0 -1
- package/typings/objc!CanvasNative.js.map +0 -1
- /package/angular/{esm2020 → esm2022}/nativescript-canvas-angular.mjs +0 -0
|
@@ -9,23 +9,25 @@
|
|
|
9
9
|
#include <vector>
|
|
10
10
|
#include "Helpers.h"
|
|
11
11
|
#include "Common.h"
|
|
12
|
+
|
|
12
13
|
#ifdef __APPLE__
|
|
13
14
|
#include "NSOperationQueueWrapper.h"
|
|
14
15
|
#endif
|
|
16
|
+
|
|
15
17
|
#include "ObjectWrapperImpl.h"
|
|
16
18
|
|
|
17
|
-
class ImageAssetImpl: ObjectWrapperImpl{
|
|
19
|
+
class ImageAssetImpl : ObjectWrapperImpl {
|
|
18
20
|
public:
|
|
19
21
|
|
|
20
|
-
ImageAssetImpl(ImageAsset*
|
|
22
|
+
explicit ImageAssetImpl(const ImageAsset *asset);
|
|
21
23
|
|
|
22
24
|
~ImageAssetImpl();
|
|
23
25
|
|
|
24
|
-
ImageAsset*
|
|
26
|
+
const ImageAsset *GetImageAsset();
|
|
25
27
|
|
|
26
28
|
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
27
29
|
|
|
28
|
-
static ImageAssetImpl *GetPointer(const v8::Local<v8::Object
|
|
30
|
+
static ImageAssetImpl *GetPointer(const v8::Local<v8::Object> &object);
|
|
29
31
|
|
|
30
32
|
static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate);
|
|
31
33
|
|
|
@@ -38,12 +40,14 @@ public:
|
|
|
38
40
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
39
41
|
|
|
40
42
|
static void GetAddr(v8::Local<v8::String> name,
|
|
41
|
-
|
|
43
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
44
|
+
|
|
45
|
+
static void GetReference(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
42
46
|
|
|
43
47
|
static void GetError(v8::Local<v8::String> name,
|
|
44
|
-
|
|
48
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
45
49
|
|
|
46
|
-
static void Scale(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
50
|
+
// static void Scale(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
47
51
|
|
|
48
52
|
static void FromUrlSync(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
49
53
|
|
|
@@ -57,11 +61,15 @@ public:
|
|
|
57
61
|
|
|
58
62
|
static void FromBytesCb(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
59
63
|
|
|
60
|
-
static void
|
|
64
|
+
static void FromEncodedBytesSync(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
65
|
+
|
|
66
|
+
static void FromEncodedBytesCb(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
67
|
+
|
|
68
|
+
/* static void SaveSync(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
static void SaveCb(const v8::FunctionCallbackInfo<v8::Value> &args);*/
|
|
63
71
|
|
|
64
72
|
|
|
65
73
|
private:
|
|
66
|
-
ImageAsset*
|
|
74
|
+
const ImageAsset *asset_;
|
|
67
75
|
};
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
#include "ImageBitmapImpl.h"
|
|
6
6
|
#include "Caches.h"
|
|
7
7
|
|
|
8
|
-
ImageBitmapImpl::ImageBitmapImpl(ImageAsset*
|
|
8
|
+
ImageBitmapImpl::ImageBitmapImpl(const ImageAsset *asset)
|
|
9
9
|
: bitmap_(asset) {}
|
|
10
10
|
|
|
11
|
-
ImageBitmapImpl::~ImageBitmapImpl(){
|
|
12
|
-
|
|
11
|
+
ImageBitmapImpl::~ImageBitmapImpl() {
|
|
12
|
+
canvas_native_image_asset_release(bitmap_);
|
|
13
13
|
this->bitmap_ = nullptr;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -26,6 +26,23 @@ void ImageBitmapImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isol
|
|
|
26
26
|
canvasModule->Set(context, ConvertToV8String(isolate, "ImageBitmap"), func);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
|
|
30
|
+
void ImageBitmapImpl::FromAsset(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
31
|
+
auto asset = args[0];
|
|
32
|
+
auto type = GetNativeType(asset);
|
|
33
|
+
auto isolate = args.GetIsolate();
|
|
34
|
+
if (type == NativeType::ImageAsset){
|
|
35
|
+
auto ptr = ImageAssetImpl::GetPointer(asset.As<v8::Object>());
|
|
36
|
+
auto ret = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
37
|
+
auto bitmap = new ImageBitmapImpl(ret);
|
|
38
|
+
auto data = v8::External::New(isolate, bitmap);
|
|
39
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
40
|
+
args.GetReturnValue().Set(object);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
args.GetReturnValue().SetNull();
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
ImageBitmapImpl *ImageBitmapImpl::GetPointer(v8::Local<v8::Object> object) {
|
|
30
47
|
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
31
48
|
if (ptr == nullptr) {
|
|
@@ -45,7 +62,10 @@ v8::Local<v8::FunctionTemplate> ImageBitmapImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
45
62
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
46
63
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "ImageBitmap"));
|
|
47
64
|
|
|
65
|
+
ctorTmpl->Set(ConvertToV8String(isolate, "fromAsset"), v8::FunctionTemplate::New(isolate, FromAsset));
|
|
66
|
+
|
|
48
67
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
68
|
+
|
|
49
69
|
tmpl->SetInternalFieldCount(2);
|
|
50
70
|
tmpl->SetAccessor(
|
|
51
71
|
ConvertToV8String(isolate, "width"), GetWidth);
|
|
@@ -56,6 +76,13 @@ v8::Local<v8::FunctionTemplate> ImageBitmapImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
56
76
|
tmpl->Set(
|
|
57
77
|
ConvertToV8String(isolate, "close"), v8::FunctionTemplate::New(isolate, Close));
|
|
58
78
|
|
|
79
|
+
tmpl->SetAccessor(
|
|
80
|
+
ConvertToV8String(isolate, "__addr"),
|
|
81
|
+
GetAddr);
|
|
82
|
+
|
|
83
|
+
tmpl->Set(
|
|
84
|
+
ConvertToV8String(isolate, "__getRef"),
|
|
85
|
+
v8::FunctionTemplate::New(isolate, GetReference));
|
|
59
86
|
|
|
60
87
|
cache->ImageBitmapTmpl =
|
|
61
88
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
@@ -93,6 +120,8 @@ void ImageBitmapImpl::Close(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
93
120
|
return;
|
|
94
121
|
}
|
|
95
122
|
|
|
123
|
+
canvas_native_image_asset_close(ptr->GetImageAsset());
|
|
124
|
+
|
|
96
125
|
ptr->closed_ = true;
|
|
97
126
|
}
|
|
98
127
|
|
|
@@ -121,11 +150,11 @@ ImageBitmapImpl::HandleOptions(v8::Isolate *isolate, const v8::Local<v8::Value>
|
|
|
121
150
|
auto premultiplyAlpha = ConvertFromV8String(isolate, premultiplyAlphaValue);
|
|
122
151
|
|
|
123
152
|
if (premultiplyAlpha == "premultiply") {
|
|
124
|
-
ret.premultiplyAlpha = ImageBitmapPremultiplyAlphaPremultiply;
|
|
153
|
+
ret.premultiplyAlpha = ImageBitmapPremultiplyAlpha::ImageBitmapPremultiplyAlphaPremultiply;
|
|
125
154
|
}
|
|
126
155
|
|
|
127
156
|
if (premultiplyAlpha == "none") {
|
|
128
|
-
ret.premultiplyAlpha =
|
|
157
|
+
ret.premultiplyAlpha = ImageBitmapPremultiplyAlpha::ImageBitmapPremultiplyAlphaAlphaNone;
|
|
129
158
|
}
|
|
130
159
|
}
|
|
131
160
|
|
|
@@ -184,6 +213,34 @@ ImageBitmapImpl::HandleOptions(v8::Isolate *isolate, const v8::Local<v8::Value>
|
|
|
184
213
|
return ret;
|
|
185
214
|
}
|
|
186
215
|
|
|
187
|
-
|
|
216
|
+
|
|
217
|
+
void
|
|
218
|
+
ImageBitmapImpl::GetAddr(v8::Local<v8::String> name,
|
|
219
|
+
const v8::PropertyCallbackInfo<v8::Value> &info) {
|
|
220
|
+
auto ptr = GetPointer(info.This());
|
|
221
|
+
if (ptr != nullptr) {
|
|
222
|
+
auto isolate = info.GetIsolate();
|
|
223
|
+
auto ret = std::to_string(canvas_native_image_asset_get_addr(ptr->GetImageAsset()));
|
|
224
|
+
info.GetReturnValue().Set(ConvertToV8String(isolate, ret));
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
info.GetReturnValue().SetEmptyString();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void
|
|
231
|
+
ImageBitmapImpl::GetReference(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
232
|
+
auto ptr = GetPointer(args.This());
|
|
233
|
+
if (ptr != nullptr) {
|
|
234
|
+
auto isolate = args.GetIsolate();
|
|
235
|
+
auto reference = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
236
|
+
auto ret = std::to_string(canvas_native_image_asset_get_addr(reference));
|
|
237
|
+
args.GetReturnValue().Set(ConvertToV8String(isolate, ret));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
args.GetReturnValue().SetEmptyString();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const ImageAsset *ImageBitmapImpl::GetImageAsset() {
|
|
188
245
|
return this->bitmap_;
|
|
189
246
|
}
|
|
@@ -21,7 +21,7 @@ struct Options {
|
|
|
21
21
|
|
|
22
22
|
class ImageBitmapImpl : public ObjectWrapperImpl {
|
|
23
23
|
public:
|
|
24
|
-
ImageBitmapImpl(ImageAsset *asset);
|
|
24
|
+
explicit ImageBitmapImpl(const ImageAsset *asset);
|
|
25
25
|
|
|
26
26
|
~ImageBitmapImpl();
|
|
27
27
|
|
|
@@ -30,11 +30,12 @@ public:
|
|
|
30
30
|
v8::EscapableHandleScope scope(isolate);
|
|
31
31
|
auto object = ImageBitmapImpl::GetCtor(isolate)->GetFunction(
|
|
32
32
|
context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
|
|
33
|
-
SetNativeType(object, NativeType::ImageBitmap);
|
|
34
33
|
|
|
35
34
|
auto ptr = asset->Value();
|
|
36
35
|
auto impl = static_cast<ObjectWrapperImpl *>(ptr);
|
|
37
36
|
|
|
37
|
+
SetNativeType(impl, NativeType::ImageBitmap);
|
|
38
|
+
|
|
38
39
|
|
|
39
40
|
object->SetAlignedPointerInInternalField(0, ptr);
|
|
40
41
|
|
|
@@ -45,7 +46,7 @@ public:
|
|
|
45
46
|
|
|
46
47
|
static Options HandleOptions(v8::Isolate *isolate, const v8::Local<v8::Value> &options);
|
|
47
48
|
|
|
48
|
-
ImageAsset *GetImageAsset();
|
|
49
|
+
const ImageAsset *GetImageAsset();
|
|
49
50
|
|
|
50
51
|
static void Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isolate);
|
|
51
52
|
|
|
@@ -59,9 +60,16 @@ public:
|
|
|
59
60
|
static void GetHeight(v8::Local<v8::String> name,
|
|
60
61
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
61
62
|
|
|
63
|
+
static void GetReference(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
64
|
+
|
|
65
|
+
static void GetAddr(v8::Local<v8::String> name,
|
|
66
|
+
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
67
|
+
|
|
62
68
|
static void Close(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
63
69
|
|
|
70
|
+
static void FromAsset(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
71
|
+
|
|
64
72
|
private:
|
|
65
|
-
ImageAsset *bitmap_;
|
|
73
|
+
const ImageAsset *bitmap_;
|
|
66
74
|
bool closed_ = false;
|
|
67
75
|
};
|
|
@@ -38,9 +38,9 @@ struct JSIReadFileCallback {
|
|
|
38
38
|
|
|
39
39
|
~JSIReadFileCallback() {
|
|
40
40
|
callback_.Reset();
|
|
41
|
-
|
|
41
|
+
canvas_native_u8_buffer_release(data_);
|
|
42
42
|
data_ = nullptr;
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
canvas_native_string_destroy(error_);
|
|
45
45
|
error_ = nullptr;
|
|
46
46
|
}
|
|
@@ -86,9 +86,9 @@ struct JSIReadFileCallback {
|
|
|
86
86
|
close(fd_[0]);
|
|
87
87
|
ALooper_release(looper_);
|
|
88
88
|
callback_.Reset();
|
|
89
|
-
|
|
89
|
+
canvas_native_u8_buffer_release(data_);
|
|
90
90
|
data_ = nullptr;
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
canvas_native_string_destroy(error_);
|
|
93
93
|
error_ = nullptr;
|
|
94
94
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 06/08/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef CANVAS_ANDROID_NATIVETYPE_H
|
|
6
|
+
#define CANVAS_ANDROID_NATIVETYPE_H
|
|
7
|
+
|
|
8
|
+
enum class NativeType {
|
|
9
|
+
None,
|
|
10
|
+
CanvasGradient,
|
|
11
|
+
CanvasPattern,
|
|
12
|
+
ImageData,
|
|
13
|
+
ImageAsset,
|
|
14
|
+
CanvasRenderingContext2D,
|
|
15
|
+
WebGLRenderingContextBase,
|
|
16
|
+
Path2D,
|
|
17
|
+
Matrix,
|
|
18
|
+
ImageBitmap,
|
|
19
|
+
TextMetrics,
|
|
20
|
+
|
|
21
|
+
WebGLQuery,
|
|
22
|
+
WebGLProgram,
|
|
23
|
+
WebGLShader,
|
|
24
|
+
WebGLBuffer,
|
|
25
|
+
WebGLFramebuffer,
|
|
26
|
+
WebGLRenderbuffer,
|
|
27
|
+
WebGLTexture,
|
|
28
|
+
WebGLActiveInfo,
|
|
29
|
+
OES_fbo_render_mipmap,
|
|
30
|
+
EXT_blend_minmax,
|
|
31
|
+
EXT_color_buffer_half_float,
|
|
32
|
+
EXT_disjoint_timer_query,
|
|
33
|
+
EXT_sRGB,
|
|
34
|
+
EXT_shader_texture_lod,
|
|
35
|
+
EXT_texture_filter_anisotropic,
|
|
36
|
+
OES_element_index_uint,
|
|
37
|
+
OES_standard_derivatives,
|
|
38
|
+
OES_texture_float,
|
|
39
|
+
OES_texture_float_linear,
|
|
40
|
+
OES_texture_half_float_linear,
|
|
41
|
+
OES_texture_half_float,
|
|
42
|
+
WEBGL_color_buffer_float,
|
|
43
|
+
OES_vertex_array_object,
|
|
44
|
+
WebGLVertexArrayObject,
|
|
45
|
+
WEBGL_compressed_texture_atc,
|
|
46
|
+
WEBGL_compressed_texture_etc1,
|
|
47
|
+
WEBGL_compressed_texture_s3tc,
|
|
48
|
+
WEBGL_compressed_texture_s3tc_srgb,
|
|
49
|
+
WEBGL_compressed_texture_etc,
|
|
50
|
+
WEBGL_compressed_texture_pvrtc,
|
|
51
|
+
WEBGL_lose_context,
|
|
52
|
+
ANGLE_instanced_arrays,
|
|
53
|
+
WEBGL_depth_texture,
|
|
54
|
+
WEBGL_draw_buffers,
|
|
55
|
+
WebGLShaderPrecisionFormat,
|
|
56
|
+
WebGLUniformLocation,
|
|
57
|
+
WebGLSampler,
|
|
58
|
+
WebGLTransformFeedback,
|
|
59
|
+
WebGLSync,
|
|
60
|
+
|
|
61
|
+
GPUAdapter,
|
|
62
|
+
GPUSupportedLimits,
|
|
63
|
+
GPUDevice,
|
|
64
|
+
GPUQueue,
|
|
65
|
+
GPUBuffer,
|
|
66
|
+
GPUInstance,
|
|
67
|
+
GPUCanvasContext,
|
|
68
|
+
GPUTexture,
|
|
69
|
+
GPUAdapterInfo,
|
|
70
|
+
GPUCommandEncoder,
|
|
71
|
+
GPUComputePass,
|
|
72
|
+
GPUQuerySet,
|
|
73
|
+
GPUShaderModule,
|
|
74
|
+
GPUPipelineLayout,
|
|
75
|
+
GPURenderPipeline,
|
|
76
|
+
GPUBindGroupLayout,
|
|
77
|
+
GPUTextureView,
|
|
78
|
+
GPURenderPassEncoder,
|
|
79
|
+
GPUCommandBuffer,
|
|
80
|
+
GPUBindGroup,
|
|
81
|
+
GPUComputePipeline,
|
|
82
|
+
GPUSampler,
|
|
83
|
+
GPURenderBundleEncoder,
|
|
84
|
+
GPURenderBundle
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
#endif //CANVAS_ANDROID_NATIVETYPE_H
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
#define ObjectWrapperImpl_h
|
|
10
10
|
|
|
11
11
|
#include "Common.h"
|
|
12
|
+
#include "NativeType.h"
|
|
12
13
|
|
|
13
14
|
class ObjectWrapperImpl {
|
|
14
15
|
public:
|
|
16
|
+
NativeType type_ = NativeType::None;
|
|
15
17
|
|
|
16
18
|
static void Finalizer(const v8::WeakCallbackInfo<ObjectWrapperImpl> &data) {
|
|
17
19
|
auto *pThis = data.GetParameter();
|
|
@@ -25,6 +27,54 @@ public:
|
|
|
25
27
|
weakHandle_.SetWeak(this, Finalizer, v8::WeakCallbackType::kParameter);
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
static void SetNativeType(const v8::Local<v8::Object> &obj, NativeType type) {
|
|
33
|
+
if (!obj.IsEmpty() && !obj->IsNullOrUndefined() && obj->IsObject() &&
|
|
34
|
+
obj.As<v8::Object>()->InternalFieldCount() > 1) {
|
|
35
|
+
auto wrapper = obj.As<v8::Object>()->GetAlignedPointerFromInternalField(0);
|
|
36
|
+
if (wrapper != nullptr) {
|
|
37
|
+
((ObjectWrapperImpl *) wrapper)->type_ = type;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
inline static NativeType GetNativeType(const v8::Local<v8::Value> &obj) {
|
|
44
|
+
if (!obj.IsEmpty() && !obj->IsNullOrUndefined() && obj->IsObject() &&
|
|
45
|
+
obj.As<v8::Object>()->InternalFieldCount() > 1) {
|
|
46
|
+
auto info = obj.As<v8::Object>()->GetAlignedPointerFromInternalField(0);
|
|
47
|
+
|
|
48
|
+
if (info != nullptr) {
|
|
49
|
+
auto value = static_cast<ObjectWrapperImpl *>(info);
|
|
50
|
+
return value->type_;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return NativeType::None;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static void SetNativeType(ObjectWrapperImpl *obj, NativeType type) {
|
|
58
|
+
if (obj != nullptr) {
|
|
59
|
+
obj->type_ = type;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static NativeType GetNativeType(const ObjectWrapperImpl *obj) {
|
|
64
|
+
if (obj != nullptr) {
|
|
65
|
+
return obj->type_;
|
|
66
|
+
}
|
|
67
|
+
return NativeType::None;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static void SetNativeType(ObjectWrapperImpl &obj, NativeType type) {
|
|
71
|
+
obj.type_ = type;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static NativeType GetNativeType(const ObjectWrapperImpl &obj) {
|
|
75
|
+
return obj.type_;
|
|
76
|
+
}
|
|
77
|
+
|
|
28
78
|
private:
|
|
29
79
|
v8::Global<v8::Object> weakHandle_;
|
|
30
80
|
|
|
@@ -27,11 +27,11 @@ OneByteStringResource::OneByteStringResource(std::string string) : stdString_(st
|
|
|
27
27
|
|
|
28
28
|
OneByteStringResource::~OneByteStringResource() {
|
|
29
29
|
if (usingBuffer_) {
|
|
30
|
-
|
|
30
|
+
canvas_native_u8_buffer_release(buffer_);
|
|
31
31
|
this->string_ = nullptr;
|
|
32
32
|
this->length_ = 0;
|
|
33
33
|
}else if(usingCow_){
|
|
34
|
-
|
|
34
|
+
canvas_native_ccow_release(cow_);
|
|
35
35
|
this->string_ = nullptr;
|
|
36
36
|
this->length_ = 0;
|
|
37
37
|
}else if(usingString){
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Osei Fortune on 05/08/2024.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "Common.h"
|
|
8
|
+
#include <thread>
|
|
9
|
+
|
|
10
|
+
#ifdef __ANDROID__
|
|
11
|
+
|
|
12
|
+
#include <android/looper.h>
|
|
13
|
+
#include <cassert>
|
|
14
|
+
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#ifdef __APPLE__
|
|
18
|
+
#include "NSOperationQueueWrapper.h"
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#include <unistd.h>
|
|
23
|
+
#include <fcntl.h>
|
|
24
|
+
|
|
25
|
+
typedef void(*CompleteCallback)(bool success, void *data);
|
|
26
|
+
|
|
27
|
+
#ifdef __APPLE__
|
|
28
|
+
struct PromiseCallback {
|
|
29
|
+
struct Inner {
|
|
30
|
+
NSOperationQueueWrapper* current_queue = nullptr;
|
|
31
|
+
v8::Isolate *isolate_;
|
|
32
|
+
v8::Persistent<v8::Promise::Resolver> callback_;
|
|
33
|
+
v8::Persistent<v8::Value> error_;
|
|
34
|
+
CompleteCallback completeCallback_;
|
|
35
|
+
CompleteCallback completeCallbackWrapper_;
|
|
36
|
+
bool isPrepared_ = false;
|
|
37
|
+
void* data;
|
|
38
|
+
|
|
39
|
+
Inner(v8::Isolate *isolate, v8::Local<v8::Promise::Resolver> callback,
|
|
40
|
+
CompleteCallback completeCallback) : isolate_(isolate),
|
|
41
|
+
callback_(v8::Persistent<v8::Promise::Resolver>(
|
|
42
|
+
isolate,
|
|
43
|
+
callback)) {
|
|
44
|
+
this->completeCallback_ = completeCallback;
|
|
45
|
+
this->completeCallbackWrapper_ = [](bool success, void *data){
|
|
46
|
+
if(data != nullptr){
|
|
47
|
+
auto* callback = static_cast<PromiseCallback*>(data);
|
|
48
|
+
auto inner = callback->inner_.get();
|
|
49
|
+
if(inner == nullptr || inner->current_queue != nullptr){
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
inner->current_queue->addOperation([success, data, inner, callback](){
|
|
54
|
+
inner->completeCallback_(success, data);
|
|
55
|
+
// delete callback;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void prepare(){
|
|
62
|
+
current_queue = new NSOperationQueueWrapper(true);
|
|
63
|
+
isPrepared_ = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void execute(bool complete, PromiseCallback* callback){
|
|
67
|
+
completeCallbackWrapper_(complete, callback);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
~Inner(){
|
|
71
|
+
callback_.Reset();
|
|
72
|
+
error_.Reset();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
std::shared_ptr<Inner> inner_;
|
|
77
|
+
|
|
78
|
+
void prepare(){
|
|
79
|
+
auto inner = this->inner_.get();
|
|
80
|
+
if(inner == nullptr){return;}
|
|
81
|
+
inner->prepare();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void execute(bool complete) {
|
|
85
|
+
auto inner = this->inner_.get();
|
|
86
|
+
if (inner == nullptr) { return; }
|
|
87
|
+
inner->execute(complete, this);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
explicit PromiseCallback(std::shared_ptr<Inner> inner) : inner_(std::move(inner)) {}
|
|
91
|
+
|
|
92
|
+
PromiseCallback(v8::Isolate *isolate, v8::Local<v8::Promise::Resolver> callback,
|
|
93
|
+
CompleteCallback completeCallback) : inner_(
|
|
94
|
+
std::make_shared<Inner>(isolate, callback, completeCallback)) {}
|
|
95
|
+
};
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
#ifdef __ANDROID__
|
|
99
|
+
|
|
100
|
+
struct PromiseCallback {
|
|
101
|
+
struct Inner {
|
|
102
|
+
int fd_[2];
|
|
103
|
+
ALooper *looper_ = nullptr;
|
|
104
|
+
v8::Isolate *isolate_;
|
|
105
|
+
v8::Persistent<v8::Promise::Resolver> callback_;
|
|
106
|
+
void *data = nullptr;
|
|
107
|
+
CompleteCallback completeCallback_;
|
|
108
|
+
bool isPrepared_ = false;
|
|
109
|
+
|
|
110
|
+
Inner(v8::Isolate *isolate, v8::Local<v8::Promise::Resolver> callback,
|
|
111
|
+
CompleteCallback completeCallback) : isolate_(isolate),
|
|
112
|
+
callback_(v8::Persistent<v8::Promise::Resolver>(
|
|
113
|
+
isolate,
|
|
114
|
+
callback)) {
|
|
115
|
+
this->completeCallback_ = completeCallback;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
void prepare() {
|
|
119
|
+
// release previous looper
|
|
120
|
+
if (isPrepared_) {
|
|
121
|
+
ALooper_removeFd(looper_, fd_[0]);
|
|
122
|
+
close(fd_[0]);
|
|
123
|
+
fd_[0] = -1;
|
|
124
|
+
fd_[1] = -1;
|
|
125
|
+
ALooper_release(looper_);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
auto res = pipe(fd_);
|
|
129
|
+
assert(res != -1);
|
|
130
|
+
res = fcntl(fd_[1], F_SETFL, O_NONBLOCK);
|
|
131
|
+
assert(res != -1);
|
|
132
|
+
looper_ = ALooper_prepare(0);
|
|
133
|
+
ALooper_acquire(looper_);
|
|
134
|
+
|
|
135
|
+
isPrepared_ = true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void execute(bool complete) const {
|
|
139
|
+
if (!isPrepared_) { return; }
|
|
140
|
+
write(fd_[1],
|
|
141
|
+
&complete,
|
|
142
|
+
sizeof(bool));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
~Inner() {
|
|
147
|
+
if (!isPrepared_) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
ALooper_removeFd(looper_, fd_[0]);
|
|
151
|
+
close(fd_[0]);
|
|
152
|
+
ALooper_release(looper_);
|
|
153
|
+
callback_.Reset();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
void prepare() const {
|
|
158
|
+
auto inner = this->inner_.get();
|
|
159
|
+
if (inner == nullptr) { return; }
|
|
160
|
+
inner->prepare();
|
|
161
|
+
auto looper = inner->looper_;
|
|
162
|
+
auto fd = inner->fd_[0];
|
|
163
|
+
auto data = new PromiseCallback(this->inner_);
|
|
164
|
+
ALooper_addFd(looper,
|
|
165
|
+
fd,
|
|
166
|
+
0,
|
|
167
|
+
ALOOPER_EVENT_INPUT,
|
|
168
|
+
[](int fd, int events,
|
|
169
|
+
void *data) {
|
|
170
|
+
auto cb = static_cast<PromiseCallback *>(data);
|
|
171
|
+
bool done = false;
|
|
172
|
+
read(fd, &done,
|
|
173
|
+
sizeof(bool));
|
|
174
|
+
cb->inner_->completeCallback_(done, data);
|
|
175
|
+
return 0;
|
|
176
|
+
}, (void *) data);
|
|
177
|
+
|
|
178
|
+
inner->isPrepared_ = true;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
void execute(bool complete) const {
|
|
182
|
+
auto inner = this->inner_.get();
|
|
183
|
+
if (inner == nullptr) { return; }
|
|
184
|
+
inner->execute(complete);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
std::shared_ptr<Inner> inner_;
|
|
188
|
+
|
|
189
|
+
explicit PromiseCallback(std::shared_ptr<Inner> inner) : inner_(std::move(inner)) {}
|
|
190
|
+
|
|
191
|
+
PromiseCallback(v8::Isolate *isolate, v8::Local<v8::Promise::Resolver> callback,
|
|
192
|
+
CompleteCallback completeCallback) : inner_(
|
|
193
|
+
std::make_shared<Inner>(isolate, callback, completeCallback)) {}
|
|
194
|
+
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
#endif
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
class RafImpl {
|
|
13
13
|
public:
|
|
14
14
|
RafImpl(OnRafCallback *rafCallback, intptr_t callback, Raf* raf);
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
~RafImpl(){
|
|
17
|
-
|
|
17
|
+
canvas_native_raf_release(this->GetRaf());
|
|
18
18
|
this->raf_ = nullptr;
|
|
19
19
|
delete rafCallback_;
|
|
20
20
|
}
|
|
@@ -57,12 +57,6 @@ v8::Local<v8::FunctionTemplate> TextDecoderImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
57
57
|
return ctorTmpl;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
void MyWeakCallback(const v8::WeakCallbackInfo<TextDecoderImpl>& info) {
|
|
61
|
-
TextDecoderImpl* obj = info.GetParameter();
|
|
62
|
-
// Perform cleanup or any necessary actions when the object is no longer reachable
|
|
63
|
-
delete obj;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
60
|
void TextDecoderImpl::Ctor(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
67
61
|
auto count = args.Length();
|
|
68
62
|
auto value = args[0];
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
class TextDecoderImpl: ObjectWrapperImpl {
|
|
12
12
|
public:
|
|
13
|
-
|
|
14
|
-
TextDecoderImpl(TextDecoder *decoder);
|
|
13
|
+
|
|
14
|
+
explicit TextDecoderImpl(TextDecoder *decoder);
|
|
15
15
|
|
|
16
16
|
~TextDecoderImpl() {
|
|
17
|
-
|
|
17
|
+
canvas_native_text_decoder_release(this->GetTextDecoder());
|
|
18
18
|
this->decoder_ = nullptr;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -122,7 +122,7 @@ void TextEncoderImpl::Encode(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
122
122
|
[](void *data, size_t length,
|
|
123
123
|
void *deleter_data) {
|
|
124
124
|
if (deleter_data != nullptr) {
|
|
125
|
-
|
|
125
|
+
canvas_native_u8_buffer_release((U8Buffer *)deleter_data);
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
encoded);
|