@shopify/react-native-skia 2.9.1-next.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +1 -5
- package/android/cpp/jni/JniWebGPUView.cpp +52 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +3 -1
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +11 -5
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +10 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +7 -2
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +1 -1
- package/apple/WebGPUMetalView.mm +49 -6
- package/cpp/api/JsiNativeBuffer.h +15 -10
- package/cpp/api/JsiSkAnimatedImage.h +21 -19
- package/cpp/api/JsiSkAnimatedImageFactory.h +13 -14
- package/cpp/api/JsiSkApi.h +246 -92
- package/cpp/api/JsiSkCanvas.h +76 -58
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +45 -45
- package/cpp/api/JsiSkContourMeasure.h +24 -21
- package/cpp/api/JsiSkContourMeasureIter.h +18 -21
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +22 -21
- package/cpp/api/JsiSkFont.h +56 -44
- package/cpp/api/JsiSkFontMgr.h +22 -13
- package/cpp/api/JsiSkFontMgrFactory.h +12 -10
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +45 -34
- package/cpp/api/JsiSkImageFactory.h +47 -52
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +96 -96
- package/cpp/api/JsiSkImageInfo.h +22 -19
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +16 -13
- package/cpp/api/JsiSkMatrix.h +31 -31
- package/cpp/api/JsiSkNativeObjects.h +419 -0
- package/cpp/api/JsiSkPaint.h +59 -39
- package/cpp/api/JsiSkParagraph.h +39 -32
- package/cpp/api/JsiSkParagraphBuilder.h +24 -21
- package/cpp/api/JsiSkParagraphBuilderFactory.h +13 -12
- package/cpp/api/JsiSkParagraphStyle.h +20 -10
- package/cpp/api/JsiSkPath.h +95 -70
- package/cpp/api/JsiSkPathBuilder.h +83 -67
- package/cpp/api/JsiSkPathBuilderFactory.h +16 -17
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +33 -32
- package/cpp/api/JsiSkPathFactory.h +79 -103
- package/cpp/api/JsiSkPicture.h +24 -13
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +21 -22
- package/cpp/api/JsiSkPoint.h +19 -22
- package/cpp/api/JsiSkRRect.h +22 -29
- package/cpp/api/JsiSkRSXform.h +26 -30
- package/cpp/api/JsiSkRect.h +28 -30
- package/cpp/api/JsiSkRuntimeEffect.h +39 -30
- package/cpp/api/JsiSkRuntimeEffectFactory.h +12 -12
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +25 -18
- package/cpp/api/JsiSkSVG.h +13 -13
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +41 -48
- package/cpp/api/JsiSkSkottie.h +49 -39
- package/cpp/api/JsiSkStrutStyle.h +18 -8
- package/cpp/api/JsiSkSurface.h +24 -24
- package/cpp/api/JsiSkSurfaceFactory.h +15 -16
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +25 -28
- package/cpp/api/JsiSkTextStyle.h +34 -24
- package/cpp/api/JsiSkTypeface.h +19 -12
- package/cpp/api/JsiSkTypefaceFactory.h +12 -12
- package/cpp/api/JsiSkTypefaceFontProvider.h +30 -25
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +14 -12
- package/cpp/api/JsiSkVertices.h +21 -18
- package/cpp/api/JsiSkiaContext.h +17 -17
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +27 -25
- 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}/NativeObject.h +120 -146
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +29 -25
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/rnwgpu/ArrayBuffer.h +5 -6
- package/cpp/rnwgpu/Canvas.h +4 -2
- package/cpp/rnwgpu/SurfaceRegistry.h +469 -131
- package/cpp/rnwgpu/api/GPU.cpp +4 -4
- package/cpp/rnwgpu/api/GPU.h +1 -1
- package/cpp/rnwgpu/api/GPUAdapter.cpp +12 -6
- package/cpp/rnwgpu/api/GPUAdapter.h +5 -4
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroup.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUBuffer.cpp +12 -2
- package/cpp/rnwgpu/api/GPUBuffer.h +4 -3
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +33 -19
- package/cpp/rnwgpu/api/GPUCanvasContext.h +4 -2
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +1 -1
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUDevice.cpp +38 -24
- package/cpp/rnwgpu/api/GPUDevice.h +12 -10
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUError.h +1 -1
- package/cpp/rnwgpu/api/GPUExtent3D.h +1 -1
- package/cpp/rnwgpu/api/GPUExternalTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUInternalError.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin2D.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin3D.h +1 -1
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +1 -1
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUQuerySet.h +1 -1
- package/cpp/rnwgpu/api/GPUQueue.cpp +6 -2
- package/cpp/rnwgpu/api/GPUQueue.h +4 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +1 -1
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUSampler.h +1 -1
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +8 -3
- package/cpp/rnwgpu/api/GPUShaderModule.h +4 -4
- package/cpp/rnwgpu/api/GPUSharedFence.h +1 -1
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +1 -1
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +1 -1
- package/cpp/rnwgpu/api/GPUTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUTextureView.h +1 -1
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +1 -1
- package/cpp/rnwgpu/api/GPUValidationError.h +1 -1
- package/cpp/rnwgpu/api/ImageBitmap.h +1 -1
- package/cpp/rnwgpu/api/RNWebGPU.h +21 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +1 -1
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +20 -21
- package/cpp/rnwgpu/async/RuntimeContext.cpp +5 -0
- package/cpp/rnwgpu/async/RuntimeContext.h +15 -2
- 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/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/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +1 -0
- package/lib/commonjs/views/WebGPUCanvas.js +13 -0
- package/lib/commonjs/views/WebGPUCanvas.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/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/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/WebGPUCanvas.d.ts +1 -0
- package/lib/module/views/WebGPUCanvas.js +14 -1
- package/lib/module/views/WebGPUCanvas.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- 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/views/WebGPUCanvas.d.ts +1 -0
- package/package.json +12 -8
- package/react-native-skia.podspec +1 -2
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/WebGPUCanvas.tsx +17 -1
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
- package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
- package/cpp/dawn/include/dawn/dawn_version.h +0 -41
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -86
- package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/DawnNative.h +0 -369
- package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -210
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
- package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2844
- package/cpp/dawn/include/tint/tint.h +0 -90
- package/cpp/dawn/include/webgpu/webgpu.h +0 -4987
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10080
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -161
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
- package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
- package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
- package/libs/.graphite +0 -1
- /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
#include <jsi/jsi.h>
|
|
8
8
|
|
|
9
|
-
#include "JsiSkHostObjects.h"
|
|
10
9
|
#include "JsiSkMatrix.h"
|
|
10
|
+
#include "JsiSkNativeObjects.h"
|
|
11
11
|
#include "JsiSkPath.h"
|
|
12
12
|
#include "JsiSkPoint.h"
|
|
13
13
|
#include "JsiSkRRect.h"
|
|
@@ -27,8 +27,11 @@ namespace RNSkia {
|
|
|
27
27
|
namespace jsi = facebook::jsi;
|
|
28
28
|
|
|
29
29
|
class JsiSkPathBuilder
|
|
30
|
-
: public
|
|
30
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiSkPathBuilder,
|
|
31
|
+
SkPathBuilder> {
|
|
31
32
|
public:
|
|
33
|
+
static constexpr const char *CLASS_NAME = "PathBuilder";
|
|
34
|
+
|
|
32
35
|
// Movement methods
|
|
33
36
|
JSI_HOST_FUNCTION(moveTo) {
|
|
34
37
|
SkScalar x = arguments[0].asNumber();
|
|
@@ -299,9 +302,8 @@ public:
|
|
|
299
302
|
JSI_HOST_FUNCTION(computeBounds) {
|
|
300
303
|
auto path = getObject()->snapshot();
|
|
301
304
|
auto result = path.getBounds();
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
runtime, hostObjectInstance, getContext());
|
|
305
|
+
return makeJsiObject(runtime,
|
|
306
|
+
std::make_shared<JsiSkRect>(getContext(), result));
|
|
305
307
|
}
|
|
306
308
|
|
|
307
309
|
JSI_HOST_FUNCTION(isEmpty) {
|
|
@@ -326,73 +328,91 @@ public:
|
|
|
326
328
|
JSI_HOST_FUNCTION(build) {
|
|
327
329
|
// snapshot() returns a copy without resetting the builder
|
|
328
330
|
auto path = getObject()->snapshot();
|
|
329
|
-
|
|
330
|
-
std::make_shared<JsiSkPath>(getContext(), std::move(path));
|
|
331
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
332
|
-
runtime, hostObjectInstance, getContext());
|
|
331
|
+
return makeJsiObject(
|
|
332
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(path)));
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
JSI_HOST_FUNCTION(detach) {
|
|
336
336
|
// detach() returns the path and resets the builder
|
|
337
337
|
auto path = getObject()->detach();
|
|
338
|
-
|
|
339
|
-
std::make_shared<JsiSkPath>(getContext(), std::move(path));
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
338
|
+
return makeJsiObject(
|
|
339
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(path)));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
343
|
+
installCommon(runtime, prototype);
|
|
344
|
+
// Movement
|
|
345
|
+
installHostMethod(runtime, prototype, "moveTo", &JsiSkPathBuilder::moveTo);
|
|
346
|
+
installHostMethod(runtime, prototype, "rMoveTo",
|
|
347
|
+
&JsiSkPathBuilder::rMoveTo);
|
|
348
|
+
installHostMethod(runtime, prototype, "lineTo", &JsiSkPathBuilder::lineTo);
|
|
349
|
+
installHostMethod(runtime, prototype, "rLineTo",
|
|
350
|
+
&JsiSkPathBuilder::rLineTo);
|
|
351
|
+
// Curves
|
|
352
|
+
installHostMethod(runtime, prototype, "quadTo", &JsiSkPathBuilder::quadTo);
|
|
353
|
+
installHostMethod(runtime, prototype, "rQuadTo",
|
|
354
|
+
&JsiSkPathBuilder::rQuadTo);
|
|
355
|
+
installHostMethod(runtime, prototype, "conicTo",
|
|
356
|
+
&JsiSkPathBuilder::conicTo);
|
|
357
|
+
installHostMethod(runtime, prototype, "rConicTo",
|
|
358
|
+
&JsiSkPathBuilder::rConicTo);
|
|
359
|
+
installHostMethod(runtime, prototype, "cubicTo",
|
|
360
|
+
&JsiSkPathBuilder::cubicTo);
|
|
361
|
+
installHostMethod(runtime, prototype, "rCubicTo",
|
|
362
|
+
&JsiSkPathBuilder::rCubicTo);
|
|
363
|
+
installHostMethod(runtime, prototype, "close", &JsiSkPathBuilder::close);
|
|
364
|
+
// Arcs
|
|
365
|
+
installHostMethod(runtime, prototype, "arcToOval",
|
|
366
|
+
&JsiSkPathBuilder::arcToOval);
|
|
367
|
+
installHostMethod(runtime, prototype, "arcToRotated",
|
|
368
|
+
&JsiSkPathBuilder::arcToRotated);
|
|
369
|
+
installHostMethod(runtime, prototype, "rArcTo", &JsiSkPathBuilder::rArcTo);
|
|
370
|
+
installHostMethod(runtime, prototype, "arcToTangent",
|
|
371
|
+
&JsiSkPathBuilder::arcToTangent);
|
|
372
|
+
// Shapes
|
|
373
|
+
installHostMethod(runtime, prototype, "addRect",
|
|
374
|
+
&JsiSkPathBuilder::addRect);
|
|
375
|
+
installHostMethod(runtime, prototype, "addOval",
|
|
376
|
+
&JsiSkPathBuilder::addOval);
|
|
377
|
+
installHostMethod(runtime, prototype, "addArc", &JsiSkPathBuilder::addArc);
|
|
378
|
+
installHostMethod(runtime, prototype, "addRRect",
|
|
379
|
+
&JsiSkPathBuilder::addRRect);
|
|
380
|
+
installHostMethod(runtime, prototype, "addCircle",
|
|
381
|
+
&JsiSkPathBuilder::addCircle);
|
|
382
|
+
installHostMethod(runtime, prototype, "addPoly",
|
|
383
|
+
&JsiSkPathBuilder::addPoly);
|
|
384
|
+
installHostMethod(runtime, prototype, "addPath",
|
|
385
|
+
&JsiSkPathBuilder::addPath);
|
|
386
|
+
// Config
|
|
387
|
+
installHostMethod(runtime, prototype, "setFillType",
|
|
388
|
+
&JsiSkPathBuilder::setFillType);
|
|
389
|
+
installHostMethod(runtime, prototype, "setIsVolatile",
|
|
390
|
+
&JsiSkPathBuilder::setIsVolatile);
|
|
391
|
+
installHostMethod(runtime, prototype, "reset", &JsiSkPathBuilder::reset);
|
|
392
|
+
installHostMethod(runtime, prototype, "offset", &JsiSkPathBuilder::offset);
|
|
393
|
+
installHostMethod(runtime, prototype, "transform",
|
|
394
|
+
&JsiSkPathBuilder::transform);
|
|
395
|
+
// Query
|
|
396
|
+
installHostMethod(runtime, prototype, "computeBounds",
|
|
397
|
+
&JsiSkPathBuilder::computeBounds);
|
|
398
|
+
installHostMethod(runtime, prototype, "isEmpty",
|
|
399
|
+
&JsiSkPathBuilder::isEmpty);
|
|
400
|
+
installHostMethod(runtime, prototype, "getLastPt",
|
|
401
|
+
&JsiSkPathBuilder::getLastPt);
|
|
402
|
+
installHostMethod(runtime, prototype, "countPoints",
|
|
403
|
+
&JsiSkPathBuilder::countPoints);
|
|
404
|
+
// Build
|
|
405
|
+
installHostMethod(runtime, prototype, "build", &JsiSkPathBuilder::build);
|
|
406
|
+
installHostMethod(runtime, prototype, "detach", &JsiSkPathBuilder::detach);
|
|
407
|
+
}
|
|
388
408
|
|
|
389
409
|
JsiSkPathBuilder(std::shared_ptr<RNSkPlatformContext> context,
|
|
390
410
|
SkPathBuilder builder)
|
|
391
|
-
:
|
|
411
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiSkPathBuilder, SkPathBuilder>(
|
|
392
412
|
std::move(context),
|
|
393
413
|
std::make_shared<SkPathBuilder>(std::move(builder))) {}
|
|
394
414
|
|
|
395
|
-
size_t getMemoryPressure()
|
|
415
|
+
size_t getMemoryPressure() override {
|
|
396
416
|
auto builder = getObject();
|
|
397
417
|
if (!builder)
|
|
398
418
|
return 0;
|
|
@@ -400,15 +420,11 @@ public:
|
|
|
400
420
|
return builder->snapshot().approximateBytesUsed();
|
|
401
421
|
}
|
|
402
422
|
|
|
403
|
-
std::string getObjectType() const override { return "JsiSkPathBuilder"; }
|
|
404
|
-
|
|
405
423
|
static jsi::Value toValue(jsi::Runtime &runtime,
|
|
406
424
|
std::shared_ptr<RNSkPlatformContext> context,
|
|
407
425
|
const SkPathBuilder &builder) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
411
|
-
runtime, hostObjectInstance, context);
|
|
426
|
+
return makeJsiObject(runtime,
|
|
427
|
+
std::make_shared<JsiSkPathBuilder>(context, builder));
|
|
412
428
|
}
|
|
413
429
|
};
|
|
414
430
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
9
9
|
#include "JsiSkPathBuilder.h"
|
|
10
10
|
|
|
11
11
|
#pragma clang diagnostic push
|
|
@@ -20,34 +20,33 @@ namespace RNSkia {
|
|
|
20
20
|
|
|
21
21
|
namespace jsi = facebook::jsi;
|
|
22
22
|
|
|
23
|
-
class JsiSkPathBuilderFactory
|
|
23
|
+
class JsiSkPathBuilderFactory
|
|
24
|
+
: public JsiSkNativeObject<JsiSkPathBuilderFactory> {
|
|
24
25
|
public:
|
|
26
|
+
static constexpr const char *CLASS_NAME = "PathBuilderFactory";
|
|
27
|
+
|
|
25
28
|
JSI_HOST_FUNCTION(Make) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
29
|
-
runtime, hostObjectInstance, getContext());
|
|
29
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPathBuilder>(
|
|
30
|
+
getContext(), SkPathBuilder()));
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
JSI_HOST_FUNCTION(MakeFromPath) {
|
|
33
34
|
auto path = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
37
|
-
runtime, hostObjectInstance, getContext());
|
|
35
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPathBuilder>(
|
|
36
|
+
getContext(), SkPathBuilder(*path)));
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
size_t getMemoryPressure()
|
|
39
|
+
size_t getMemoryPressure() override { return 1024; }
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
42
|
+
installHostMethod(runtime, prototype, "Make",
|
|
43
|
+
&JsiSkPathBuilderFactory::Make);
|
|
44
|
+
installHostMethod(runtime, prototype, "MakeFromPath",
|
|
45
|
+
&JsiSkPathBuilderFactory::MakeFromPath);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPathBuilderFactory, Make),
|
|
47
|
-
JSI_EXPORT_FUNC(JsiSkPathBuilderFactory, MakeFromPath))
|
|
48
|
-
|
|
49
48
|
explicit JsiSkPathBuilderFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
50
|
-
:
|
|
49
|
+
: JsiSkNativeObject<JsiSkPathBuilderFactory>(std::move(context)) {}
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
} // namespace RNSkia
|
|
@@ -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,19 +18,29 @@ namespace RNSkia {
|
|
|
18
18
|
|
|
19
19
|
namespace jsi = facebook::jsi;
|
|
20
20
|
|
|
21
|
-
class JsiSkPathEffect
|
|
21
|
+
class JsiSkPathEffect
|
|
22
|
+
: public JsiSkWrappingSkPtrNativeObject<JsiSkPathEffect, SkPathEffect> {
|
|
22
23
|
public:
|
|
24
|
+
static constexpr const char *CLASS_NAME = "PathEffect";
|
|
25
|
+
|
|
23
26
|
JsiSkPathEffect(std::shared_ptr<RNSkPlatformContext> context,
|
|
24
27
|
sk_sp<SkPathEffect> pathEffect)
|
|
25
|
-
:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
size_t getMemoryPressure()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
: JsiSkWrappingSkPtrNativeObject<JsiSkPathEffect, SkPathEffect>(
|
|
29
|
+
std::move(context), std::move(pathEffect)) {}
|
|
30
|
+
|
|
31
|
+
size_t getMemoryPressure() override { return 2048; }
|
|
32
|
+
|
|
33
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
34
|
+
installCommon(runtime, prototype);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Returns the underlying object from a host object of this type
|
|
39
|
+
*/
|
|
40
|
+
static sk_sp<SkPathEffect> fromValue(jsi::Runtime &runtime,
|
|
41
|
+
const jsi::Value &obj) {
|
|
42
|
+
return objectFromValue(runtime, obj);
|
|
43
|
+
}
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
} // namespace RNSkia
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#include <jsi/jsi.h>
|
|
8
8
|
|
|
9
|
-
#include "
|
|
9
|
+
#include "JsiSkNativeObjects.h"
|
|
10
10
|
#include "JsiSkPathEffect.h"
|
|
11
11
|
|
|
12
12
|
#pragma clang diagnostic push
|
|
@@ -25,14 +25,16 @@ namespace RNSkia {
|
|
|
25
25
|
|
|
26
26
|
namespace jsi = facebook::jsi;
|
|
27
27
|
|
|
28
|
-
class JsiSkPathEffectFactory
|
|
28
|
+
class JsiSkPathEffectFactory
|
|
29
|
+
: public JsiSkNativeObject<JsiSkPathEffectFactory> {
|
|
29
30
|
public:
|
|
31
|
+
static constexpr const char *CLASS_NAME = "PathEffectFactory";
|
|
32
|
+
|
|
30
33
|
JSI_HOST_FUNCTION(MakeCorner) {
|
|
31
34
|
int radius = arguments[0].asNumber();
|
|
32
35
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
33
36
|
getContext(), SkCornerPathEffect::Make(radius));
|
|
34
|
-
return
|
|
35
|
-
getContext());
|
|
37
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
JSI_HOST_FUNCTION(MakeDash) {
|
|
@@ -51,8 +53,7 @@ public:
|
|
|
51
53
|
auto i = SkSpan(intervals.data(), intervals.size());
|
|
52
54
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
53
55
|
getContext(), SkDashPathEffect::Make(i, phase));
|
|
54
|
-
return
|
|
55
|
-
getContext());
|
|
56
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
JSI_HOST_FUNCTION(MakeDiscrete) {
|
|
@@ -61,8 +62,7 @@ public:
|
|
|
61
62
|
int seedAssist = arguments[2].asNumber();
|
|
62
63
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
63
64
|
getContext(), SkDiscretePathEffect::Make(segLength, dec, seedAssist));
|
|
64
|
-
return
|
|
65
|
-
getContext());
|
|
65
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
JSI_HOST_FUNCTION(MakeCompose) {
|
|
@@ -71,8 +71,7 @@ public:
|
|
|
71
71
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
72
72
|
getContext(),
|
|
73
73
|
SkPathEffect::MakeCompose(std::move(outer), std::move(inner)));
|
|
74
|
-
return
|
|
75
|
-
getContext());
|
|
74
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
JSI_HOST_FUNCTION(MakeSum) {
|
|
@@ -81,8 +80,7 @@ public:
|
|
|
81
80
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
82
81
|
getContext(),
|
|
83
82
|
SkPathEffect::MakeSum(std::move(outer), std::move(inner)));
|
|
84
|
-
return
|
|
85
|
-
getContext());
|
|
83
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
JSI_HOST_FUNCTION(MakePath1D) {
|
|
@@ -94,8 +92,7 @@ public:
|
|
|
94
92
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
95
93
|
getContext(),
|
|
96
94
|
SkPath1DPathEffect::Make(path->snapshot(), advance, phase, style));
|
|
97
|
-
return
|
|
98
|
-
getContext());
|
|
95
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
JSI_HOST_FUNCTION(MakePath2D) {
|
|
@@ -103,8 +100,7 @@ public:
|
|
|
103
100
|
auto path = JsiSkPath::fromValue(runtime, arguments[1]);
|
|
104
101
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
105
102
|
getContext(), SkPath2DPathEffect::Make(*matrix, path->snapshot()));
|
|
106
|
-
return
|
|
107
|
-
getContext());
|
|
103
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
JSI_HOST_FUNCTION(MakeLine2D) {
|
|
@@ -112,27 +108,32 @@ public:
|
|
|
112
108
|
auto matrix = JsiSkMatrix::fromValue(runtime, arguments[1]);
|
|
113
109
|
auto pathEffect = std::make_shared<JsiSkPathEffect>(
|
|
114
110
|
getContext(), SkLine2DPathEffect::Make(width, *matrix));
|
|
115
|
-
return
|
|
116
|
-
getContext());
|
|
111
|
+
return makeJsiObject(runtime, std::move(pathEffect));
|
|
117
112
|
}
|
|
118
113
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
114
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
115
|
+
installHostMethod(runtime, prototype, "MakeCorner",
|
|
116
|
+
&JsiSkPathEffectFactory::MakeCorner);
|
|
117
|
+
installHostMethod(runtime, prototype, "MakeDash",
|
|
118
|
+
&JsiSkPathEffectFactory::MakeDash);
|
|
119
|
+
installHostMethod(runtime, prototype, "MakeDiscrete",
|
|
120
|
+
&JsiSkPathEffectFactory::MakeDiscrete);
|
|
121
|
+
installHostMethod(runtime, prototype, "MakeCompose",
|
|
122
|
+
&JsiSkPathEffectFactory::MakeCompose);
|
|
123
|
+
installHostMethod(runtime, prototype, "MakeSum",
|
|
124
|
+
&JsiSkPathEffectFactory::MakeSum);
|
|
125
|
+
installHostMethod(runtime, prototype, "MakeLine2D",
|
|
126
|
+
&JsiSkPathEffectFactory::MakeLine2D);
|
|
127
|
+
installHostMethod(runtime, prototype, "MakePath1D",
|
|
128
|
+
&JsiSkPathEffectFactory::MakePath1D);
|
|
129
|
+
installHostMethod(runtime, prototype, "MakePath2D",
|
|
130
|
+
&JsiSkPathEffectFactory::MakePath2D);
|
|
132
131
|
}
|
|
133
132
|
|
|
133
|
+
size_t getMemoryPressure() override { return 1024; }
|
|
134
|
+
|
|
134
135
|
explicit JsiSkPathEffectFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
135
|
-
:
|
|
136
|
+
: JsiSkNativeObject<JsiSkPathEffectFactory>(std::move(context)) {}
|
|
136
137
|
};
|
|
137
138
|
|
|
138
139
|
} // namespace RNSkia
|