@shopify/react-native-skia 2.9.1 → 2.10.1
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/android/CMakeLists.txt +8 -46
- package/android/build.gradle +33 -0
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/cpp/api/JsiNativeBuffer.h +23 -24
- package/cpp/api/JsiSkAnimatedImage.h +24 -25
- package/cpp/api/JsiSkAnimatedImageFactory.h +18 -17
- package/cpp/api/JsiSkApi.h +254 -96
- package/cpp/api/JsiSkCanvas.h +141 -266
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +49 -67
- package/cpp/api/JsiSkContourMeasure.h +31 -38
- package/cpp/api/JsiSkContourMeasureIter.h +20 -23
- package/cpp/api/JsiSkConverters.h +410 -0
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +27 -32
- package/cpp/api/JsiSkFont.h +123 -192
- package/cpp/api/JsiSkFontMgr.h +33 -26
- package/cpp/api/JsiSkFontMgrFactory.h +12 -11
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +90 -79
- package/cpp/api/JsiSkImageFactory.h +93 -95
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +375 -629
- package/cpp/api/JsiSkImageInfo.h +25 -25
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +17 -17
- package/cpp/api/JsiSkMatrix.h +51 -88
- package/cpp/api/JsiSkNativeObjects.h +387 -0
- package/cpp/api/JsiSkPaint.h +104 -142
- package/cpp/api/JsiSkParagraph.h +54 -64
- package/cpp/api/JsiSkParagraphBuilder.h +43 -68
- package/cpp/api/JsiSkParagraphBuilderFactory.h +20 -24
- package/cpp/api/JsiSkPath.h +242 -350
- package/cpp/api/JsiSkPathBuilder.h +153 -273
- package/cpp/api/JsiSkPathBuilderFactory.h +19 -20
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +61 -80
- package/cpp/api/JsiSkPathFactory.h +148 -238
- package/cpp/api/JsiSkPicture.h +32 -27
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +27 -29
- package/cpp/api/JsiSkPoint.h +20 -23
- package/cpp/api/JsiSkRRect.h +24 -32
- package/cpp/api/JsiSkRSXform.h +31 -48
- package/cpp/api/JsiSkRect.h +40 -50
- package/cpp/api/JsiSkRuntimeEffect.h +85 -92
- package/cpp/api/JsiSkRuntimeEffectFactory.h +14 -18
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +28 -30
- package/cpp/api/JsiSkSVG.h +15 -15
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +159 -238
- package/cpp/api/JsiSkSkottie.h +131 -143
- package/cpp/api/JsiSkSurface.h +29 -32
- package/cpp/api/JsiSkSurfaceFactory.h +18 -20
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +40 -66
- package/cpp/api/JsiSkTypeface.h +25 -22
- package/cpp/api/JsiSkTypefaceFactory.h +17 -15
- package/cpp/api/JsiSkTypefaceFontProvider.h +43 -39
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +13 -12
- package/cpp/api/JsiSkVertices.h +23 -22
- package/cpp/api/JsiSkiaContext.h +22 -23
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +43 -81
- package/cpp/api/recorder/Convertor.h +31 -61
- package/cpp/api/recorder/DataTypes.h +8 -16
- package/cpp/api/recorder/JsiRecorder.h +83 -55
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/BoxedNativeObject.h +146 -0
- package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
- package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -31
- package/cpp/{jsi2 → jsi}/NativeObject.h +131 -152
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNDawnContext.h +18 -2
- package/cpp/rnskia/RNDawnInterop.cpp +19 -0
- package/cpp/rnskia/RNDawnUtils.h +18 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +9 -168
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +2 -0
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/skia/NativeSetup.js +4 -0
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +5 -15
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +0 -1
- package/lib/commonjs/skia/types/index.js +0 -11
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +1 -4
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/module/external/reanimated/renderHelpers.js +29 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/skia/NativeSetup.js +4 -0
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
- package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/module/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +5 -15
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +0 -1
- package/lib/module/skia/types/index.js +0 -1
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +1 -4
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/mock/index.d.ts +0 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -2
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/typescript/src/skia/types/Skia.d.ts +5 -15
- package/lib/typescript/src/skia/types/index.d.ts +0 -1
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/package.json +8 -5
- package/react-native-skia.podspec +38 -5
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/mock/index.ts +0 -1
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/skia/types/Image/ImageFactory.ts +15 -6
- package/src/skia/types/Skia.ts +5 -15
- package/src/skia/types/index.ts +0 -1
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkia.ts +2 -5
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/index.ts +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +0 -112
- package/android/cpp/rnskia-android/SkiaPlatformContext.h +0 -26
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +0 -43
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +0 -50
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +0 -98
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +0 -19
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +0 -58
- package/apple/RNWebGPUAppleNativeBuffer.mm +0 -33
- package/apple/SkiaPlatformContext.h +0 -20
- package/apple/SkiaPlatformContext.mm +0 -21
- package/apple/SkiaWebGPUView.mm +0 -81
- package/apple/WebGPUMetalView.mm +0 -136
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/rnwgpu/ArrayBuffer.h +0 -117
- package/cpp/rnwgpu/Canvas.h +0 -50
- package/cpp/rnwgpu/PlatformContext.h +0 -18
- package/cpp/rnwgpu/SurfaceRegistry.h +0 -605
- package/cpp/rnwgpu/api/AppleNativeBuffer.h +0 -22
- package/cpp/rnwgpu/api/Convertors.h +0 -783
- package/cpp/rnwgpu/api/External.h +0 -12
- package/cpp/rnwgpu/api/GPU.cpp +0 -162
- package/cpp/rnwgpu/api/GPU.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -240
- package/cpp/rnwgpu/api/GPUAdapter.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
- package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
- package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -107
- package/cpp/rnwgpu/api/GPUBuffer.h +0 -88
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -75
- package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -70
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
- package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
- package/cpp/rnwgpu/api/GPUDevice.cpp +0 -614
- package/cpp/rnwgpu/api/GPUDevice.h +0 -258
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
- package/cpp/rnwgpu/api/GPUError.h +0 -35
- package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -139
- package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -95
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -203
- package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
- package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
- package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
- package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
- package/cpp/rnwgpu/api/GPUQueue.cpp +0 -179
- package/cpp/rnwgpu/api/GPUQueue.h +0 -84
- package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
- package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
- package/cpp/rnwgpu/api/GPUSampler.h +0 -44
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -56
- package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
- package/cpp/rnwgpu/api/GPUSharedFence.cpp +0 -80
- package/cpp/rnwgpu/api/GPUSharedFence.h +0 -53
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -135
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -75
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
- package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
- package/cpp/rnwgpu/api/GPUTexture.h +0 -162
- package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -60
- package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
- package/cpp/rnwgpu/api/ImageBitmap.h +0 -62
- package/cpp/rnwgpu/api/NativeBufferUtils.h +0 -87
- package/cpp/rnwgpu/api/RNWebGPU.h +0 -82
- package/cpp/rnwgpu/api/WebGPUConstants.h +0 -36
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -78
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -97
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -52
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -66
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -67
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -109
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -38
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -90
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -69
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -55
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -43
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -80
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -101
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -92
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -110
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -53
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1969
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -214
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -58
- package/cpp/rnwgpu/async/RuntimeContext.cpp +0 -199
- package/cpp/rnwgpu/async/RuntimeContext.h +0 -134
- package/lib/commonjs/skia/types/WebGPU.d.ts +0 -184
- package/lib/commonjs/skia/types/WebGPU.js +0 -105
- package/lib/commonjs/skia/types/WebGPU.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js +0 -10
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +0 -103
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/specs/utils.d.ts +0 -1
- package/lib/commonjs/specs/utils.js +0 -11
- package/lib/commonjs/specs/utils.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +0 -33
- package/lib/commonjs/views/WebGPUCanvas.js +0 -79
- package/lib/commonjs/views/WebGPUCanvas.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/commonjs/views/WebGPUCanvas.web.js +0 -20
- package/lib/commonjs/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/module/skia/types/WebGPU.d.ts +0 -184
- package/lib/module/skia/types/WebGPU.js +0 -99
- package/lib/module/skia/types/WebGPU.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.js +0 -4
- package/lib/module/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.web.js +0 -96
- package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/module/specs/utils.d.ts +0 -1
- package/lib/module/specs/utils.js +0 -5
- package/lib/module/specs/utils.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.d.ts +0 -33
- package/lib/module/views/WebGPUCanvas.js +0 -70
- package/lib/module/views/WebGPUCanvas.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/module/views/WebGPUCanvas.web.js +0 -12
- package/lib/module/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +0 -2
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -4
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -3
- package/lib/typescript/lib/commonjs/specs/utils.d.ts +0 -2
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.d.ts +0 -6
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -6
- package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +0 -31
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -2
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -2
- package/lib/typescript/lib/module/specs/utils.d.ts +0 -1
- package/lib/typescript/lib/module/views/WebGPUCanvas.d.ts +0 -7
- package/lib/typescript/lib/module/views/WebGPUCanvas.web.d.ts +0 -8
- package/lib/typescript/src/skia/types/WebGPU.d.ts +0 -184
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/typescript/src/specs/utils.d.ts +0 -1
- package/lib/typescript/src/views/WebGPUCanvas.d.ts +0 -33
- package/lib/typescript/src/views/WebGPUCanvas.web.d.ts +0 -23
- package/src/skia/types/WebGPU.ts +0 -226
- package/src/specs/WebGPUViewNativeComponent.ts +0 -11
- package/src/specs/WebGPUViewNativeComponent.web.ts +0 -110
- package/src/specs/utils.ts +0 -4
- package/src/views/WebGPUCanvas.tsx +0 -125
- package/src/views/WebGPUCanvas.web.tsx +0 -36
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
|
@@ -5,14 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
8
9
|
#include "JsiSkSkottie.h"
|
|
9
10
|
|
|
10
11
|
namespace RNSkia {
|
|
11
12
|
|
|
12
13
|
namespace jsi = facebook::jsi;
|
|
13
14
|
|
|
14
|
-
class JsiSkottieFactory : public
|
|
15
|
+
class JsiSkottieFactory : public JsiSkNativeObject<JsiSkottieFactory> {
|
|
15
16
|
public:
|
|
17
|
+
static constexpr const char *CLASS_NAME = "SkottieFactory";
|
|
18
|
+
|
|
16
19
|
JSI_HOST_FUNCTION(Make) {
|
|
17
20
|
auto fontMgr = JsiSkFontMgrFactory::getFontMgr(getContext());
|
|
18
21
|
auto json = arguments[0].asString(runtime).utf8(runtime);
|
|
@@ -34,13 +37,10 @@ public:
|
|
|
34
37
|
auto jsObject = jsValue.asObject(runtime);
|
|
35
38
|
|
|
36
39
|
// Check if the object is a SkData host object
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
std::string k = key;
|
|
42
|
-
assets[k] = skData->getObject();
|
|
43
|
-
}
|
|
40
|
+
auto skData = tryGetJsiObject<JsiSkData>(runtime, jsObject);
|
|
41
|
+
if (skData) {
|
|
42
|
+
std::string k = key;
|
|
43
|
+
assets[k] = skData->getObject();
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -51,20 +51,19 @@ public:
|
|
|
51
51
|
if (!managedAnimation->_animation) {
|
|
52
52
|
return jsi::Value::null();
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
getContext());
|
|
54
|
+
return makeJsiObject(
|
|
55
|
+
runtime, std::make_shared<JsiSkSkottie>(getContext(),
|
|
56
|
+
std::move(managedAnimation)));
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
size_t getMemoryPressure() const override { return 4096; }
|
|
59
|
+
size_t getMemoryPressure() override { return 4096; }
|
|
63
60
|
|
|
64
|
-
|
|
61
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
62
|
+
installHostMethod(runtime, prototype, "Make", &JsiSkottieFactory::Make);
|
|
63
|
+
}
|
|
65
64
|
|
|
66
65
|
explicit JsiSkottieFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
67
|
-
:
|
|
66
|
+
: JsiSkNativeObject<JsiSkottieFactory>(std::move(context)) {}
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
} // namespace RNSkia
|
package/cpp/api/JsiVideo.h
CHANGED
|
@@ -1,119 +1,83 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
|
-
#include <numeric>
|
|
5
4
|
#include <utility>
|
|
6
|
-
#include <
|
|
5
|
+
#include <variant>
|
|
7
6
|
|
|
8
|
-
#include "
|
|
9
|
-
#include "utils/RNSkLog.h"
|
|
7
|
+
#include "JsiSkNativeObjects.h"
|
|
10
8
|
#include <jsi/jsi.h>
|
|
11
9
|
|
|
12
|
-
#include "
|
|
13
|
-
#include "
|
|
14
|
-
#include "JsiSkRect.h"
|
|
15
|
-
#include "JsiSkTypeface.h"
|
|
10
|
+
#include "JsiSkConverters.h"
|
|
11
|
+
#include "JsiSkImage.h"
|
|
16
12
|
|
|
17
13
|
#include "rnskia/RNSkVideo.h"
|
|
18
14
|
|
|
19
|
-
#pragma clang diagnostic push
|
|
20
|
-
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
21
|
-
|
|
22
|
-
#include "include/core/SkFont.h"
|
|
23
|
-
#include "include/core/SkFontMetrics.h"
|
|
24
|
-
|
|
25
|
-
#pragma clang diagnostic pop
|
|
26
|
-
|
|
27
15
|
namespace RNSkia {
|
|
28
16
|
|
|
29
17
|
namespace jsi = facebook::jsi;
|
|
30
18
|
|
|
31
|
-
class JsiVideo
|
|
19
|
+
class JsiVideo
|
|
20
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiVideo, RNSkVideo> {
|
|
32
21
|
public:
|
|
33
|
-
|
|
22
|
+
static constexpr const char *CLASS_NAME = "Video";
|
|
34
23
|
|
|
35
|
-
|
|
24
|
+
std::variant<std::nullptr_t, std::shared_ptr<JsiSkImage>> nextImage() {
|
|
36
25
|
double timestamp = 0;
|
|
37
|
-
auto
|
|
38
|
-
auto image = video->nextImage(×tamp);
|
|
26
|
+
auto image = getObject()->nextImage(×tamp);
|
|
39
27
|
if (!image) {
|
|
40
|
-
return
|
|
28
|
+
return nullptr;
|
|
41
29
|
}
|
|
42
|
-
|
|
43
|
-
std::make_shared<JsiSkImage>(getContext(), std::move(image));
|
|
44
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
45
|
-
runtime, hostObjectInstance, getContext());
|
|
30
|
+
return std::make_shared<JsiSkImage>(getContext(), std::move(image));
|
|
46
31
|
}
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
double duration() { return getObject()->duration(); }
|
|
49
34
|
|
|
50
|
-
|
|
35
|
+
double framerate() { return getObject()->framerate(); }
|
|
51
36
|
|
|
52
|
-
|
|
37
|
+
double currentTime() { return getObject()->currentTime(); }
|
|
53
38
|
|
|
54
|
-
|
|
39
|
+
bool isPlaying() { return getObject()->isPlaying(); }
|
|
55
40
|
|
|
56
|
-
|
|
57
|
-
double timestamp = arguments[0].asNumber();
|
|
58
|
-
getObject()->seek(timestamp);
|
|
59
|
-
return jsi::Value::undefined();
|
|
60
|
-
}
|
|
41
|
+
void seek(double timestamp) { getObject()->seek(timestamp); }
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
auto rot = getObject()->getRotationInDegrees();
|
|
65
|
-
return jsi::Value(static_cast<double>(rot));
|
|
43
|
+
double rotation() {
|
|
44
|
+
return static_cast<double>(getObject()->getRotationInDegrees());
|
|
66
45
|
}
|
|
67
46
|
|
|
68
|
-
|
|
69
|
-
auto context = getContext();
|
|
70
|
-
auto size = getObject()->getSize();
|
|
71
|
-
auto result = jsi::Object(runtime);
|
|
72
|
-
result.setProperty(runtime, "width", static_cast<double>(size.width()));
|
|
73
|
-
result.setProperty(runtime, "height", static_cast<double>(size.height()));
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
47
|
+
SkISize size() { return getObject()->getSize(); }
|
|
76
48
|
|
|
77
|
-
|
|
78
|
-
getObject()->play();
|
|
79
|
-
return jsi::Value::undefined();
|
|
80
|
-
}
|
|
49
|
+
void play() { getObject()->play(); }
|
|
81
50
|
|
|
82
|
-
|
|
83
|
-
getObject()->pause();
|
|
84
|
-
return jsi::Value::undefined();
|
|
85
|
-
}
|
|
51
|
+
void pause() { getObject()->pause(); }
|
|
86
52
|
|
|
87
|
-
|
|
88
|
-
auto volume = arguments[0].asNumber();
|
|
53
|
+
void setVolume(double volume) {
|
|
89
54
|
getObject()->setVolume(static_cast<float>(volume));
|
|
90
|
-
return jsi::Value::undefined();
|
|
91
55
|
}
|
|
92
56
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
57
|
+
void setLooping(bool looping) { getObject()->setLooping(looping); }
|
|
58
|
+
|
|
59
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
60
|
+
installCommon(runtime, prototype);
|
|
61
|
+
installMethod(runtime, prototype, "nextImage", &JsiVideo::nextImage);
|
|
62
|
+
installMethod(runtime, prototype, "duration", &JsiVideo::duration);
|
|
63
|
+
installMethod(runtime, prototype, "framerate", &JsiVideo::framerate);
|
|
64
|
+
installMethod(runtime, prototype, "currentTime", &JsiVideo::currentTime);
|
|
65
|
+
installMethod(runtime, prototype, "isPlaying", &JsiVideo::isPlaying);
|
|
66
|
+
installMethod(runtime, prototype, "seek", &JsiVideo::seek);
|
|
67
|
+
installMethod(runtime, prototype, "rotation", &JsiVideo::rotation);
|
|
68
|
+
installMethod(runtime, prototype, "size", &JsiVideo::size);
|
|
69
|
+
installMethod(runtime, prototype, "play", &JsiVideo::play);
|
|
70
|
+
installMethod(runtime, prototype, "pause", &JsiVideo::pause);
|
|
71
|
+
installMethod(runtime, prototype, "setVolume", &JsiVideo::setVolume);
|
|
72
|
+
installMethod(runtime, prototype, "setLooping", &JsiVideo::setLooping);
|
|
97
73
|
}
|
|
98
74
|
|
|
99
|
-
JSI_EXPORT_FUNCTIONS(
|
|
100
|
-
JSI_EXPORT_FUNC(JsiVideo, nextImage), JSI_EXPORT_FUNC(JsiVideo, duration),
|
|
101
|
-
JSI_EXPORT_FUNC(JsiVideo, framerate),
|
|
102
|
-
JSI_EXPORT_FUNC(JsiVideo, currentTime),
|
|
103
|
-
JSI_EXPORT_FUNC(JsiVideo, isPlaying), JSI_EXPORT_FUNC(JsiVideo, seek),
|
|
104
|
-
JSI_EXPORT_FUNC(JsiVideo, rotation), JSI_EXPORT_FUNC(JsiVideo, size),
|
|
105
|
-
JSI_EXPORT_FUNC(JsiVideo, play), JSI_EXPORT_FUNC(JsiVideo, pause),
|
|
106
|
-
JSI_EXPORT_FUNC(JsiVideo, setVolume),
|
|
107
|
-
JSI_EXPORT_FUNC(JsiVideo, setLooping), JSI_EXPORT_FUNC(JsiVideo, dispose))
|
|
108
|
-
|
|
109
75
|
JsiVideo(std::shared_ptr<RNSkPlatformContext> context,
|
|
110
76
|
std::shared_ptr<RNSkVideo> video)
|
|
111
|
-
:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
size_t getMemoryPressure() const override { return 32768; }
|
|
77
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiVideo, RNSkVideo>(
|
|
78
|
+
std::move(context), std::move(video)) {}
|
|
115
79
|
|
|
116
|
-
|
|
80
|
+
size_t getMemoryPressure() override { return 32768; }
|
|
117
81
|
|
|
118
82
|
/**
|
|
119
83
|
* Creates the function for construction a new instance of the SkFont
|
|
@@ -128,10 +92,8 @@ public:
|
|
|
128
92
|
auto url = arguments[0].asString(runtime).utf8(runtime);
|
|
129
93
|
auto video = context->createVideo(url);
|
|
130
94
|
// Return the newly constructed object
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, videoObj,
|
|
134
|
-
context);
|
|
95
|
+
return makeJsiObject(runtime, std::make_shared<JsiVideo>(
|
|
96
|
+
std::move(context), std::move(video)));
|
|
135
97
|
};
|
|
136
98
|
}
|
|
137
99
|
};
|
|
@@ -394,8 +394,7 @@ SkSamplingOptions getPropertyValue(jsi::Runtime &runtime,
|
|
|
394
394
|
template <>
|
|
395
395
|
SkFont getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
396
396
|
if (value.isObject()) {
|
|
397
|
-
auto font =
|
|
398
|
-
value.asObject(runtime).asHostObject<JsiSkFont>(runtime)->getObject();
|
|
397
|
+
auto font = getJsiObject<JsiSkFont>(runtime, value)->getObject();
|
|
399
398
|
return SkFont(*font);
|
|
400
399
|
}
|
|
401
400
|
throw std::runtime_error("Invalid prop value for SkFont received");
|
|
@@ -427,9 +426,7 @@ GlyphData getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
|
427
426
|
template <>
|
|
428
427
|
SkRSXform getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
429
428
|
if (value.isObject()) {
|
|
430
|
-
auto form =
|
|
431
|
-
.asHostObject<JsiSkRSXform>(runtime)
|
|
432
|
-
->getObject();
|
|
429
|
+
auto form = getJsiObject<JsiSkRSXform>(runtime, value)->getObject();
|
|
433
430
|
return SkRSXform::Make(form->fSCos, form->fSSin, form->fTx, form->fTy);
|
|
434
431
|
}
|
|
435
432
|
throw std::runtime_error("Invalid prop value for SkRSXform received");
|
|
@@ -438,13 +435,11 @@ SkRSXform getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
|
438
435
|
template <>
|
|
439
436
|
sk_sp<SkSVGDOM> getPropertyValue(jsi::Runtime &runtime,
|
|
440
437
|
const jsi::Value &value) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
} else if (value.isNull()) {
|
|
438
|
+
auto ptr = tryGetJsiObject<JsiSkSVG>(runtime, value);
|
|
439
|
+
if (ptr != nullptr) {
|
|
440
|
+
return ptr->getObject();
|
|
441
|
+
}
|
|
442
|
+
if (value.isNull()) {
|
|
448
443
|
return nullptr;
|
|
449
444
|
}
|
|
450
445
|
throw std::runtime_error(
|
|
@@ -454,13 +449,11 @@ sk_sp<SkSVGDOM> getPropertyValue(jsi::Runtime &runtime,
|
|
|
454
449
|
template <>
|
|
455
450
|
sk_sp<skottie::Animation> getPropertyValue(jsi::Runtime &runtime,
|
|
456
451
|
const jsi::Value &value) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
} else if (value.isNull()) {
|
|
452
|
+
auto ptr = tryGetJsiObject<JsiSkSkottie>(runtime, value);
|
|
453
|
+
if (ptr != nullptr) {
|
|
454
|
+
return ptr->getObject()->_animation;
|
|
455
|
+
}
|
|
456
|
+
if (value.isNull()) {
|
|
464
457
|
return nullptr;
|
|
465
458
|
}
|
|
466
459
|
throw std::runtime_error(
|
|
@@ -470,13 +463,11 @@ sk_sp<skottie::Animation> getPropertyValue(jsi::Runtime &runtime,
|
|
|
470
463
|
template <>
|
|
471
464
|
sk_sp<SkImageFilter> getPropertyValue(jsi::Runtime &runtime,
|
|
472
465
|
const jsi::Value &value) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
} else if (value.isNull()) {
|
|
466
|
+
auto ptr = tryGetJsiObject<JsiSkImageFilter>(runtime, value);
|
|
467
|
+
if (ptr != nullptr) {
|
|
468
|
+
return ptr->getObject();
|
|
469
|
+
}
|
|
470
|
+
if (value.isNull()) {
|
|
480
471
|
return nullptr;
|
|
481
472
|
}
|
|
482
473
|
throw std::runtime_error(
|
|
@@ -487,9 +478,7 @@ template <>
|
|
|
487
478
|
sk_sp<SkPicture> getPropertyValue(jsi::Runtime &runtime,
|
|
488
479
|
const jsi::Value &value) {
|
|
489
480
|
if (value.isObject()) {
|
|
490
|
-
auto picture =
|
|
491
|
-
.asHostObject<JsiSkPicture>(runtime)
|
|
492
|
-
->getObject();
|
|
481
|
+
auto picture = getJsiObject<JsiSkPicture>(runtime, value)->getObject();
|
|
493
482
|
return picture;
|
|
494
483
|
}
|
|
495
484
|
throw std::runtime_error("Invalid prop value for SkTextBlob received");
|
|
@@ -498,8 +487,7 @@ sk_sp<SkPicture> getPropertyValue(jsi::Runtime &runtime,
|
|
|
498
487
|
template <>
|
|
499
488
|
SkPaint getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
500
489
|
if (value.isObject()) {
|
|
501
|
-
auto paint =
|
|
502
|
-
value.asObject(runtime).asHostObject<JsiSkPaint>(runtime)->getObject();
|
|
490
|
+
auto paint = getJsiObject<JsiSkPaint>(runtime, value)->getObject();
|
|
503
491
|
return SkPaint(*paint);
|
|
504
492
|
}
|
|
505
493
|
throw std::runtime_error("Invalid prop value for SkPaint received");
|
|
@@ -508,28 +496,15 @@ SkPaint getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
|
508
496
|
template <>
|
|
509
497
|
std::shared_ptr<JsiSkParagraph> getPropertyValue(jsi::Runtime &runtime,
|
|
510
498
|
const jsi::Value &value) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (!hostObject) {
|
|
514
|
-
return nullptr;
|
|
515
|
-
}
|
|
516
|
-
auto para = std::dynamic_pointer_cast<JsiSkParagraph>(hostObject);
|
|
517
|
-
if (!para) {
|
|
518
|
-
return nullptr;
|
|
519
|
-
}
|
|
520
|
-
// Return a shared_ptr instead of raw pointer
|
|
521
|
-
return para;
|
|
522
|
-
}
|
|
523
|
-
return nullptr;
|
|
499
|
+
// Return a shared_ptr instead of raw pointer
|
|
500
|
+
return tryGetJsiObject<JsiSkParagraph>(runtime, value);
|
|
524
501
|
}
|
|
525
502
|
|
|
526
503
|
template <>
|
|
527
504
|
sk_sp<SkTextBlob> getPropertyValue(jsi::Runtime &runtime,
|
|
528
505
|
const jsi::Value &value) {
|
|
529
506
|
if (value.isObject()) {
|
|
530
|
-
auto blob =
|
|
531
|
-
.asHostObject<JsiSkTextBlob>(runtime)
|
|
532
|
-
->getObject();
|
|
507
|
+
auto blob = getJsiObject<JsiSkTextBlob>(runtime, value)->getObject();
|
|
533
508
|
return blob;
|
|
534
509
|
}
|
|
535
510
|
throw std::runtime_error("Invalid prop value for SkTextBlob received");
|
|
@@ -539,9 +514,7 @@ template <>
|
|
|
539
514
|
sk_sp<SkRuntimeEffect> getPropertyValue(jsi::Runtime &runtime,
|
|
540
515
|
const jsi::Value &value) {
|
|
541
516
|
if (value.isObject()) {
|
|
542
|
-
auto effect =
|
|
543
|
-
.asHostObject<JsiSkRuntimeEffect>(runtime)
|
|
544
|
-
->getObject();
|
|
517
|
+
auto effect = getJsiObject<JsiSkRuntimeEffect>(runtime, value)->getObject();
|
|
545
518
|
return effect;
|
|
546
519
|
}
|
|
547
520
|
throw std::runtime_error("Invalid prop value for SkRuntimeEffect received");
|
|
@@ -552,8 +525,7 @@ sk_sp<SkImage> getPropertyValue(jsi::Runtime &runtime,
|
|
|
552
525
|
const jsi::Value &value) {
|
|
553
526
|
|
|
554
527
|
if (value.isObject()) {
|
|
555
|
-
auto effect =
|
|
556
|
-
value.asObject(runtime).asHostObject<JsiSkImage>(runtime)->getObject();
|
|
528
|
+
auto effect = getJsiObject<JsiSkImage>(runtime, value)->getObject();
|
|
557
529
|
return effect;
|
|
558
530
|
} else if (value.isNull()) {
|
|
559
531
|
return nullptr;
|
|
@@ -564,11 +536,9 @@ sk_sp<SkImage> getPropertyValue(jsi::Runtime &runtime,
|
|
|
564
536
|
template <>
|
|
565
537
|
SkMatrix getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
566
538
|
if (value.isObject()) {
|
|
567
|
-
auto
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
auto matrix =
|
|
571
|
-
object.asHostObject<JsiSkMatrix>(runtime)->getObject().get();
|
|
539
|
+
auto ptr = tryGetJsiObject<JsiSkMatrix>(runtime, value);
|
|
540
|
+
if (ptr != nullptr) {
|
|
541
|
+
auto matrix = ptr->getObject().get();
|
|
572
542
|
return SkMatrix(*matrix);
|
|
573
543
|
} else {
|
|
574
544
|
return JsiSkMatrix::getMatrix(runtime, value);
|
|
@@ -1008,10 +978,10 @@ Layer getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
|
1008
978
|
if (value.isBool()) {
|
|
1009
979
|
Layer layer = value.asBool();
|
|
1010
980
|
return layer;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
981
|
+
}
|
|
982
|
+
auto ptr = tryGetJsiObject<JsiSkPaint>(runtime, value);
|
|
983
|
+
if (ptr != nullptr) {
|
|
984
|
+
auto paint = ptr->getObject();
|
|
1015
985
|
Layer layer = SkPaint(*paint);
|
|
1016
986
|
return layer;
|
|
1017
987
|
}
|
|
@@ -51,12 +51,9 @@ std::shared_ptr<SkRect> processRect(jsi::Runtime &runtime,
|
|
|
51
51
|
const jsi::Value &value) {
|
|
52
52
|
if (value.isObject()) {
|
|
53
53
|
auto object = value.asObject(runtime);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (ptr != nullptr) {
|
|
58
|
-
return ptr->getObject();
|
|
59
|
-
}
|
|
54
|
+
auto ptr = tryGetJsiObject<JsiSkRect>(runtime, object);
|
|
55
|
+
if (ptr != nullptr) {
|
|
56
|
+
return ptr->getObject();
|
|
60
57
|
} else if (object.hasProperty(runtime, "x") &&
|
|
61
58
|
object.hasProperty(runtime, "y") &&
|
|
62
59
|
object.hasProperty(runtime, "width") &&
|
|
@@ -88,12 +85,9 @@ std::shared_ptr<SkRRect> processRRect(jsi::Runtime &runtime,
|
|
|
88
85
|
const jsi::Value &value) {
|
|
89
86
|
if (value.isObject()) {
|
|
90
87
|
auto object = value.asObject(runtime);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (ptr != nullptr) {
|
|
95
|
-
return ptr->getObject();
|
|
96
|
-
}
|
|
88
|
+
auto ptr = tryGetJsiObject<JsiSkRRect>(runtime, object);
|
|
89
|
+
if (ptr != nullptr) {
|
|
90
|
+
return ptr->getObject();
|
|
97
91
|
} else if (object.hasProperty(runtime, "rect") &&
|
|
98
92
|
object.hasProperty(runtime, "rx") &&
|
|
99
93
|
object.hasProperty(runtime, "ry")) {
|
|
@@ -136,10 +130,8 @@ std::shared_ptr<SkPath> processPath(jsi::Runtime &runtime,
|
|
|
136
130
|
} else {
|
|
137
131
|
throw std::runtime_error("Could not parse path from string.");
|
|
138
132
|
}
|
|
139
|
-
} else
|
|
140
|
-
|
|
141
|
-
auto ptr = std::dynamic_pointer_cast<JsiSkPath>(
|
|
142
|
-
value.asObject(runtime).asHostObject(runtime));
|
|
133
|
+
} else {
|
|
134
|
+
auto ptr = tryGetJsiObject<JsiSkPath>(runtime, value);
|
|
143
135
|
if (ptr != nullptr) {
|
|
144
136
|
return std::make_shared<SkPath>(ptr->getObject()->snapshot());
|
|
145
137
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include <vector>
|
|
7
7
|
|
|
8
8
|
#include "api/JsiSkCanvas.h"
|
|
9
|
-
#include "api/
|
|
9
|
+
#include "api/JsiSkNativeObjects.h"
|
|
10
10
|
#include "api/JsiSkPicture.h"
|
|
11
11
|
|
|
12
12
|
#include "DrawingCtx.h"
|
|
@@ -19,11 +19,14 @@ namespace RNSkia {
|
|
|
19
19
|
|
|
20
20
|
namespace jsi = facebook::jsi;
|
|
21
21
|
|
|
22
|
-
class JsiRecorder
|
|
22
|
+
class JsiRecorder
|
|
23
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiRecorder, Recorder> {
|
|
23
24
|
public:
|
|
25
|
+
static constexpr const char *CLASS_NAME = "Recorder";
|
|
26
|
+
|
|
24
27
|
JsiRecorder(std::shared_ptr<RNSkPlatformContext> context)
|
|
25
|
-
:
|
|
26
|
-
|
|
28
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiRecorder, Recorder>(
|
|
29
|
+
std::move(context), std::make_shared<Recorder>()) {
|
|
27
30
|
getObject()->_context = getContext();
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -61,7 +64,8 @@ public:
|
|
|
61
64
|
|
|
62
65
|
// Get the JsiSkPicture from the argument
|
|
63
66
|
auto pictureObject = arguments[0].asObject(runtime);
|
|
64
|
-
auto pictureHostObject =
|
|
67
|
+
auto pictureHostObject =
|
|
68
|
+
tryGetJsiObject<JsiSkPicture>(runtime, pictureObject);
|
|
65
69
|
if (!pictureHostObject) {
|
|
66
70
|
throw jsi::JSError(runtime, "Invalid Picture object provided to play()");
|
|
67
71
|
}
|
|
@@ -302,65 +306,89 @@ public:
|
|
|
302
306
|
return jsi::Value::undefined();
|
|
303
307
|
}
|
|
304
308
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
309
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
310
|
+
installCommon(runtime, prototype);
|
|
311
|
+
installHostMethod(runtime, prototype, "saveGroup", &JsiRecorder::saveGroup);
|
|
312
|
+
installHostMethod(runtime, prototype, "restoreGroup",
|
|
313
|
+
&JsiRecorder::restoreGroup);
|
|
314
|
+
installHostMethod(runtime, prototype, "savePaint", &JsiRecorder::savePaint);
|
|
315
|
+
installHostMethod(runtime, prototype, "restorePaint",
|
|
316
|
+
&JsiRecorder::restorePaint);
|
|
317
|
+
installHostMethod(runtime, prototype, "restorePaintDeclaration",
|
|
318
|
+
&JsiRecorder::restorePaintDeclaration);
|
|
319
|
+
installHostMethod(runtime, prototype, "materializePaint",
|
|
320
|
+
&JsiRecorder::materializePaint);
|
|
321
|
+
installHostMethod(runtime, prototype, "pushPathEffect",
|
|
322
|
+
&JsiRecorder::pushPathEffect);
|
|
323
|
+
installHostMethod(runtime, prototype, "pushImageFilter",
|
|
324
|
+
&JsiRecorder::pushImageFilter);
|
|
325
|
+
installHostMethod(runtime, prototype, "pushColorFilter",
|
|
326
|
+
&JsiRecorder::pushColorFilter);
|
|
327
|
+
installHostMethod(runtime, prototype, "pushShader",
|
|
328
|
+
&JsiRecorder::pushShader);
|
|
329
|
+
installHostMethod(runtime, prototype, "pushBlurMaskFilter",
|
|
330
|
+
&JsiRecorder::pushBlurMaskFilter);
|
|
331
|
+
installHostMethod(runtime, prototype, "composePathEffect",
|
|
332
|
+
&JsiRecorder::composePathEffect);
|
|
333
|
+
installHostMethod(runtime, prototype, "composeColorFilter",
|
|
334
|
+
&JsiRecorder::composeColorFilter);
|
|
335
|
+
installHostMethod(runtime, prototype, "composeImageFilter",
|
|
336
|
+
&JsiRecorder::composeImageFilter);
|
|
337
|
+
installHostMethod(runtime, prototype, "saveCTM", &JsiRecorder::saveCTM);
|
|
338
|
+
installHostMethod(runtime, prototype, "restoreCTM",
|
|
339
|
+
&JsiRecorder::restoreCTM);
|
|
340
|
+
installHostMethod(runtime, prototype, "drawPaint", &JsiRecorder::drawPaint);
|
|
341
|
+
installHostMethod(runtime, prototype, "saveLayer", &JsiRecorder::saveLayer);
|
|
342
|
+
installHostMethod(runtime, prototype, "saveBackdropFilter",
|
|
343
|
+
&JsiRecorder::saveBackdropFilter);
|
|
344
|
+
installHostMethod(runtime, prototype, "drawBox", &JsiRecorder::drawBox);
|
|
345
|
+
installHostMethod(runtime, prototype, "drawImage", &JsiRecorder::drawImage);
|
|
346
|
+
installHostMethod(runtime, prototype, "drawCircle",
|
|
347
|
+
&JsiRecorder::drawCircle);
|
|
348
|
+
installHostMethod(runtime, prototype, "drawPoints",
|
|
349
|
+
&JsiRecorder::drawPoints);
|
|
350
|
+
installHostMethod(runtime, prototype, "drawPath", &JsiRecorder::drawPath);
|
|
351
|
+
installHostMethod(runtime, prototype, "drawRect", &JsiRecorder::drawRect);
|
|
352
|
+
installHostMethod(runtime, prototype, "drawRRect", &JsiRecorder::drawRRect);
|
|
353
|
+
installHostMethod(runtime, prototype, "drawOval", &JsiRecorder::drawOval);
|
|
354
|
+
installHostMethod(runtime, prototype, "drawLine", &JsiRecorder::drawLine);
|
|
355
|
+
installHostMethod(runtime, prototype, "drawPatch", &JsiRecorder::drawPatch);
|
|
356
|
+
installHostMethod(runtime, prototype, "drawVertices",
|
|
357
|
+
&JsiRecorder::drawVertices);
|
|
358
|
+
installHostMethod(runtime, prototype, "drawDiffRect",
|
|
359
|
+
&JsiRecorder::drawDiffRect);
|
|
360
|
+
installHostMethod(runtime, prototype, "drawText", &JsiRecorder::drawText);
|
|
361
|
+
installHostMethod(runtime, prototype, "drawTextPath",
|
|
362
|
+
&JsiRecorder::drawTextPath);
|
|
363
|
+
installHostMethod(runtime, prototype, "drawTextBlob",
|
|
364
|
+
&JsiRecorder::drawTextBlob);
|
|
365
|
+
installHostMethod(runtime, prototype, "drawGlyphs",
|
|
366
|
+
&JsiRecorder::drawGlyphs);
|
|
367
|
+
installHostMethod(runtime, prototype, "drawPicture",
|
|
368
|
+
&JsiRecorder::drawPicture);
|
|
369
|
+
installHostMethod(runtime, prototype, "drawImageSVG",
|
|
370
|
+
&JsiRecorder::drawImageSVG);
|
|
371
|
+
installHostMethod(runtime, prototype, "drawParagraph",
|
|
372
|
+
&JsiRecorder::drawParagraph);
|
|
373
|
+
installHostMethod(runtime, prototype, "drawAtlas", &JsiRecorder::drawAtlas);
|
|
374
|
+
installHostMethod(runtime, prototype, "drawSkottie",
|
|
375
|
+
&JsiRecorder::drawSkottie);
|
|
376
|
+
installHostMethod(runtime, prototype, "play", &JsiRecorder::play);
|
|
377
|
+
installHostMethod(runtime, prototype, "applyUpdates",
|
|
378
|
+
&JsiRecorder::applyUpdates);
|
|
379
|
+
installHostMethod(runtime, prototype, "reset", &JsiRecorder::reset);
|
|
380
|
+
}
|
|
350
381
|
|
|
351
382
|
// This has no basis in reality but since since these are private long-lived
|
|
352
383
|
// objects, we think it is more than fine.
|
|
353
|
-
size_t getMemoryPressure()
|
|
354
|
-
|
|
355
|
-
std::string getObjectType() const override { return "JsiRecorder"; }
|
|
384
|
+
size_t getMemoryPressure() override { return 5 * 1024 * 1024; }
|
|
356
385
|
|
|
357
386
|
static const jsi::HostFunctionType
|
|
358
387
|
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
|
359
388
|
return JSI_HOST_FUNCTION_LAMBDA {
|
|
360
389
|
// Return the newly constructed object
|
|
361
390
|
auto recorder = std::make_shared<JsiRecorder>(std::move(context));
|
|
362
|
-
return
|
|
363
|
-
context);
|
|
391
|
+
return makeJsiObject(runtime, std::move(recorder));
|
|
364
392
|
};
|
|
365
393
|
}
|
|
366
394
|
};
|