@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
package/cpp/api/JsiSkSkottie.h
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <optional>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <utility>
|
|
7
|
+
#include <variant>
|
|
8
|
+
|
|
3
9
|
#include <jsi/jsi.h>
|
|
4
10
|
|
|
5
11
|
#include "JsiSkCanvas.h"
|
|
6
12
|
#include "JsiSkColor.h"
|
|
7
|
-
#include "
|
|
13
|
+
#include "JsiSkConverters.h"
|
|
14
|
+
#include "JsiSkNativeObjects.h"
|
|
8
15
|
#include "JsiSkPoint.h"
|
|
9
16
|
#include "JsiSkRect.h"
|
|
10
17
|
#include "api/third_party/SkottieUtils.h"
|
|
@@ -146,96 +153,71 @@ public:
|
|
|
146
153
|
std::unique_ptr<CustomPropertyManager> _propManager = nullptr;
|
|
147
154
|
};
|
|
148
155
|
|
|
149
|
-
class JsiSkSkottie
|
|
156
|
+
class JsiSkSkottie
|
|
157
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiSkSkottie,
|
|
158
|
+
ManagedAnimation> {
|
|
150
159
|
public:
|
|
160
|
+
static constexpr const char *CLASS_NAME = "Skottie";
|
|
161
|
+
|
|
151
162
|
// #region Properties
|
|
152
|
-
|
|
163
|
+
double duration() {
|
|
153
164
|
return static_cast<double>(getObject()->_animation->duration());
|
|
154
165
|
}
|
|
155
|
-
|
|
156
|
-
return static_cast<double>(getObject()->_animation->fps());
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
JSI_PROPERTY_GET(__typename__) {
|
|
160
|
-
return jsi::String::createFromUtf8(runtime, "Skottie");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkSkottie, __typename__))
|
|
166
|
+
double fps() { return static_cast<double>(getObject()->_animation->fps()); }
|
|
164
167
|
// #endregion
|
|
165
168
|
|
|
166
169
|
// #region Methods
|
|
167
|
-
|
|
170
|
+
void seekFrame(double frame,
|
|
171
|
+
std::optional<std::shared_ptr<SkRect>> rectParam) {
|
|
168
172
|
sksg::InvalidationController ic;
|
|
169
|
-
getObject()->_animation->seekFrame(
|
|
173
|
+
getObject()->_animation->seekFrame(frame, &ic);
|
|
170
174
|
auto bounds = ic.bounds();
|
|
171
|
-
if (
|
|
172
|
-
auto rect =
|
|
173
|
-
|
|
174
|
-
rect->setXYWH(bounds.x(), bounds.y(), bounds.width(), bounds.height());
|
|
175
|
-
}
|
|
175
|
+
if (rectParam.has_value() && *rectParam != nullptr) {
|
|
176
|
+
auto rect = *rectParam;
|
|
177
|
+
rect->setXYWH(bounds.x(), bounds.y(), bounds.width(), bounds.height());
|
|
176
178
|
}
|
|
177
|
-
return jsi::Value::undefined();
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
auto size = getObject()->_animation->size();
|
|
182
|
-
jsi::Object jsiSize(runtime);
|
|
183
|
-
jsiSize.setProperty(runtime, "width", size.width());
|
|
184
|
-
jsiSize.setProperty(runtime, "height", size.height());
|
|
185
|
-
return jsiSize;
|
|
186
|
-
}
|
|
181
|
+
SkSize size() { return getObject()->_animation->size(); }
|
|
187
182
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (count > 1) {
|
|
194
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[1]);
|
|
195
|
-
getObject()->_animation->render(canvas, rect.get());
|
|
183
|
+
void render(std::shared_ptr<JsiSkCanvas> jsiCanvas,
|
|
184
|
+
std::optional<std::shared_ptr<SkRect>> rect) {
|
|
185
|
+
auto canvas = jsiCanvas->getCanvas();
|
|
186
|
+
if (rect.has_value()) {
|
|
187
|
+
getObject()->_animation->render(canvas, rect->get());
|
|
196
188
|
} else {
|
|
197
189
|
getObject()->_animation->render(canvas);
|
|
198
190
|
}
|
|
199
|
-
|
|
200
|
-
return jsi::Value::undefined();
|
|
201
191
|
}
|
|
202
192
|
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
runtime, getObject()->_animation->version().c_str());
|
|
193
|
+
std::string version() {
|
|
194
|
+
return std::string(getObject()->_animation->version().c_str());
|
|
206
195
|
}
|
|
207
196
|
|
|
208
|
-
|
|
209
|
-
if (
|
|
210
|
-
return
|
|
197
|
+
bool setColor(JsiOptional<std::string> key, JsiOptional<JsiColor> color) {
|
|
198
|
+
if (!key.has_value() || !color.has_value()) {
|
|
199
|
+
return false;
|
|
211
200
|
}
|
|
212
|
-
|
|
213
|
-
auto color = JsiSkColor::fromValue(runtime, arguments[1]);
|
|
214
|
-
return getObject()->_propManager->setColor(key, color);
|
|
201
|
+
return getObject()->_propManager->setColor(*key, *color);
|
|
215
202
|
}
|
|
216
203
|
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
return
|
|
204
|
+
bool setOpacity(JsiOptional<std::string> key, JsiOptional<double> opacity) {
|
|
205
|
+
if (!key.has_value() || !opacity.has_value()) {
|
|
206
|
+
return false;
|
|
220
207
|
}
|
|
221
|
-
|
|
222
|
-
auto key = arguments[0].asString(runtime).utf8(runtime);
|
|
223
|
-
auto opacity = arguments[1].asNumber();
|
|
224
|
-
return getObject()->_propManager->setOpacity(key, opacity);
|
|
208
|
+
return getObject()->_propManager->setOpacity(*key, *opacity);
|
|
225
209
|
}
|
|
226
210
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
211
|
+
bool setText(JsiOptional<std::string> key, JsiOptional<std::string> text,
|
|
212
|
+
JsiOptional<double> size) {
|
|
213
|
+
if (!key.has_value() || !text.has_value() || !size.has_value()) {
|
|
214
|
+
return false;
|
|
230
215
|
}
|
|
231
|
-
auto key = arguments[0].asString(runtime).utf8(runtime);
|
|
232
|
-
auto text = arguments[1].asString(runtime).utf8(runtime);
|
|
233
|
-
auto size = arguments[2].asNumber();
|
|
234
216
|
// preserve all other text fields
|
|
235
|
-
auto t = getObject()->_propManager->getText(key);
|
|
236
|
-
t.fText = SkString(text);
|
|
237
|
-
t.fTextSize = size;
|
|
238
|
-
return getObject()->_propManager->setText(key, t);
|
|
217
|
+
auto t = getObject()->_propManager->getText(*key);
|
|
218
|
+
t.fText = SkString(*text);
|
|
219
|
+
t.fTextSize = *size;
|
|
220
|
+
return getObject()->_propManager->setText(*key, t);
|
|
239
221
|
}
|
|
240
222
|
|
|
241
223
|
JSI_HOST_FUNCTION(getTextProps) {
|
|
@@ -256,27 +238,24 @@ public:
|
|
|
256
238
|
return props;
|
|
257
239
|
}
|
|
258
240
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
241
|
+
bool setTransform(JsiOptional<std::string> key, JsiOptional<SkPoint> anchor,
|
|
242
|
+
JsiOptional<SkPoint> position, JsiOptional<SkPoint> scale,
|
|
243
|
+
JsiOptional<double> rotation, JsiOptional<double> skew,
|
|
244
|
+
JsiOptional<double> skewAxis) {
|
|
245
|
+
if (!key.has_value() || !anchor.has_value() || !position.has_value() ||
|
|
246
|
+
!scale.has_value() || !rotation.has_value() || !skew.has_value() ||
|
|
247
|
+
!skewAxis.has_value()) {
|
|
248
|
+
return false;
|
|
262
249
|
}
|
|
263
250
|
|
|
264
|
-
auto key = arguments[0].asString(runtime).utf8(runtime);
|
|
265
|
-
auto anchor = JsiSkPoint::fromValue(runtime, arguments[1]);
|
|
266
|
-
auto position = JsiSkPoint::fromValue(runtime, arguments[2]);
|
|
267
|
-
auto scale = JsiSkPoint::fromValue(runtime, arguments[3]);
|
|
268
|
-
auto rotation = arguments[4].asNumber();
|
|
269
|
-
auto skew = arguments[5].asNumber();
|
|
270
|
-
auto skewAxis = arguments[6].asNumber();
|
|
271
|
-
|
|
272
251
|
skottie::TransformPropertyValue transform;
|
|
273
252
|
transform.fAnchorPoint = {anchor->x(), anchor->y()};
|
|
274
253
|
transform.fPosition = {position->x(), position->y()};
|
|
275
254
|
transform.fScale = {scale->x(), scale->y()};
|
|
276
|
-
transform.fRotation = rotation;
|
|
277
|
-
transform.fSkew = skew;
|
|
278
|
-
transform.fSkewAxis = skewAxis;
|
|
279
|
-
return getObject()->_propManager->setTransform(key, transform);
|
|
255
|
+
transform.fRotation = *rotation;
|
|
256
|
+
transform.fSkew = *skew;
|
|
257
|
+
transform.fSkewAxis = *skewAxis;
|
|
258
|
+
return getObject()->_propManager->setTransform(*key, transform);
|
|
280
259
|
}
|
|
281
260
|
|
|
282
261
|
JSI_HOST_FUNCTION(getSlotInfo) {
|
|
@@ -330,52 +309,47 @@ public:
|
|
|
330
309
|
return slotInfoJS;
|
|
331
310
|
}
|
|
332
311
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
312
|
+
bool setColorSlot(JsiOptional<std::string> slotID,
|
|
313
|
+
JsiOptional<JsiColor> color) {
|
|
314
|
+
if (!slotID.has_value() || !color.has_value()) {
|
|
315
|
+
return false;
|
|
336
316
|
}
|
|
337
|
-
|
|
338
|
-
auto color = JsiSkColor::fromValue(runtime, arguments[1]);
|
|
339
|
-
return getObject()->_slotManager->setColorSlot(SkString(slotID), color);
|
|
317
|
+
return getObject()->_slotManager->setColorSlot(SkString(*slotID), *color);
|
|
340
318
|
}
|
|
341
319
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
320
|
+
bool setScalarSlot(JsiOptional<std::string> slotID,
|
|
321
|
+
JsiOptional<double> scalar) {
|
|
322
|
+
if (!slotID.has_value() || !scalar.has_value()) {
|
|
323
|
+
return false;
|
|
345
324
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return getObject()->_slotManager->setScalarSlot(SkString(slotID), scalar);
|
|
325
|
+
return getObject()->_slotManager->setScalarSlot(SkString(*slotID),
|
|
326
|
+
*scalar);
|
|
349
327
|
}
|
|
350
328
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
329
|
+
bool setVec2Slot(JsiOptional<std::string> slotID,
|
|
330
|
+
JsiOptional<SkPoint> point) {
|
|
331
|
+
if (!slotID.has_value() || !point.has_value()) {
|
|
332
|
+
return false;
|
|
354
333
|
}
|
|
355
|
-
auto slotID = arguments[0].asString(runtime).utf8(runtime);
|
|
356
|
-
auto point = JsiSkPoint::fromValue(runtime, arguments[1]);
|
|
357
334
|
SkV2 vec2{point->x(), point->y()};
|
|
358
|
-
return getObject()->_slotManager->setVec2Slot(SkString(slotID), vec2);
|
|
335
|
+
return getObject()->_slotManager->setVec2Slot(SkString(*slotID), vec2);
|
|
359
336
|
}
|
|
360
337
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
auto key = arguments[0].asString(runtime).utf8(runtime);
|
|
338
|
+
// The text value argument is intentionally not declared: the raw binding
|
|
339
|
+
// never read it (the method is not implemented yet).
|
|
340
|
+
bool setTextSlot(JsiOptional<std::string> key) {
|
|
366
341
|
// TODO: Implement proper text slot setting
|
|
367
|
-
return
|
|
342
|
+
return false;
|
|
368
343
|
}
|
|
369
344
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
345
|
+
bool setImageSlot(JsiOptional<std::string> slotID,
|
|
346
|
+
JsiOptional<std::string> assetName) {
|
|
347
|
+
if (!slotID.has_value() || !assetName.has_value()) {
|
|
348
|
+
return false;
|
|
373
349
|
}
|
|
374
|
-
auto slotID = arguments[0].asString(runtime).utf8(runtime);
|
|
375
|
-
auto assetName = arguments[1].asString(runtime).utf8(runtime);
|
|
376
350
|
return getObject()->_slotManager->setImageSlot(
|
|
377
|
-
SkString(slotID), getObject()->_resourceProvider->loadImageAsset(
|
|
378
|
-
|
|
351
|
+
SkString(*slotID), getObject()->_resourceProvider->loadImageAsset(
|
|
352
|
+
nullptr, assetName->data(), nullptr));
|
|
379
353
|
}
|
|
380
354
|
|
|
381
355
|
JSI_HOST_FUNCTION(getColorSlot) {
|
|
@@ -389,15 +363,15 @@ public:
|
|
|
389
363
|
return jsi::Value::null();
|
|
390
364
|
}
|
|
391
365
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
366
|
+
std::variant<double, std::nullptr_t>
|
|
367
|
+
getScalarSlot(JsiOptional<std::string> slotID) {
|
|
368
|
+
if (!slotID.has_value()) {
|
|
369
|
+
return nullptr;
|
|
395
370
|
}
|
|
396
|
-
auto
|
|
397
|
-
|
|
398
|
-
return jsi::Value(v.value());
|
|
371
|
+
if (auto v = getObject()->_slotManager->getScalarSlot(SkString(*slotID))) {
|
|
372
|
+
return static_cast<double>(v.value());
|
|
399
373
|
}
|
|
400
|
-
return
|
|
374
|
+
return nullptr;
|
|
401
375
|
}
|
|
402
376
|
|
|
403
377
|
JSI_HOST_FUNCTION(getVec2Slot) {
|
|
@@ -554,29 +528,45 @@ public:
|
|
|
554
528
|
return transformProps;
|
|
555
529
|
}
|
|
556
530
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
531
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
532
|
+
installCommon(runtime, prototype);
|
|
533
|
+
installMethod(runtime, prototype, "duration", &JsiSkSkottie::duration);
|
|
534
|
+
installMethod(runtime, prototype, "fps", &JsiSkSkottie::fps);
|
|
535
|
+
installMethod(runtime, prototype, "seekFrame", &JsiSkSkottie::seekFrame);
|
|
536
|
+
installMethod(runtime, prototype, "render", &JsiSkSkottie::render);
|
|
537
|
+
installMethod(runtime, prototype, "size", &JsiSkSkottie::size);
|
|
538
|
+
installMethod(runtime, prototype, "version", &JsiSkSkottie::version);
|
|
539
|
+
installHostMethod(runtime, prototype, "getSlotInfo",
|
|
540
|
+
&JsiSkSkottie::getSlotInfo);
|
|
541
|
+
installMethod(runtime, prototype, "setColorSlot",
|
|
542
|
+
&JsiSkSkottie::setColorSlot);
|
|
543
|
+
installMethod(runtime, prototype, "setScalarSlot",
|
|
544
|
+
&JsiSkSkottie::setScalarSlot);
|
|
545
|
+
installMethod(runtime, prototype, "setVec2Slot",
|
|
546
|
+
&JsiSkSkottie::setVec2Slot);
|
|
547
|
+
installMethod(runtime, prototype, "setTextSlot",
|
|
548
|
+
&JsiSkSkottie::setTextSlot);
|
|
549
|
+
installMethod(runtime, prototype, "setImageSlot",
|
|
550
|
+
&JsiSkSkottie::setImageSlot);
|
|
551
|
+
installHostMethod(runtime, prototype, "getColorSlot",
|
|
552
|
+
&JsiSkSkottie::getColorSlot);
|
|
553
|
+
installMethod(runtime, prototype, "getScalarSlot",
|
|
554
|
+
&JsiSkSkottie::getScalarSlot);
|
|
555
|
+
installHostMethod(runtime, prototype, "getVec2Slot",
|
|
556
|
+
&JsiSkSkottie::getVec2Slot);
|
|
557
|
+
installHostMethod(runtime, prototype, "getTextSlot",
|
|
558
|
+
&JsiSkSkottie::getTextSlot);
|
|
559
|
+
installHostMethod(runtime, prototype, "getColorProps",
|
|
560
|
+
&JsiSkSkottie::getColorProps);
|
|
561
|
+
installHostMethod(runtime, prototype, "getOpacityProps",
|
|
562
|
+
&JsiSkSkottie::getOpacityProps);
|
|
563
|
+
installHostMethod(runtime, prototype, "getTransformProps",
|
|
564
|
+
&JsiSkSkottie::getTransformProps);
|
|
565
|
+
installHostMethod(runtime, prototype, "getTextProps",
|
|
566
|
+
&JsiSkSkottie::getTextProps);
|
|
567
|
+
installMethod(runtime, prototype, "setColor", &JsiSkSkottie::setColor);
|
|
568
|
+
installMethod(runtime, prototype, "setText", &JsiSkSkottie::setText);
|
|
569
|
+
}
|
|
580
570
|
// #endregion
|
|
581
571
|
|
|
582
572
|
/**
|
|
@@ -584,10 +574,10 @@ public:
|
|
|
584
574
|
*/
|
|
585
575
|
JsiSkSkottie(std::shared_ptr<RNSkPlatformContext> context,
|
|
586
576
|
std::shared_ptr<ManagedAnimation> animation)
|
|
587
|
-
:
|
|
577
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiSkSkottie, ManagedAnimation>(
|
|
588
578
|
std::move(context), std::move(animation)) {}
|
|
589
579
|
|
|
590
|
-
size_t getMemoryPressure()
|
|
580
|
+
size_t getMemoryPressure() override {
|
|
591
581
|
auto animation = getObject();
|
|
592
582
|
if (!animation || !animation->_animation) {
|
|
593
583
|
return 1024; // Base size if no animation
|
|
@@ -615,7 +605,5 @@ public:
|
|
|
615
605
|
|
|
616
606
|
return animationMemory + baseOverhead;
|
|
617
607
|
}
|
|
618
|
-
|
|
619
|
-
std::string getObjectType() const override { return "JsiSkSkottie"; }
|
|
620
608
|
};
|
|
621
609
|
} // namespace RNSkia
|
package/cpp/api/JsiSkSurface.h
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
#include <jsi/jsi.h>
|
|
9
9
|
|
|
10
|
+
#include "JsiSkConverters.h"
|
|
10
11
|
#include "JsiSkDispatcher.h"
|
|
11
|
-
#include "
|
|
12
|
+
#include "JsiSkNativeObjects.h"
|
|
12
13
|
#include "JsiTextureInfo.h"
|
|
13
14
|
|
|
14
15
|
#include "JsiSkCanvas.h"
|
|
@@ -30,15 +31,18 @@ namespace RNSkia {
|
|
|
30
31
|
|
|
31
32
|
namespace jsi = facebook::jsi;
|
|
32
33
|
|
|
33
|
-
class JsiSkSurface
|
|
34
|
+
class JsiSkSurface
|
|
35
|
+
: public JsiSkWrappingSkPtrNativeObject<JsiSkSurface, SkSurface> {
|
|
34
36
|
private:
|
|
35
37
|
std::shared_ptr<Dispatcher> _dispatcher;
|
|
36
38
|
|
|
37
39
|
public:
|
|
40
|
+
static constexpr const char *CLASS_NAME = "Surface";
|
|
41
|
+
|
|
38
42
|
JsiSkSurface(std::shared_ptr<RNSkPlatformContext> context,
|
|
39
43
|
sk_sp<SkSurface> surface)
|
|
40
|
-
:
|
|
41
|
-
|
|
44
|
+
: JsiSkWrappingSkPtrNativeObject<JsiSkSurface, SkSurface>(
|
|
45
|
+
std::move(context), std::move(surface)) {
|
|
42
46
|
// Get the dispatcher for the current thread
|
|
43
47
|
_dispatcher = Dispatcher::getDispatcher();
|
|
44
48
|
// Process any pending operations
|
|
@@ -63,31 +67,26 @@ public:
|
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
EXPORT_JSI_API_TYPENAME(JsiSkSurface, Surface)
|
|
67
|
-
|
|
68
70
|
// TODO-API: Properties?
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return static_cast<double>(getObject()->height());
|
|
72
|
-
}
|
|
71
|
+
double width() { return static_cast<double>(getObject()->width()); }
|
|
72
|
+
double height() { return static_cast<double>(getObject()->height()); }
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
std::shared_ptr<JsiSkCanvas> getCanvas() {
|
|
75
75
|
auto surface = getObject();
|
|
76
76
|
auto canvas =
|
|
77
77
|
std::make_shared<JsiSkCanvas>(getContext(), surface->getCanvas());
|
|
78
78
|
// Keep a reference to the owning surface so the canvas can read pixels back
|
|
79
79
|
// through a snapshot on Graphite (which lacks synchronous canvas readback).
|
|
80
80
|
canvas->setSurface(surface);
|
|
81
|
-
return
|
|
82
|
-
getContext());
|
|
81
|
+
return canvas;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
void flush(JsiOptional<bool> syncParam) {
|
|
86
85
|
auto surface = getObject();
|
|
87
86
|
// When `sync` is true, block until the GPU has finished executing the
|
|
88
87
|
// submitted work. Required before a native consumer on a different command
|
|
89
88
|
// queue reads this surface's texture via getNativeTextureUnstable(). #3916
|
|
90
|
-
bool sync =
|
|
89
|
+
bool sync = syncParam.has_value() && *syncParam;
|
|
91
90
|
#if defined(SK_GRAPHITE)
|
|
92
91
|
// A raster surface (e.g. Skia.Surface.Make) has no Graphite recorder;
|
|
93
92
|
// only Graphite-backed surfaces need to snap and submit a recording.
|
|
@@ -102,7 +101,6 @@ public:
|
|
|
102
101
|
dContext->flushAndSubmit(sync ? GrSyncCpu::kYes : GrSyncCpu::kNo);
|
|
103
102
|
}
|
|
104
103
|
#endif
|
|
105
|
-
return jsi::Value::undefined();
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
JSI_HOST_FUNCTION(makeImageSnapshot) {
|
|
@@ -124,15 +122,12 @@ public:
|
|
|
124
122
|
}
|
|
125
123
|
#endif
|
|
126
124
|
if (count > 1 && arguments[1].isObject()) {
|
|
127
|
-
auto jsiImage =
|
|
128
|
-
arguments[1].asObject(runtime).asHostObject<JsiSkImage>(runtime);
|
|
125
|
+
auto jsiImage = getJsiObject<JsiSkImage>(runtime, arguments[1]);
|
|
129
126
|
jsiImage->setObject(image);
|
|
130
127
|
return jsi::Value(runtime, arguments[1]);
|
|
131
128
|
}
|
|
132
|
-
|
|
133
|
-
std::make_shared<JsiSkImage>(getContext(), std::move(image));
|
|
134
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
135
|
-
runtime, hostObjectInstance, getContext());
|
|
129
|
+
return makeJsiObject(
|
|
130
|
+
runtime, std::make_shared<JsiSkImage>(getContext(), std::move(image)));
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
JSI_HOST_FUNCTION(getNativeTextureUnstable) {
|
|
@@ -140,7 +135,7 @@ public:
|
|
|
140
135
|
return JsiTextureInfo::toValue(runtime, texInfo);
|
|
141
136
|
}
|
|
142
137
|
|
|
143
|
-
size_t getMemoryPressure()
|
|
138
|
+
size_t getMemoryPressure() override {
|
|
144
139
|
if (isDisposed()) {
|
|
145
140
|
return 0;
|
|
146
141
|
}
|
|
@@ -196,15 +191,17 @@ public:
|
|
|
196
191
|
return estimated;
|
|
197
192
|
}
|
|
198
193
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
194
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
195
|
+
installCommon(runtime, prototype);
|
|
196
|
+
installMethod(runtime, prototype, "width", &JsiSkSurface::width);
|
|
197
|
+
installMethod(runtime, prototype, "height", &JsiSkSurface::height);
|
|
198
|
+
installMethod(runtime, prototype, "getCanvas", &JsiSkSurface::getCanvas);
|
|
199
|
+
installHostMethod(runtime, prototype, "makeImageSnapshot",
|
|
200
|
+
&JsiSkSurface::makeImageSnapshot);
|
|
201
|
+
installMethod(runtime, prototype, "flush", &JsiSkSurface::flush);
|
|
202
|
+
installHostMethod(runtime, prototype, "getNativeTextureUnstable",
|
|
203
|
+
&JsiSkSurface::getNativeTextureUnstable);
|
|
204
|
+
}
|
|
208
205
|
};
|
|
209
206
|
|
|
210
207
|
} // namespace RNSkia
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
#include <utility>
|
|
5
|
+
#include <variant>
|
|
5
6
|
|
|
6
7
|
#include <jsi/jsi.h>
|
|
7
8
|
|
|
8
|
-
#include "
|
|
9
|
+
#include "JsiSkNativeObjects.h"
|
|
9
10
|
|
|
10
11
|
#include "JsiSkSurface.h"
|
|
11
12
|
|
|
@@ -20,20 +21,18 @@ namespace RNSkia {
|
|
|
20
21
|
|
|
21
22
|
namespace jsi = facebook::jsi;
|
|
22
23
|
|
|
23
|
-
class JsiSkSurfaceFactory : public
|
|
24
|
+
class JsiSkSurfaceFactory : public JsiSkNativeObject<JsiSkSurfaceFactory> {
|
|
24
25
|
public:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
static constexpr const char *CLASS_NAME = "SurfaceFactory";
|
|
27
|
+
|
|
28
|
+
std::variant<std::nullptr_t, std::shared_ptr<JsiSkSurface>> Make(int width,
|
|
29
|
+
int height) {
|
|
28
30
|
auto imageInfo = SkImageInfo::MakeN32Premul(width, height);
|
|
29
31
|
auto surface = SkSurfaces::Raster(imageInfo);
|
|
30
32
|
if (surface == nullptr) {
|
|
31
|
-
return
|
|
33
|
+
return nullptr;
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
std::make_shared<JsiSkSurface>(getContext(), std::move(surface));
|
|
35
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
36
|
-
runtime, hostObjectInstance, getContext());
|
|
35
|
+
return std::make_shared<JsiSkSurface>(getContext(), std::move(surface));
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
JSI_HOST_FUNCTION(MakeOffscreen) {
|
|
@@ -56,21 +55,20 @@ public:
|
|
|
56
55
|
if (surface == nullptr) {
|
|
57
56
|
return jsi::Value::null();
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
62
|
-
runtime, hostObjectInstance, getContext());
|
|
58
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkSurface>(
|
|
59
|
+
getContext(), std::move(surface)));
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
JSI_EXPORT_FUNC(JsiSkSurfaceFactory, MakeOffscreen))
|
|
67
|
-
|
|
68
|
-
size_t getMemoryPressure() const override { return 2048; }
|
|
62
|
+
size_t getMemoryPressure() override { return 2048; }
|
|
69
63
|
|
|
70
|
-
|
|
64
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
65
|
+
installMethod(runtime, prototype, "Make", &JsiSkSurfaceFactory::Make);
|
|
66
|
+
installHostMethod(runtime, prototype, "MakeOffscreen",
|
|
67
|
+
&JsiSkSurfaceFactory::MakeOffscreen);
|
|
68
|
+
}
|
|
71
69
|
|
|
72
70
|
explicit JsiSkSurfaceFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
73
|
-
:
|
|
71
|
+
: JsiSkNativeObject<JsiSkSurfaceFactory>(std::move(context)) {}
|
|
74
72
|
};
|
|
75
73
|
|
|
76
74
|
} // namespace RNSkia
|
package/cpp/api/JsiSkTextBlob.h
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
9
9
|
|
|
10
10
|
#pragma clang diagnostic push
|
|
11
11
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -18,14 +18,17 @@ namespace RNSkia {
|
|
|
18
18
|
|
|
19
19
|
namespace jsi = facebook::jsi;
|
|
20
20
|
|
|
21
|
-
class JsiSkTextBlob
|
|
21
|
+
class JsiSkTextBlob
|
|
22
|
+
: public JsiSkWrappingSkPtrNativeObject<JsiSkTextBlob, SkTextBlob> {
|
|
22
23
|
public:
|
|
24
|
+
static constexpr const char *CLASS_NAME = "TextBlob";
|
|
25
|
+
|
|
23
26
|
JsiSkTextBlob(std::shared_ptr<RNSkPlatformContext> context,
|
|
24
27
|
sk_sp<SkTextBlob> shader)
|
|
25
|
-
:
|
|
26
|
-
|
|
28
|
+
: JsiSkWrappingSkPtrNativeObject<JsiSkTextBlob, SkTextBlob>(
|
|
29
|
+
std::move(context), std::move(shader)) {}
|
|
27
30
|
|
|
28
|
-
size_t getMemoryPressure()
|
|
31
|
+
size_t getMemoryPressure() override {
|
|
29
32
|
auto textBlob = getObject();
|
|
30
33
|
if (!textBlob)
|
|
31
34
|
return 0;
|
|
@@ -37,9 +40,13 @@ public:
|
|
|
37
40
|
1024; // Area estimation + base overhead
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
static sk_sp<SkTextBlob> fromValue(jsi::Runtime &runtime,
|
|
44
|
+
const jsi::Value &obj) {
|
|
45
|
+
return objectFromValue(runtime, obj);
|
|
46
|
+
}
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
49
|
+
installCommon(runtime, prototype);
|
|
50
|
+
}
|
|
44
51
|
};
|
|
45
52
|
} // namespace RNSkia
|