@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
package/cpp/jsi/JsiHostObject.h
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
|
|
5
|
-
#include <functional>
|
|
6
|
-
#include <map>
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <unordered_map>
|
|
10
|
-
#include <vector>
|
|
11
|
-
|
|
12
|
-
#include "RuntimeAwareCache.h"
|
|
13
|
-
|
|
14
|
-
#define STR_CAT_NX(A, B) A##B
|
|
15
|
-
#define STR_CAT(A, B) STR_CAT_NX(A, B)
|
|
16
|
-
#define STR_GET get_
|
|
17
|
-
#define STR_SET set_
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new Host function declaration as a lambda with all deps passed
|
|
21
|
-
* with implicit lambda capture clause
|
|
22
|
-
*/
|
|
23
|
-
#define JSI_HOST_FUNCTION_LAMBDA \
|
|
24
|
-
[=](jsi::Runtime & runtime, const jsi::Value &thisValue, \
|
|
25
|
-
const jsi::Value *arguments, size_t count) -> jsi::Value
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a new Host function declaration
|
|
29
|
-
*/
|
|
30
|
-
#define JSI_HOST_FUNCTION(NAME) \
|
|
31
|
-
jsi::Value NAME(jsi::Runtime &runtime, const jsi::Value &thisValue, \
|
|
32
|
-
const jsi::Value *arguments, size_t count)
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new property setter function declaration
|
|
36
|
-
*/
|
|
37
|
-
#define JSI_PROPERTY_SET(NAME) \
|
|
38
|
-
void STR_CAT(STR_SET, NAME)(jsi::Runtime & runtime, const jsi::Value &value)
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Creates a new property getter function declaration
|
|
42
|
-
*/
|
|
43
|
-
#define JSI_PROPERTY_GET(NAME) \
|
|
44
|
-
jsi::Value STR_CAT(STR_GET, NAME)(jsi::Runtime & runtime)
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Creates a JSI export function declaration
|
|
48
|
-
*/
|
|
49
|
-
#define JSI_EXPORT_FUNC(CLASS, FUNCTION) \
|
|
50
|
-
{#FUNCTION, (jsi::Value(JsiHostObject::*)( \
|
|
51
|
-
jsi::Runtime & runtime, const jsi::Value &thisValue, \
|
|
52
|
-
const jsi::Value *arguments, size_t)) & \
|
|
53
|
-
CLASS::FUNCTION}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Creates a JSI export functions statement
|
|
57
|
-
*/
|
|
58
|
-
#define JSI_EXPORT_FUNCTIONS(...) \
|
|
59
|
-
const RNJsi::JsiFunctionMap &getExportedFunctionMap() override { \
|
|
60
|
-
static RNJsi::JsiFunctionMap map = {__VA_ARGS__}; \
|
|
61
|
-
return map; \
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Creates a JSI export getter declaration
|
|
66
|
-
*/
|
|
67
|
-
#define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \
|
|
68
|
-
{#FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \
|
|
69
|
-
CLASS::STR_CAT(STR_GET, FUNCTION)}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Creates a JSI export getters statement
|
|
73
|
-
*/
|
|
74
|
-
#define JSI_EXPORT_PROPERTY_GETTERS(...) \
|
|
75
|
-
const RNJsi::JsiPropertyGettersMap &getExportedPropertyGettersMap() \
|
|
76
|
-
override { \
|
|
77
|
-
static RNJsi::JsiPropertyGettersMap map = {__VA_ARGS__}; \
|
|
78
|
-
return map; \
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Creates a JSI export setter declaration
|
|
83
|
-
*/
|
|
84
|
-
#define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \
|
|
85
|
-
{#FUNCTION, \
|
|
86
|
-
(void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
|
|
87
|
-
CLASS::STR_CAT(STR_SET, FUNCTION)}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Creates a JSI export setters statement
|
|
91
|
-
*/
|
|
92
|
-
#define JSI_EXPORT_PROPERTY_SETTERS(...) \
|
|
93
|
-
const RNJsi::JsiPropertySettersMap &getExportedPropertySettersMap() \
|
|
94
|
-
override { \
|
|
95
|
-
static RNJsi::JsiPropertySettersMap map = {__VA_ARGS__}; \
|
|
96
|
-
return map; \
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
namespace RNJsi {
|
|
100
|
-
|
|
101
|
-
namespace jsi = facebook::jsi;
|
|
102
|
-
|
|
103
|
-
using JsPropertyType = struct {
|
|
104
|
-
std::function<jsi::Value(jsi::Runtime &)> get;
|
|
105
|
-
std::function<void(jsi::Runtime &, const jsi::Value &)> set;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
class JsiHostObject;
|
|
109
|
-
|
|
110
|
-
using JsiFunctionMap =
|
|
111
|
-
std::unordered_map<std::string, jsi::Value (JsiHostObject::*)(
|
|
112
|
-
jsi::Runtime &, const jsi::Value &,
|
|
113
|
-
const jsi::Value *, size_t)>;
|
|
114
|
-
|
|
115
|
-
using JsiPropertyGettersMap =
|
|
116
|
-
std::unordered_map<std::string,
|
|
117
|
-
jsi::Value (JsiHostObject::*)(jsi::Runtime &)>;
|
|
118
|
-
|
|
119
|
-
using JsiPropertySettersMap =
|
|
120
|
-
std::unordered_map<std::string, void (JsiHostObject::*)(
|
|
121
|
-
jsi::Runtime &, const jsi::Value &)>;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Base class for jsi host objects
|
|
125
|
-
*/
|
|
126
|
-
class JsiHostObject : public jsi::HostObject {
|
|
127
|
-
public:
|
|
128
|
-
JsiHostObject() = default;
|
|
129
|
-
~JsiHostObject() = default;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Overridden jsi::HostObject set property method
|
|
133
|
-
* @param rt Runtime
|
|
134
|
-
* @param name Name of value to set
|
|
135
|
-
* @param value Value to set
|
|
136
|
-
*/
|
|
137
|
-
void set(jsi::Runtime &rt, const jsi::PropNameID &name,
|
|
138
|
-
const jsi::Value &value) override;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Overridden jsi::HostObject get property method. Returns functions from
|
|
142
|
-
* the map of functions.
|
|
143
|
-
* @param runtime Runtime
|
|
144
|
-
* @param name Name of value to get
|
|
145
|
-
* @return Value
|
|
146
|
-
*/
|
|
147
|
-
jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Overridden getPropertyNames from jsi::HostObject. Returns all keys in the
|
|
151
|
-
* function and property maps
|
|
152
|
-
* @param runtime Runtime
|
|
153
|
-
* @return List of property names
|
|
154
|
-
*/
|
|
155
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &runtime) override;
|
|
156
|
-
|
|
157
|
-
protected:
|
|
158
|
-
/**
|
|
159
|
-
Override to return map of name/functions
|
|
160
|
-
*/
|
|
161
|
-
virtual const RNJsi::JsiFunctionMap &getExportedFunctionMap() {
|
|
162
|
-
static const RNJsi::JsiFunctionMap empty;
|
|
163
|
-
return empty;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
Override to get property getters map of name/functions
|
|
168
|
-
*/
|
|
169
|
-
virtual const JsiPropertyGettersMap &getExportedPropertyGettersMap() {
|
|
170
|
-
static const JsiPropertyGettersMap empty;
|
|
171
|
-
return empty;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
Override to get property setters map of name/functions
|
|
176
|
-
*/
|
|
177
|
-
virtual const JsiPropertySettersMap &getExportedPropertySettersMap() {
|
|
178
|
-
static const JsiPropertySettersMap empty;
|
|
179
|
-
return empty;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Installs a function into the function map
|
|
184
|
-
*/
|
|
185
|
-
void installFunction(const std::string &name,
|
|
186
|
-
const jsi::HostFunctionType &function) {
|
|
187
|
-
_funcMap.emplace(name, function);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Installs a property with get/set
|
|
192
|
-
* @param name Name of property to install
|
|
193
|
-
* @param get Getter function
|
|
194
|
-
* @param set Setter function
|
|
195
|
-
*/
|
|
196
|
-
void installProperty(
|
|
197
|
-
const std::string &name,
|
|
198
|
-
const std::function<jsi::Value(jsi::Runtime &)> &get,
|
|
199
|
-
const std::function<void(jsi::Runtime &, const jsi::Value &)> &set) {
|
|
200
|
-
_propMap.emplace(name, JsPropertyType{.get = get, .set = set});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Installs a property with only getter
|
|
205
|
-
* @param name Name of property to install
|
|
206
|
-
* @param get Getter function
|
|
207
|
-
*/
|
|
208
|
-
void installReadonlyProperty(
|
|
209
|
-
const std::string &name,
|
|
210
|
-
const std::function<jsi::Value(jsi::Runtime &)> &get) {
|
|
211
|
-
_propMap.emplace(name, JsPropertyType{
|
|
212
|
-
.get = get,
|
|
213
|
-
.set = [](jsi::Runtime &, const jsi::Value &) {},
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Installs a property which points to a given host object
|
|
219
|
-
* @param name Name of property to install
|
|
220
|
-
* @param hostObject Object to return
|
|
221
|
-
*/
|
|
222
|
-
void installReadonlyProperty(const std::string &name,
|
|
223
|
-
std::shared_ptr<jsi::HostObject> hostObject) {
|
|
224
|
-
_propMap.emplace(name, JsPropertyType{
|
|
225
|
-
.get =
|
|
226
|
-
[hostObject](jsi::Runtime &runtime) {
|
|
227
|
-
return jsi::Object::createFromHostObject(
|
|
228
|
-
runtime, hostObject);
|
|
229
|
-
},
|
|
230
|
-
.set = [](jsi::Runtime &, const jsi::Value &) {},
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
@Returns a reference to the argument at the given position in the arguments
|
|
236
|
-
array. Raises an error if the index is above the number of arguments.
|
|
237
|
-
@param runtime jsi::Runtime
|
|
238
|
-
@param arguments Arguments list
|
|
239
|
-
@param count Number of arguments in arguments list
|
|
240
|
-
@param index Index of parameter to return
|
|
241
|
-
*/
|
|
242
|
-
static const jsi::Value &getArgument(jsi::Runtime &runtime,
|
|
243
|
-
const jsi::Value *arguments,
|
|
244
|
-
size_t count, size_t index) {
|
|
245
|
-
if (index >= count) {
|
|
246
|
-
throw jsi::JSError(runtime, "Argument index out of bounds.");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return arguments[index];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
Returns argument as number or throws
|
|
254
|
-
*/
|
|
255
|
-
static double getArgumentAsNumber(jsi::Runtime &runtime,
|
|
256
|
-
const jsi::Value *arguments, size_t count,
|
|
257
|
-
size_t index) {
|
|
258
|
-
const jsi::Value &value = getArgument(runtime, arguments, count, index);
|
|
259
|
-
if (!value.isNumber()) {
|
|
260
|
-
throw jsi::JSError(runtime,
|
|
261
|
-
"Expected type number for parameter at index " +
|
|
262
|
-
std::to_string(index));
|
|
263
|
-
}
|
|
264
|
-
return value.asNumber();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
Returns argument as bool or throws
|
|
269
|
-
*/
|
|
270
|
-
static bool getArgumentAsBool(jsi::Runtime &runtime,
|
|
271
|
-
const jsi::Value *arguments, size_t count,
|
|
272
|
-
size_t index) {
|
|
273
|
-
const jsi::Value &value = getArgument(runtime, arguments, count, index);
|
|
274
|
-
if (!value.isBool()) {
|
|
275
|
-
throw jsi::JSError(runtime,
|
|
276
|
-
"Expected type boolean for parameter at index " +
|
|
277
|
-
std::to_string(index));
|
|
278
|
-
}
|
|
279
|
-
return value.getBool();
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
Returns argument as string or throws
|
|
284
|
-
*/
|
|
285
|
-
static jsi::String getArgumentAsString(jsi::Runtime &runtime,
|
|
286
|
-
const jsi::Value *arguments,
|
|
287
|
-
size_t count, size_t index) {
|
|
288
|
-
const jsi::Value &value = getArgument(runtime, arguments, count, index);
|
|
289
|
-
if (!value.isString()) {
|
|
290
|
-
throw jsi::JSError(runtime,
|
|
291
|
-
"Expected type string for parameter at index " +
|
|
292
|
-
std::to_string(index));
|
|
293
|
-
}
|
|
294
|
-
return value.asString(runtime);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
Returns argument as object or throws
|
|
299
|
-
*/
|
|
300
|
-
static jsi::Object getArgumentAsObject(jsi::Runtime &runtime,
|
|
301
|
-
const jsi::Value *arguments,
|
|
302
|
-
size_t count, size_t index) {
|
|
303
|
-
const jsi::Value &value = getArgument(runtime, arguments, count, index);
|
|
304
|
-
if (!value.isObject()) {
|
|
305
|
-
throw jsi::JSError(runtime,
|
|
306
|
-
"Expected type object for parameter at index " +
|
|
307
|
-
std::to_string(index));
|
|
308
|
-
}
|
|
309
|
-
return value.asObject(runtime);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
Returns argument as host object or throws
|
|
314
|
-
*/
|
|
315
|
-
template <typename T = HostObject>
|
|
316
|
-
static std::shared_ptr<T>
|
|
317
|
-
getArgumentAsHostObject(jsi::Runtime &runtime, const jsi::Value *arguments,
|
|
318
|
-
size_t count, size_t index) {
|
|
319
|
-
auto value = getArgumentAsObject(runtime, arguments, count, index);
|
|
320
|
-
if (!value.isHostObject(runtime)) {
|
|
321
|
-
throw jsi::JSError(runtime,
|
|
322
|
-
"Expected type host object for parameter at index " +
|
|
323
|
-
std::to_string(index));
|
|
324
|
-
}
|
|
325
|
-
return value.asHostObject<T>(runtime);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
Returns argument as host object or nullptr if the value is not a valid host
|
|
330
|
-
object of requested type
|
|
331
|
-
*/
|
|
332
|
-
template <typename T = HostObject>
|
|
333
|
-
static std::shared_ptr<T>
|
|
334
|
-
tryGetArgumentAsHostObject(jsi::Runtime &runtime, const jsi::Value *arguments,
|
|
335
|
-
size_t count, size_t index) {
|
|
336
|
-
const jsi::Value &value = getArgument(runtime, arguments, count, index);
|
|
337
|
-
if (!value.isObject()) {
|
|
338
|
-
return nullptr;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
auto object = value.asObject(runtime);
|
|
342
|
-
if (!object.isHostObject(runtime)) {
|
|
343
|
-
return nullptr;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return object.asHostObject<T>(runtime);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
Returns argument as array or throws
|
|
351
|
-
*/
|
|
352
|
-
static jsi::Array getArgumentAsArray(jsi::Runtime &runtime,
|
|
353
|
-
const jsi::Value *arguments,
|
|
354
|
-
size_t count, size_t index) {
|
|
355
|
-
auto value = getArgumentAsObject(runtime, arguments, count, index);
|
|
356
|
-
if (!value.isArray(runtime)) {
|
|
357
|
-
throw jsi::JSError(runtime,
|
|
358
|
-
"Expected type array for parameter at index " +
|
|
359
|
-
std::to_string(index));
|
|
360
|
-
}
|
|
361
|
-
return value.asArray(runtime);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
Returns argument as function or throws
|
|
366
|
-
*/
|
|
367
|
-
static jsi::Object getArgumentAsFunction(jsi::Runtime &runtime,
|
|
368
|
-
const jsi::Value *arguments,
|
|
369
|
-
size_t count, size_t index) {
|
|
370
|
-
auto value = getArgumentAsObject(runtime, arguments, count, index);
|
|
371
|
-
if (!value.isFunction(runtime)) {
|
|
372
|
-
throw jsi::JSError(runtime,
|
|
373
|
-
"Expected type function for parameter at index " +
|
|
374
|
-
std::to_string(index));
|
|
375
|
-
}
|
|
376
|
-
return value.asFunction(runtime);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
private:
|
|
380
|
-
std::unordered_map<std::string, jsi::HostFunctionType> _funcMap;
|
|
381
|
-
std::unordered_map<std::string, JsPropertyType> _propMap;
|
|
382
|
-
|
|
383
|
-
RuntimeAwareCache<std::map<std::string, jsi::Function>> _hostFunctionCache;
|
|
384
|
-
};
|
|
385
|
-
} // namespace RNJsi
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Google LLC
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
-
* found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#ifndef skgpu_graphite_ContextOptionsPriv_DEFINED
|
|
9
|
-
#define skgpu_graphite_ContextOptionsPriv_DEFINED
|
|
10
|
-
|
|
11
|
-
#include "include/private/base/SkMath.h"
|
|
12
|
-
|
|
13
|
-
#include <optional>
|
|
14
|
-
|
|
15
|
-
namespace skgpu::graphite {
|
|
16
|
-
|
|
17
|
-
enum class PathRendererStrategy;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Private options that are only meant for testing within Skia's tools.
|
|
21
|
-
*/
|
|
22
|
-
struct ContextOptionsPriv {
|
|
23
|
-
|
|
24
|
-
int fMaxTextureSizeOverride = SK_MaxS32;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* If true, will store a pointer in Recorder that points back to the Context
|
|
28
|
-
* that created it. Used by readPixels() and other methods that normally require a Context.
|
|
29
|
-
*/
|
|
30
|
-
bool fStoreContextRefInRecorder = false;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* If true, enables layer based draw ordering.
|
|
34
|
-
*/
|
|
35
|
-
bool fDrawListLayer = false;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Override Caps' default strategy heuristics to prioritize this one if set *and* is supported.
|
|
39
|
-
*/
|
|
40
|
-
std::optional<PathRendererStrategy> fPathRendererStrategy;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
} // namespace skgpu::graphite
|
|
44
|
-
|
|
45
|
-
#endif // skgpu_graphite_ContextOptionsPriv_DEFINED
|