@shopify/react-native-skia 2.9.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/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/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/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/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 +23 -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/api/GPU.cpp +4 -4
- package/cpp/rnwgpu/api/GPU.h +1 -1
- package/cpp/rnwgpu/api/GPUAdapter.cpp +2 -3
- package/cpp/rnwgpu/api/GPUAdapter.h +4 -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.h +1 -1
- package/cpp/rnwgpu/api/GPUCanvasContext.h +1 -1
- 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 +6 -7
- package/cpp/rnwgpu/api/GPUDevice.h +3 -3
- 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.h +1 -1
- 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 +1 -1
- package/cpp/rnwgpu/api/GPUShaderModule.h +1 -1
- 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 +1 -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/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/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/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/package.json +6 -2
- 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/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#include <jsi/jsi.h>
|
|
9
9
|
|
|
10
|
-
#include "JsiSkHostObjects.h"
|
|
11
10
|
#include "JsiSkMatrix.h"
|
|
11
|
+
#include "JsiSkNativeObjects.h"
|
|
12
12
|
#include "JsiSkPathEffect.h"
|
|
13
13
|
#include "JsiSkPoint.h"
|
|
14
14
|
#include "JsiSkRRect.h"
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#pragma clang diagnostic push
|
|
18
18
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
19
19
|
|
|
20
|
-
#include "utils/RNSkLog.h"
|
|
21
20
|
#include "include/core/SkPath.h"
|
|
22
21
|
#include "include/core/SkPathBuilder.h"
|
|
23
22
|
#include "include/core/SkPathUtils.h"
|
|
@@ -26,6 +25,7 @@
|
|
|
26
25
|
#include "include/effects/SkTrimPathEffect.h"
|
|
27
26
|
#include "include/pathops/SkPathOps.h"
|
|
28
27
|
#include "include/utils/SkTextUtils.h"
|
|
28
|
+
#include "utils/RNSkLog.h"
|
|
29
29
|
|
|
30
30
|
#pragma clang diagnostic pop
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ namespace RNSkia {
|
|
|
33
33
|
|
|
34
34
|
namespace jsi = facebook::jsi;
|
|
35
35
|
|
|
36
|
-
class JsiSkPathFactory : public
|
|
36
|
+
class JsiSkPathFactory : public JsiSkNativeObject<JsiSkPathFactory> {
|
|
37
37
|
|
|
38
38
|
static const int MOVE = 0;
|
|
39
39
|
static const int LINE = 1;
|
|
@@ -43,11 +43,11 @@ class JsiSkPathFactory : public JsiSkHostObject {
|
|
|
43
43
|
static const int CLOSE = 5;
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
|
+
static constexpr const char *CLASS_NAME = "PathFactory";
|
|
47
|
+
|
|
46
48
|
JSI_HOST_FUNCTION(Make) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
50
|
-
runtime, hostObjectInstance, getContext());
|
|
49
|
+
return makeJsiObject(runtime,
|
|
50
|
+
std::make_shared<JsiSkPath>(getContext(), SkPath()));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
JSI_HOST_FUNCTION(MakeFromSVGString) {
|
|
@@ -57,10 +57,8 @@ public:
|
|
|
57
57
|
throw jsi::JSError(runtime, "Could not parse Svg path");
|
|
58
58
|
return jsi::Value(nullptr);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
63
|
-
runtime, hostObjectInstance, getContext());
|
|
60
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(
|
|
61
|
+
getContext(), std::move(result.value())));
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
JSI_HOST_FUNCTION(MakeFromOp) {
|
|
@@ -71,10 +69,8 @@ public:
|
|
|
71
69
|
if (!result.has_value()) {
|
|
72
70
|
return jsi::Value(nullptr);
|
|
73
71
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
77
|
-
runtime, hostObjectInstance, getContext());
|
|
72
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(
|
|
73
|
+
getContext(), std::move(result.value())));
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
JSI_HOST_FUNCTION(MakeFromCmds) {
|
|
@@ -159,10 +155,8 @@ public:
|
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
|
-
|
|
163
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
164
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
165
|
-
runtime, hostObjectInstance, getContext());
|
|
158
|
+
return makeJsiObject(
|
|
159
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
166
160
|
}
|
|
167
161
|
|
|
168
162
|
JSI_HOST_FUNCTION(MakeFromText) {
|
|
@@ -173,10 +167,8 @@ public:
|
|
|
173
167
|
SkPath path;
|
|
174
168
|
SkTextUtils::GetPath(text.c_str(), strlen(text.c_str()),
|
|
175
169
|
SkTextEncoding::kUTF8, x, y, *font, &path);
|
|
176
|
-
|
|
177
|
-
std::make_shared<JsiSkPath>(getContext(), std::move(path));
|
|
178
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
179
|
-
runtime, hostObjectInstance, getContext());
|
|
170
|
+
return makeJsiObject(
|
|
171
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(path)));
|
|
180
172
|
}
|
|
181
173
|
|
|
182
174
|
// Static shape factories
|
|
@@ -188,10 +180,8 @@ public:
|
|
|
188
180
|
}
|
|
189
181
|
SkPathBuilder builder;
|
|
190
182
|
builder.addRect(*rect, direction);
|
|
191
|
-
|
|
192
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
193
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
194
|
-
runtime, hostObjectInstance, getContext());
|
|
183
|
+
return makeJsiObject(
|
|
184
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
195
185
|
}
|
|
196
186
|
|
|
197
187
|
JSI_HOST_FUNCTION(Oval) {
|
|
@@ -203,10 +193,8 @@ public:
|
|
|
203
193
|
unsigned startIndex = count < 3 ? 0 : arguments[2].asNumber();
|
|
204
194
|
SkPathBuilder builder;
|
|
205
195
|
builder.addOval(*rect, direction, startIndex);
|
|
206
|
-
|
|
207
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
208
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
209
|
-
runtime, hostObjectInstance, getContext());
|
|
196
|
+
return makeJsiObject(
|
|
197
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
210
198
|
}
|
|
211
199
|
|
|
212
200
|
JSI_HOST_FUNCTION(Circle) {
|
|
@@ -215,10 +203,8 @@ public:
|
|
|
215
203
|
auto r = arguments[2].asNumber();
|
|
216
204
|
SkPathBuilder builder;
|
|
217
205
|
builder.addCircle(x, y, r);
|
|
218
|
-
|
|
219
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
220
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
221
|
-
runtime, hostObjectInstance, getContext());
|
|
206
|
+
return makeJsiObject(
|
|
207
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
222
208
|
}
|
|
223
209
|
|
|
224
210
|
JSI_HOST_FUNCTION(RRect) {
|
|
@@ -229,10 +215,8 @@ public:
|
|
|
229
215
|
}
|
|
230
216
|
SkPathBuilder builder;
|
|
231
217
|
builder.addRRect(*rrect, direction);
|
|
232
|
-
|
|
233
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
234
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
235
|
-
runtime, hostObjectInstance, getContext());
|
|
218
|
+
return makeJsiObject(
|
|
219
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
236
220
|
}
|
|
237
221
|
|
|
238
222
|
JSI_HOST_FUNCTION(Line) {
|
|
@@ -241,10 +225,8 @@ public:
|
|
|
241
225
|
SkPathBuilder builder;
|
|
242
226
|
builder.moveTo(*p1);
|
|
243
227
|
builder.lineTo(*p2);
|
|
244
|
-
|
|
245
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
246
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
247
|
-
runtime, hostObjectInstance, getContext());
|
|
228
|
+
return makeJsiObject(
|
|
229
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
248
230
|
}
|
|
249
231
|
|
|
250
232
|
JSI_HOST_FUNCTION(Polygon) {
|
|
@@ -260,10 +242,8 @@ public:
|
|
|
260
242
|
}
|
|
261
243
|
SkPathBuilder builder;
|
|
262
244
|
builder.addPolygon(SkSpan(points), close);
|
|
263
|
-
|
|
264
|
-
std::make_shared<JsiSkPath>(getContext(), builder.snapshot());
|
|
265
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
266
|
-
runtime, hostObjectInstance, getContext());
|
|
245
|
+
return makeJsiObject(
|
|
246
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), builder.snapshot()));
|
|
267
247
|
}
|
|
268
248
|
|
|
269
249
|
// Static path operations
|
|
@@ -307,19 +287,17 @@ public:
|
|
|
307
287
|
auto success =
|
|
308
288
|
skpathutils::FillPathWithPaint(path, p, &resultBuilder, nullptr, ctm);
|
|
309
289
|
if (success) {
|
|
310
|
-
|
|
311
|
-
std::make_shared<JsiSkPath>(getContext(),
|
|
312
|
-
|
|
313
|
-
runtime, hostObjectInstance, getContext());
|
|
290
|
+
return makeJsiObject(
|
|
291
|
+
runtime, std::make_shared<JsiSkPath>(getContext(),
|
|
292
|
+
resultBuilder.snapshot()));
|
|
314
293
|
}
|
|
315
294
|
} else {
|
|
316
295
|
SkPathBuilder resultBuilder;
|
|
317
296
|
auto success = skpathutils::FillPathWithPaint(path, p, &resultBuilder);
|
|
318
297
|
if (success) {
|
|
319
|
-
|
|
320
|
-
std::make_shared<JsiSkPath>(getContext(),
|
|
321
|
-
|
|
322
|
-
runtime, hostObjectInstance, getContext());
|
|
298
|
+
return makeJsiObject(
|
|
299
|
+
runtime, std::make_shared<JsiSkPath>(getContext(),
|
|
300
|
+
resultBuilder.snapshot()));
|
|
323
301
|
}
|
|
324
302
|
}
|
|
325
303
|
return jsi::Value::null();
|
|
@@ -335,10 +313,8 @@ public:
|
|
|
335
313
|
// If requesting the full path in normal mode, just return a copy
|
|
336
314
|
if (start <= 0 && end >= 1 && !isComplement) {
|
|
337
315
|
SkPath result = srcPath->snapshot();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
341
|
-
runtime, hostObjectInstance, getContext());
|
|
316
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(
|
|
317
|
+
getContext(), std::move(result)));
|
|
342
318
|
}
|
|
343
319
|
SkPath path = srcPath->snapshot();
|
|
344
320
|
auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted
|
|
@@ -351,10 +327,8 @@ public:
|
|
|
351
327
|
SkPathBuilder resultBuilder;
|
|
352
328
|
if (pe->filterPath(&resultBuilder, path, &rec)) {
|
|
353
329
|
auto result = resultBuilder.detach();
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
357
|
-
runtime, hostObjectInstance, getContext());
|
|
330
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(
|
|
331
|
+
getContext(), std::move(result)));
|
|
358
332
|
}
|
|
359
333
|
return jsi::Value::null();
|
|
360
334
|
}
|
|
@@ -363,10 +337,9 @@ public:
|
|
|
363
337
|
auto srcPath = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
364
338
|
auto result = ::Simplify(srcPath->snapshot());
|
|
365
339
|
if (result.has_value()) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
runtime, hostObjectInstance, getContext());
|
|
340
|
+
return makeJsiObject(
|
|
341
|
+
runtime,
|
|
342
|
+
std::make_shared<JsiSkPath>(getContext(), std::move(result.value())));
|
|
370
343
|
}
|
|
371
344
|
return jsi::Value::null();
|
|
372
345
|
}
|
|
@@ -386,10 +359,8 @@ public:
|
|
|
386
359
|
SkPathBuilder resultBuilder;
|
|
387
360
|
if (pe->filterPath(&resultBuilder, srcPath->snapshot(), &rec)) {
|
|
388
361
|
auto result = resultBuilder.detach();
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
392
|
-
runtime, hostObjectInstance, getContext());
|
|
362
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(
|
|
363
|
+
getContext(), std::move(result)));
|
|
393
364
|
}
|
|
394
365
|
return jsi::Value::null();
|
|
395
366
|
}
|
|
@@ -398,10 +369,9 @@ public:
|
|
|
398
369
|
auto srcPath = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
399
370
|
auto result = ::AsWinding(srcPath->snapshot());
|
|
400
371
|
if (result.has_value()) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
runtime, hostObjectInstance, getContext());
|
|
372
|
+
return makeJsiObject(
|
|
373
|
+
runtime,
|
|
374
|
+
std::make_shared<JsiSkPath>(getContext(), std::move(result.value())));
|
|
405
375
|
}
|
|
406
376
|
return jsi::Value::null();
|
|
407
377
|
}
|
|
@@ -417,38 +387,44 @@ public:
|
|
|
417
387
|
if (!succeed) {
|
|
418
388
|
return jsi::Value::null();
|
|
419
389
|
}
|
|
420
|
-
|
|
421
|
-
std::make_shared<JsiSkPath>(getContext(), std::move(result));
|
|
422
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
423
|
-
runtime, hostObjectInstance, getContext());
|
|
390
|
+
return makeJsiObject(
|
|
391
|
+
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(result)));
|
|
424
392
|
}
|
|
425
393
|
|
|
426
|
-
size_t getMemoryPressure()
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
394
|
+
size_t getMemoryPressure() override { return 1024; }
|
|
395
|
+
|
|
396
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
397
|
+
installHostMethod(runtime, prototype, "Make", &JsiSkPathFactory::Make);
|
|
398
|
+
installHostMethod(runtime, prototype, "MakeFromSVGString",
|
|
399
|
+
&JsiSkPathFactory::MakeFromSVGString);
|
|
400
|
+
installHostMethod(runtime, prototype, "MakeFromOp",
|
|
401
|
+
&JsiSkPathFactory::MakeFromOp);
|
|
402
|
+
installHostMethod(runtime, prototype, "MakeFromCmds",
|
|
403
|
+
&JsiSkPathFactory::MakeFromCmds);
|
|
404
|
+
installHostMethod(runtime, prototype, "MakeFromText",
|
|
405
|
+
&JsiSkPathFactory::MakeFromText);
|
|
406
|
+
// Static shape factories
|
|
407
|
+
installHostMethod(runtime, prototype, "Rect", &JsiSkPathFactory::Rect);
|
|
408
|
+
installHostMethod(runtime, prototype, "Oval", &JsiSkPathFactory::Oval);
|
|
409
|
+
installHostMethod(runtime, prototype, "Circle", &JsiSkPathFactory::Circle);
|
|
410
|
+
installHostMethod(runtime, prototype, "RRect", &JsiSkPathFactory::RRect);
|
|
411
|
+
installHostMethod(runtime, prototype, "Line", &JsiSkPathFactory::Line);
|
|
412
|
+
installHostMethod(runtime, prototype, "Polygon",
|
|
413
|
+
&JsiSkPathFactory::Polygon);
|
|
414
|
+
// Static path operations
|
|
415
|
+
installHostMethod(runtime, prototype, "Stroke", &JsiSkPathFactory::Stroke);
|
|
416
|
+
installHostMethod(runtime, prototype, "Trim", &JsiSkPathFactory::Trim);
|
|
417
|
+
installHostMethod(runtime, prototype, "Simplify",
|
|
418
|
+
&JsiSkPathFactory::Simplify);
|
|
419
|
+
installHostMethod(runtime, prototype, "Dash", &JsiSkPathFactory::Dash);
|
|
420
|
+
installHostMethod(runtime, prototype, "AsWinding",
|
|
421
|
+
&JsiSkPathFactory::AsWinding);
|
|
422
|
+
installHostMethod(runtime, prototype, "Interpolate",
|
|
423
|
+
&JsiSkPathFactory::Interpolate);
|
|
424
|
+
}
|
|
449
425
|
|
|
450
426
|
explicit JsiSkPathFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
451
|
-
:
|
|
427
|
+
: JsiSkNativeObject<JsiSkPathFactory>(std::move(context)) {}
|
|
452
428
|
};
|
|
453
429
|
|
|
454
430
|
} // namespace RNSkia
|
package/cpp/api/JsiSkPicture.h
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
#include "JsiSkData.h"
|
|
6
6
|
#include "JsiSkDispatcher.h"
|
|
7
|
-
#include "JsiSkHostObjects.h"
|
|
8
7
|
#include "JsiSkMatrix.h"
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
9
9
|
#include "JsiSkRect.h"
|
|
10
10
|
#include "JsiSkShader.h"
|
|
11
11
|
|
|
@@ -20,14 +20,18 @@ namespace RNSkia {
|
|
|
20
20
|
|
|
21
21
|
namespace jsi = facebook::jsi;
|
|
22
22
|
|
|
23
|
-
class JsiSkPicture
|
|
23
|
+
class JsiSkPicture
|
|
24
|
+
: public JsiSkWrappingSkPtrNativeObject<JsiSkPicture, SkPicture> {
|
|
24
25
|
private:
|
|
25
26
|
std::shared_ptr<Dispatcher> _dispatcher;
|
|
26
27
|
|
|
27
28
|
public:
|
|
29
|
+
static constexpr const char *CLASS_NAME = "Picture";
|
|
30
|
+
|
|
28
31
|
JsiSkPicture(std::shared_ptr<RNSkPlatformContext> context,
|
|
29
32
|
const sk_sp<SkPicture> picture)
|
|
30
|
-
:
|
|
33
|
+
: JsiSkWrappingSkPtrNativeObject<JsiSkPicture, SkPicture>(context,
|
|
34
|
+
picture) {
|
|
31
35
|
// Get the dispatcher for the current thread
|
|
32
36
|
_dispatcher = Dispatcher::getDispatcher();
|
|
33
37
|
// Process any pending operations
|
|
@@ -66,9 +70,8 @@ public:
|
|
|
66
70
|
|
|
67
71
|
// Create shader
|
|
68
72
|
auto shader = getObject()->makeShader(tmx, tmy, fm, m, tr);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
getContext());
|
|
73
|
+
return makeJsiObject(runtime,
|
|
74
|
+
std::make_shared<JsiSkShader>(getContext(), shader));
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
JSI_HOST_FUNCTION(serialize) {
|
|
@@ -90,13 +93,23 @@ public:
|
|
|
90
93
|
return array;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
/**
|
|
97
|
+
Returns the underlying object from a host object of this type
|
|
98
|
+
*/
|
|
99
|
+
static sk_sp<SkPicture> fromValue(jsi::Runtime &runtime,
|
|
100
|
+
const jsi::Value &obj) {
|
|
101
|
+
return getJsiObject<JsiSkPicture>(runtime, obj)->getObject();
|
|
102
|
+
}
|
|
94
103
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
105
|
+
installCommon(runtime, prototype);
|
|
106
|
+
installHostMethod(runtime, prototype, "makeShader",
|
|
107
|
+
&JsiSkPicture::makeShader);
|
|
108
|
+
installHostMethod(runtime, prototype, "serialize",
|
|
109
|
+
&JsiSkPicture::serialize);
|
|
110
|
+
}
|
|
98
111
|
|
|
99
|
-
size_t getMemoryPressure()
|
|
112
|
+
size_t getMemoryPressure() override {
|
|
100
113
|
if (isDisposed()) {
|
|
101
114
|
return 0;
|
|
102
115
|
}
|
|
@@ -108,7 +121,5 @@ public:
|
|
|
108
121
|
auto bytesUsed = picture->approximateBytesUsed();
|
|
109
122
|
return bytesUsed;
|
|
110
123
|
}
|
|
111
|
-
|
|
112
|
-
std::string getObjectType() const override { return "JsiSkPicture"; }
|
|
113
124
|
};
|
|
114
125
|
} // namespace RNSkia
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#include "JsiSkColorFilter.h"
|
|
6
6
|
#include "JsiSkData.h"
|
|
7
|
-
#include "
|
|
7
|
+
#include "JsiSkNativeObjects.h"
|
|
8
8
|
#include "JsiSkPicture.h"
|
|
9
9
|
|
|
10
10
|
#pragma clang diagnostic push
|
|
@@ -19,15 +19,15 @@ namespace RNSkia {
|
|
|
19
19
|
|
|
20
20
|
namespace jsi = facebook::jsi;
|
|
21
21
|
|
|
22
|
-
class JsiSkPictureFactory : public
|
|
22
|
+
class JsiSkPictureFactory : public JsiSkNativeObject<JsiSkPictureFactory> {
|
|
23
23
|
public:
|
|
24
|
+
static constexpr const char *CLASS_NAME = "PictureFactory";
|
|
25
|
+
|
|
24
26
|
JSI_HOST_FUNCTION(MakePicture) {
|
|
25
27
|
// Handle null case - create JsiSkPicture with nullptr
|
|
26
28
|
if (arguments[0].isNull() || arguments[0].isUndefined()) {
|
|
27
|
-
|
|
28
|
-
std::make_shared<JsiSkPicture>(getContext(), nullptr);
|
|
29
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
30
|
-
runtime, hostObjectInstance, getContext());
|
|
29
|
+
return makeJsiObject(
|
|
30
|
+
runtime, std::make_shared<JsiSkPicture>(getContext(), nullptr));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (!arguments[0].isObject()) {
|
|
@@ -36,18 +36,14 @@ public:
|
|
|
36
36
|
auto obj = arguments[0].asObject(runtime);
|
|
37
37
|
|
|
38
38
|
// Check if it's a JsiSkData object first
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
std::make_shared<JsiSkPicture>(getContext(), std::move(picture));
|
|
46
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
47
|
-
runtime, hostObjectInstance, getContext());
|
|
48
|
-
}
|
|
49
|
-
return jsi::Value::undefined();
|
|
39
|
+
if (auto jsiData = tryGetJsiObject<JsiSkData>(runtime, obj)) {
|
|
40
|
+
auto data = jsiData->getObject();
|
|
41
|
+
auto picture = SkPicture::MakeFromData(data.get());
|
|
42
|
+
if (picture != nullptr) {
|
|
43
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPicture>(
|
|
44
|
+
getContext(), std::move(picture)));
|
|
50
45
|
}
|
|
46
|
+
return jsi::Value::undefined();
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
// Get ArrayBuffer - try buffer property first (Uint8Array, etc.), then
|
|
@@ -64,23 +60,22 @@ public:
|
|
|
64
60
|
SkData::MakeWithCopy(buffer.data(runtime), buffer.size(runtime));
|
|
65
61
|
auto picture = SkPicture::MakeFromData(data.get());
|
|
66
62
|
if (picture != nullptr) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
70
|
-
runtime, hostObjectInstance, getContext());
|
|
63
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPicture>(
|
|
64
|
+
getContext(), std::move(picture)));
|
|
71
65
|
} else {
|
|
72
66
|
return jsi::Value::undefined();
|
|
73
67
|
}
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
size_t getMemoryPressure() override { return 1024; }
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
73
|
+
installHostMethod(runtime, prototype, "MakePicture",
|
|
74
|
+
&JsiSkPictureFactory::MakePicture);
|
|
75
|
+
}
|
|
81
76
|
|
|
82
77
|
explicit JsiSkPictureFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
83
|
-
:
|
|
78
|
+
: JsiSkNativeObject<JsiSkPictureFactory>(std::move(context)) {}
|
|
84
79
|
};
|
|
85
80
|
|
|
86
81
|
} // namespace RNSkia
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
|
|
5
5
|
#include "JsiSkCanvas.h"
|
|
6
|
-
#include "
|
|
6
|
+
#include "JsiSkNativeObjects.h"
|
|
7
7
|
#include "JsiSkPicture.h"
|
|
8
8
|
#include "JsiSkRect.h"
|
|
9
9
|
|
|
@@ -20,10 +20,14 @@ namespace RNSkia {
|
|
|
20
20
|
namespace jsi = facebook::jsi;
|
|
21
21
|
|
|
22
22
|
class JsiSkPictureRecorder
|
|
23
|
-
: public
|
|
23
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiSkPictureRecorder,
|
|
24
|
+
SkPictureRecorder> {
|
|
24
25
|
public:
|
|
26
|
+
static constexpr const char *CLASS_NAME = "PictureRecorder";
|
|
27
|
+
|
|
25
28
|
explicit JsiSkPictureRecorder(std::shared_ptr<RNSkPlatformContext> context)
|
|
26
|
-
:
|
|
29
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiSkPictureRecorder,
|
|
30
|
+
SkPictureRecorder>(
|
|
27
31
|
context, std::make_shared<SkPictureRecorder>()) {}
|
|
28
32
|
|
|
29
33
|
JSI_HOST_FUNCTION(beginRecording) {
|
|
@@ -37,36 +41,31 @@ public:
|
|
|
37
41
|
SkRect rect = SkRect::Make(size);
|
|
38
42
|
canvas = getObject()->beginRecording(rect, nullptr);
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
getContext());
|
|
44
|
+
return makeJsiObject(runtime,
|
|
45
|
+
std::make_shared<JsiSkCanvas>(getContext(), canvas));
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
JSI_HOST_FUNCTION(finishRecordingAsPicture) {
|
|
46
49
|
auto picture = getObject()->finishRecordingAsPicture();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
50
|
-
runtime, hostObjectInstance, getContext());
|
|
50
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPicture>(
|
|
51
|
+
getContext(), std::move(picture)));
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
size_t getMemoryPressure() const override { return 1024 * 1024; }
|
|
54
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
55
|
+
installCommon(runtime, prototype);
|
|
56
|
+
installHostMethod(runtime, prototype, "beginRecording",
|
|
57
|
+
&JsiSkPictureRecorder::beginRecording);
|
|
58
|
+
installHostMethod(runtime, prototype, "finishRecordingAsPicture",
|
|
59
|
+
&JsiSkPictureRecorder::finishRecordingAsPicture);
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
size_t getMemoryPressure() override { return 1024 * 1024; }
|
|
63
63
|
|
|
64
64
|
static const jsi::HostFunctionType
|
|
65
65
|
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
|
66
66
|
return JSI_HOST_FUNCTION_LAMBDA {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
context);
|
|
67
|
+
return makeJsiObject(runtime,
|
|
68
|
+
std::make_shared<JsiSkPictureRecorder>(context));
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
};
|