@shopify/react-native-skia 2.12.0-next.1 → 2.13.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/LICENSE.md +2 -1
- package/Package.swift +117 -0
- package/android/CMakeLists.txt +23 -179
- package/android/build.gradle +40 -209
- package/android/cpp/jni/JniSkiaManager.cpp +3 -45
- package/android/cpp/jni/include/JniPlatformContext.h +1 -1
- package/android/cpp/jni/include/JniSkiaBaseView.h +18 -11
- package/android/cpp/jni/include/JniSkiaManager.h +3 -4
- package/android/cpp/jni/include/JniSkiaPictureView.h +5 -5
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -10
- package/android/cpp/rnskia-android/RNSkAndroidView.h +6 -6
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/PlatformContext.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkVideo.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkiaModule.java +1 -8
- package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +57 -0
- package/android/src/main/java/com/reactnative/skia/SkiaBaseView.java +185 -0
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaBaseViewManager.java +20 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaManager.java +11 -6
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureView.java +3 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureViewManager.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaSurfaceView.java +13 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaTextureView.java +5 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaViewAPI.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/ViewScreenshotService.java +10 -13
- package/apple/MetalContext.mm +1 -1
- package/apple/RNSkApplePlatformContext.h +0 -3
- package/apple/RNSkApplePlatformContext.mm +0 -11
- package/apple/RNSkiaModule.h +1 -10
- package/apple/RNSkiaModule.mm +2 -10
- package/apple/SkiaManager.h +0 -2
- package/apple/SkiaManager.mm +4 -6
- package/apple/SkiaPictureView.h +2 -2
- package/apple/SkiaPictureView.mm +0 -4
- package/apple/SkiaUIView.h +3 -18
- package/apple/SkiaUIView.mm +0 -30
- package/cpp/api/CustomBlendModes.h +17 -0
- package/cpp/api/JsiSkApi.h +0 -6
- package/cpp/api/JsiSkCanvas.h +19 -10
- package/cpp/api/JsiSkFont.h +5 -10
- package/cpp/api/JsiSkMatrix.h +4 -2
- package/cpp/api/JsiSkSVGFactory.h +4 -0
- package/cpp/api/recorder/Convertor.h +5 -2
- package/cpp/api/recorder/Drawings.h +13 -3
- package/cpp/api/recorder/ImageFilters.h +15 -1
- package/cpp/api/recorder/Paint.h +8 -1
- package/cpp/jsi/JSICache.cpp +99 -0
- package/cpp/jsi/JSICache.h +90 -0
- package/cpp/jsi/NativeObject.h +38 -87
- package/cpp/jsi/ViewProperty.h +0 -28
- package/cpp/rnskia/RNDawnContext.h +2 -1
- package/cpp/rnskia/RNDawnWindowContext.h +22 -0
- package/cpp/rnskia/RNSkManager.cpp +0 -6
- package/cpp/rnskia/RNSkPlatformContext.h +0 -3
- package/cpp/skia/include/core/RasterContext.h +25 -0
- package/cpp/skia/include/core/SkCanvas.h +0 -1
- package/cpp/skia/include/core/SkContext.h +62 -0
- package/cpp/skia/include/core/SkContextOptions.h +15 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPicture.h +36 -18
- package/cpp/skia/include/core/SkRecorder.h +8 -0
- package/cpp/skia/include/core/SkSerialProcs.h +2 -6
- package/cpp/skia/include/effects/SkImageFilters.h +15 -2
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +73 -47
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +7 -4
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +12 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +11 -0
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +11 -0
- package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +13 -0
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +6 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +5 -4
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +9 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +11 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +11 -0
- package/cpp/skia/include/private/SkLog.h +1 -19
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +2 -1
- package/cpp/skia/include/utils/SkLogHandler.h +53 -0
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +9 -10
- package/cpp/skia/modules/skcms/src/skcms_internals.h +8 -3
- package/cpp/skia/modules/skottie/include/SkottieProperty.h +2 -0
- package/cpp/skia/modules/skottie/include/TextShaper.h +1 -0
- package/cpp/skia/modules/skshaper/include/SkShaper.h +23 -1
- package/include/ReactNativeSkia.h +6 -0
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/useVideo.js +8 -2
- package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +11 -3
- package/lib/commonjs/renderer/Canvas.js +8 -6
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/Mask.js +3 -9
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +1 -0
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.js +7 -2
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +1 -6
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -7
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -3
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js +2 -2
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextStyle.js +5 -5
- package/lib/commonjs/skia/web/JsiSkTextStyle.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +0 -3
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js +8 -8
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js +15 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +6 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +12 -9
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +15 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +3 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +2 -12
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +247 -57
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +19 -8
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +8 -2
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +11 -3
- package/lib/module/renderer/Canvas.js +7 -5
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/Mask.js +3 -9
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +1 -0
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/skia/types/Matrix4.js +7 -2
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +1 -6
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +12 -7
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPathBuilder.js +2 -2
- package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextStyle.js +5 -5
- package/lib/module/skia/web/JsiSkTextStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +0 -3
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiSkottieAnimation.js +8 -8
- package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -1
- package/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/module/sksg/Recorder/DrawingContext.js +15 -0
- package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +1 -1
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +6 -1
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +12 -9
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +15 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +3 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -12
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +247 -57
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/types.d.ts +19 -8
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +0 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/react-native.config.d.ts +3 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +11 -3
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +1 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +1 -6
- package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/src/views/types.d.ts +19 -8
- package/package.json +15 -12
- package/react-native-skia.podspec +4 -10
- package/react-native.config.js +5 -0
- package/src/dom/nodes/datatypes/Rect.ts +6 -1
- package/src/external/reanimated/useVideo.ts +7 -2
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +23 -5
- package/src/renderer/components/Mask.tsx +10 -3
- package/src/skia/types/JsiInstance.ts +2 -0
- package/src/skia/types/Matrix4.ts +6 -2
- package/src/skia/types/Skia.ts +1 -7
- package/src/skia/web/JsiSkCanvas.ts +22 -12
- package/src/skia/web/JsiSkImage.ts +6 -3
- package/src/skia/web/JsiSkPathBuilder.ts +2 -2
- package/src/skia/web/JsiSkTextStyle.ts +20 -15
- package/src/skia/web/JsiSkia.ts +0 -4
- package/src/skia/web/JsiSkottieAnimation.ts +8 -8
- package/src/sksg/Recorder/DrawingContext.ts +15 -0
- package/src/sksg/Recorder/Player.ts +1 -1
- package/src/sksg/Recorder/Visitor.ts +9 -6
- package/src/sksg/Recorder/commands/Drawing.ts +12 -9
- package/src/sksg/Recorder/commands/ImageFilters.ts +20 -1
- package/src/sksg/Recorder/commands/Shaders.ts +1 -1
- package/src/specs/SkiaPictureViewNativeComponent.ts +5 -0
- package/src/specs/SkiaPictureViewNativeComponent.web.ts +5 -0
- package/src/views/SkiaPictureView.tsx +2 -10
- package/src/views/SkiaPictureView.web.tsx +245 -57
- package/src/views/types.ts +23 -10
- package/android/src/latest/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -11
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +0 -79
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +0 -113
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -136
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +0 -41
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +0 -20
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +0 -35
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +0 -17
- package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +0 -38
- package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -14
- package/apple/SkiaPictureViewManager.h +0 -8
- package/apple/SkiaPictureViewManager.mm +0 -60
- package/apple/SkiaWebGPUView.h +0 -20
- package/apple/WebGPUMetalView.h +0 -12
- package/cpp/api/JsiSkiaContext.h +0 -94
- 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 -103
- package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/DawnNative.h +0 -368
- 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 -207
- 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 -2856
- package/cpp/dawn/include/tint/tint.h +0 -91
- package/cpp/dawn/include/webgpu/webgpu.h +0 -5029
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10353
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -162
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
- package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
- package/cpp/jsi/RuntimeAwareCache.h +0 -117
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
- package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
- 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
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
package com.shopify.reactnative.skia;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.graphics.SurfaceTexture;
|
|
5
|
-
import android.util.Log;
|
|
6
|
-
import android.view.MotionEvent;
|
|
7
|
-
import android.view.Surface;
|
|
8
|
-
import android.view.View;
|
|
9
|
-
|
|
10
|
-
import com.facebook.react.uimanager.PointerEvents;
|
|
11
|
-
import com.facebook.react.views.view.ReactViewGroup;
|
|
12
|
-
|
|
13
|
-
public abstract class SkiaBaseView extends ReactViewGroup implements SkiaViewAPI {
|
|
14
|
-
private View mView;
|
|
15
|
-
|
|
16
|
-
private boolean mHighBitDepth = false;
|
|
17
|
-
|
|
18
|
-
private final boolean debug = false;
|
|
19
|
-
private final String tag = "SkiaView";
|
|
20
|
-
|
|
21
|
-
public SkiaBaseView(Context context) {
|
|
22
|
-
super(context);
|
|
23
|
-
mView = new SkiaTextureView(context, this, debug);
|
|
24
|
-
addView(mView);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Override
|
|
28
|
-
public boolean dispatchTouchEvent(MotionEvent ev) {
|
|
29
|
-
// When pointerEvents is "none" or "box-none", make this view completely
|
|
30
|
-
// transparent to touch dispatch so events pass through to views behind it
|
|
31
|
-
if (!PointerEvents.canBeTouchTarget(getPointerEvents())) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return super.dispatchTouchEvent(ev);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public void setOpaque(boolean value) {
|
|
38
|
-
if (value && mView instanceof SkiaTextureView) {
|
|
39
|
-
recreateView(true);
|
|
40
|
-
} else if (!value && mView instanceof SkiaSurfaceView) {
|
|
41
|
-
recreateView(false);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public void setHighBitDepth(boolean value) {
|
|
46
|
-
if (mHighBitDepth == value) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
mHighBitDepth = value;
|
|
50
|
-
// The flag only affects the opaque SurfaceView path (see
|
|
51
|
-
// highBitDepthIfOpaque), so only that surface needs to be recreated
|
|
52
|
-
// with the new buffer format.
|
|
53
|
-
if (mView instanceof SkiaSurfaceView) {
|
|
54
|
-
recreateView(true);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private void recreateView(boolean useSurfaceView) {
|
|
59
|
-
removeView(mView);
|
|
60
|
-
mView = useSurfaceView
|
|
61
|
-
? new SkiaSurfaceView(getContext(), this, debug)
|
|
62
|
-
: new SkiaTextureView(getContext(), this, debug);
|
|
63
|
-
addView(mView);
|
|
64
|
-
// React Native sizes native children explicitly through onLayout, so
|
|
65
|
-
// the requestLayout triggered by addView is ignored; size the new
|
|
66
|
-
// child ourselves or it stays 0x0 and never gets a surface.
|
|
67
|
-
if (getWidth() > 0 || getHeight() > 0) {
|
|
68
|
-
mView.layout(0, 0, getWidth(), getHeight());
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private boolean highBitDepthIfOpaque(boolean opaque) {
|
|
73
|
-
if (mHighBitDepth && !opaque) {
|
|
74
|
-
// The 10-bit buffer format only has 2 bits of alpha, which would
|
|
75
|
-
// visibly break translucency; the extra precision would also be
|
|
76
|
-
// lost in the 8-bit composition pass.
|
|
77
|
-
Log.w(tag, "highBitDepth requires the opaque prop on Android, falling back to the 8-bit format");
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return mHighBitDepth;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
void dropInstance() {
|
|
84
|
-
if (!RNSkiaModule.isModuleValid()) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
unregisterView();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@Override
|
|
91
|
-
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
92
|
-
super.onLayout(changed, left, top, right, bottom);
|
|
93
|
-
mView.layout(0, 0, right - left, bottom - top);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@Override
|
|
97
|
-
public void onSurfaceCreated(Surface surface, int width, int height) {
|
|
98
|
-
surfaceAvailable(surface, width, height, true, mHighBitDepth);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@Override
|
|
102
|
-
public void onSurfaceChanged(Surface surface, int width, int height) {
|
|
103
|
-
Log.i(tag, "onSurfaceTextureSizeChanged " + width + "/" + height);
|
|
104
|
-
surfaceSizeChanged(surface, width, height, true, mHighBitDepth);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@Override
|
|
108
|
-
public void onSurfaceTextureCreated(SurfaceTexture surface, int width, int height) {
|
|
109
|
-
surfaceAvailable(surface, width, height, false, highBitDepthIfOpaque(false));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@Override
|
|
113
|
-
public void onSurfaceTextureChanged(SurfaceTexture surface, int width, int height) {
|
|
114
|
-
Log.i(tag, "onSurfaceTextureSizeChanged " + width + "/" + height);
|
|
115
|
-
surfaceSizeChanged(surface, width, height, false, highBitDepthIfOpaque(false));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@Override
|
|
119
|
-
public void onSurfaceDestroyed() {
|
|
120
|
-
surfaceDestroyed();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
protected abstract void surfaceAvailable(Object surface, int width, int height, boolean opaque, boolean highBitDepth);
|
|
124
|
-
|
|
125
|
-
protected abstract void surfaceSizeChanged(Object surface, int width, int height, boolean opaque, boolean highBitDepth);
|
|
126
|
-
|
|
127
|
-
protected abstract void surfaceDestroyed();
|
|
128
|
-
|
|
129
|
-
protected abstract void setDebugMode(boolean show);
|
|
130
|
-
|
|
131
|
-
protected abstract void registerView(int nativeId);
|
|
132
|
-
|
|
133
|
-
protected abstract void unregisterView();
|
|
134
|
-
|
|
135
|
-
protected abstract int[] getBitmap(int width, int height);
|
|
136
|
-
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
15
|
-
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
-
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
17
|
-
|
|
18
|
-
public class SkiaPictureViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SkiaPictureViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
-
public SkiaPictureViewManagerDelegate(U viewManager) {
|
|
20
|
-
super(viewManager);
|
|
21
|
-
}
|
|
22
|
-
@Override
|
|
23
|
-
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
-
switch (propName) {
|
|
25
|
-
case "debug":
|
|
26
|
-
mViewManager.setDebug(view, value != null && (boolean) value);
|
|
27
|
-
break;
|
|
28
|
-
case "opaque":
|
|
29
|
-
mViewManager.setOpaque(view, value != null && (boolean) value);
|
|
30
|
-
break;
|
|
31
|
-
case "colorSpace":
|
|
32
|
-
mViewManager.setColorSpace(view, value == null ? null : (String) value);
|
|
33
|
-
break;
|
|
34
|
-
case "androidWarmup":
|
|
35
|
-
mViewManager.setAndroidWarmup(view, value != null && (boolean) value);
|
|
36
|
-
break;
|
|
37
|
-
default:
|
|
38
|
-
super.setProperty(view, propName, value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
|
|
15
|
-
public interface SkiaPictureViewManagerInterface<T extends View> {
|
|
16
|
-
void setDebug(T view, boolean value);
|
|
17
|
-
void setOpaque(T view, boolean value);
|
|
18
|
-
void setColorSpace(T view, @Nullable String value);
|
|
19
|
-
void setAndroidWarmup(T view, boolean value);
|
|
20
|
-
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
import androidx.annotation.Nullable;
|
|
14
|
-
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
15
|
-
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
-
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
17
|
-
|
|
18
|
-
public class SkiaWebGPUViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SkiaWebGPUViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
-
public SkiaWebGPUViewManagerDelegate(U viewManager) {
|
|
20
|
-
super(viewManager);
|
|
21
|
-
}
|
|
22
|
-
@Override
|
|
23
|
-
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
-
switch (propName) {
|
|
25
|
-
case "contextId":
|
|
26
|
-
mViewManager.setContextId(view, value == null ? 0 : ((Double) value).intValue());
|
|
27
|
-
break;
|
|
28
|
-
case "transparent":
|
|
29
|
-
mViewManager.setTransparent(view, value != null && (boolean) value);
|
|
30
|
-
break;
|
|
31
|
-
default:
|
|
32
|
-
super.setProperty(view, propName, value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.viewmanagers;
|
|
11
|
-
|
|
12
|
-
import android.view.View;
|
|
13
|
-
|
|
14
|
-
public interface SkiaWebGPUViewManagerInterface<T extends View> {
|
|
15
|
-
void setContextId(T view, int value);
|
|
16
|
-
void setTransparent(T view, boolean value);
|
|
17
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.shopify.reactnative.skia;
|
|
14
|
-
|
|
15
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
-
import com.facebook.react.bridge.ReactModuleWithSpec;
|
|
20
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
-
import javax.annotation.Nonnull;
|
|
22
|
-
|
|
23
|
-
public abstract class NativeSkiaModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
|
|
24
|
-
public static final String NAME = "RNSkiaModule";
|
|
25
|
-
|
|
26
|
-
public NativeSkiaModuleSpec(ReactApplicationContext reactContext) {
|
|
27
|
-
super(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public @Nonnull String getName() {
|
|
32
|
-
return NAME;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
36
|
-
@DoNotStrip
|
|
37
|
-
public abstract boolean install();
|
|
38
|
-
}
|
package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package com.shopify.reactnative.skia;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.OptIn;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReactContext;
|
|
6
|
-
import com.facebook.react.bridge.RuntimeExecutor;
|
|
7
|
-
import com.facebook.react.common.annotations.FrameworkAPI;
|
|
8
|
-
|
|
9
|
-
/* package */ final class ReactNativeCompatible {
|
|
10
|
-
@OptIn(markerClass = FrameworkAPI.class)
|
|
11
|
-
public static RuntimeExecutor getRuntimeExecutor(ReactContext context) {
|
|
12
|
-
return context.getRuntimeExecutor();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
#include "SkiaPictureViewManager.h"
|
|
3
|
-
#include <React/RCTBridge+Private.h>
|
|
4
|
-
|
|
5
|
-
#include "RNSkAppleView.h"
|
|
6
|
-
#include "RNSkPictureView.h"
|
|
7
|
-
#include "RNSkPlatformContext.h"
|
|
8
|
-
|
|
9
|
-
#include "RNSkiaModule.h"
|
|
10
|
-
#include "SkiaManager.h"
|
|
11
|
-
#include "SkiaUIView.h"
|
|
12
|
-
|
|
13
|
-
@implementation SkiaPictureViewManager
|
|
14
|
-
|
|
15
|
-
RCT_EXPORT_MODULE(SkiaPictureView)
|
|
16
|
-
|
|
17
|
-
- (SkiaManager *)skiaManager {
|
|
18
|
-
auto bridge = self.bridge;
|
|
19
|
-
RCTAssert(bridge, @"Bridge must not be nil.");
|
|
20
|
-
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkiaModule"];
|
|
21
|
-
return [skiaModule manager];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
|
|
25
|
-
// Get parameter
|
|
26
|
-
int nativeId = [[RCTConvert NSString:json] intValue];
|
|
27
|
-
[(SkiaUIView *)view setNativeId:nativeId];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
|
|
31
|
-
bool debug = json != NULL ? [RCTConvert BOOL:json] : false;
|
|
32
|
-
[(SkiaUIView *)view setDebugMode:debug];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
RCT_CUSTOM_VIEW_PROPERTY(opaque, BOOL, SkiaUIView) {
|
|
36
|
-
bool opaque = json != NULL ? [RCTConvert BOOL:json] : false;
|
|
37
|
-
[(SkiaUIView *)view setOpaque:opaque];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
RCT_CUSTOM_VIEW_PROPERTY(highBitDepth, BOOL, SkiaUIView) {
|
|
41
|
-
bool highBitDepth = json != NULL ? [RCTConvert BOOL:json] : false;
|
|
42
|
-
[(SkiaUIView *)view setHighBitDepth:highBitDepth];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#if !TARGET_OS_OSX
|
|
46
|
-
- (UIView *)view {
|
|
47
|
-
#else
|
|
48
|
-
- (RCTUIView *)view {
|
|
49
|
-
#endif // !TARGET_OS_OSX
|
|
50
|
-
auto skManager = [[self skiaManager] skManager];
|
|
51
|
-
// Pass SkManager as a raw pointer to avoid circular dependenciesr
|
|
52
|
-
return [[SkiaUIView alloc]
|
|
53
|
-
initWithManager:skManager.get()
|
|
54
|
-
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
|
55
|
-
return std::make_shared<RNSkAppleView<RNSkia::RNSkPictureView>>(
|
|
56
|
-
context);
|
|
57
|
-
}];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@end
|
package/apple/SkiaWebGPUView.h
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
-
|
|
5
|
-
#import "WebGPUMetalView.h"
|
|
6
|
-
#import <React/RCTViewComponentView.h>
|
|
7
|
-
#if !TARGET_OS_OSX
|
|
8
|
-
#import <UIKit/UIKit.h>
|
|
9
|
-
#else
|
|
10
|
-
#import <AppKit/AppKit.h>
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
14
|
-
|
|
15
|
-
@interface SkiaWebGPUView : RCTViewComponentView
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
NS_ASSUME_NONNULL_END
|
|
19
|
-
|
|
20
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
package/apple/WebGPUMetalView.h
DELETED
package/cpp/api/JsiSkiaContext.h
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
#include <numeric>
|
|
5
|
-
#include <utility>
|
|
6
|
-
#include <variant>
|
|
7
|
-
#include <vector>
|
|
8
|
-
|
|
9
|
-
#include "JsiSkConverters.h"
|
|
10
|
-
#include "JsiSkNativeObjects.h"
|
|
11
|
-
#include "utils/RNSkLog.h"
|
|
12
|
-
#include <jsi/jsi.h>
|
|
13
|
-
|
|
14
|
-
#include "JsiSkPaint.h"
|
|
15
|
-
#include "JsiSkPoint.h"
|
|
16
|
-
#include "JsiSkRect.h"
|
|
17
|
-
#include "JsiSkSurface.h"
|
|
18
|
-
#include "JsiSkTypeface.h"
|
|
19
|
-
|
|
20
|
-
#include "rnskia/RNWindowContext.h"
|
|
21
|
-
|
|
22
|
-
#pragma clang diagnostic push
|
|
23
|
-
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
24
|
-
|
|
25
|
-
#include "include/core/SkFont.h"
|
|
26
|
-
#include "include/core/SkFontMetrics.h"
|
|
27
|
-
|
|
28
|
-
#pragma clang diagnostic pop
|
|
29
|
-
|
|
30
|
-
namespace RNSkia {
|
|
31
|
-
|
|
32
|
-
namespace jsi = facebook::jsi;
|
|
33
|
-
|
|
34
|
-
class JsiSkiaContext
|
|
35
|
-
: public JsiSkWrappingSharedPtrNativeObject<JsiSkiaContext, WindowContext> {
|
|
36
|
-
public:
|
|
37
|
-
static constexpr const char *CLASS_NAME = "SkiaContext";
|
|
38
|
-
|
|
39
|
-
std::variant<std::nullptr_t, std::shared_ptr<JsiSkSurface>> getSurface() {
|
|
40
|
-
auto surface = getObject()->getSurface();
|
|
41
|
-
if (surface == nullptr) {
|
|
42
|
-
return nullptr;
|
|
43
|
-
}
|
|
44
|
-
return std::make_shared<JsiSkSurface>(getContext(), std::move(surface));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
void present() { getObject()->present(); }
|
|
48
|
-
|
|
49
|
-
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
50
|
-
installCommon(runtime, prototype);
|
|
51
|
-
installMethod(runtime, prototype, "getSurface",
|
|
52
|
-
&JsiSkiaContext::getSurface);
|
|
53
|
-
installMethod(runtime, prototype, "present", &JsiSkiaContext::present);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
JsiSkiaContext(std::shared_ptr<RNSkPlatformContext> context,
|
|
57
|
-
std::shared_ptr<WindowContext> ctx)
|
|
58
|
-
: JsiSkWrappingSharedPtrNativeObject<JsiSkiaContext, WindowContext>(
|
|
59
|
-
std::move(context), std::move(ctx)) {}
|
|
60
|
-
|
|
61
|
-
size_t getMemoryPressure() override { return 10 * 1024 * 1024; }
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Creates the function for construction a new instance of the SkFont
|
|
65
|
-
* wrapper
|
|
66
|
-
* @param context Platform context
|
|
67
|
-
* @return A function for creating a new host object wrapper for the SkFont
|
|
68
|
-
* class
|
|
69
|
-
*/
|
|
70
|
-
static const jsi::HostFunctionType
|
|
71
|
-
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
|
72
|
-
return JSI_HOST_FUNCTION_LAMBDA {
|
|
73
|
-
jsi::BigInt pointer = arguments[0].asBigInt(runtime);
|
|
74
|
-
const uintptr_t nativeBufferPointer = pointer.asUint64(runtime);
|
|
75
|
-
void *surface = reinterpret_cast<void *>(nativeBufferPointer);
|
|
76
|
-
auto width = static_cast<int>(arguments[1].asNumber());
|
|
77
|
-
auto height = static_cast<int>(arguments[2].asNumber());
|
|
78
|
-
if (surface == nullptr) {
|
|
79
|
-
throw std::runtime_error("Surface is null");
|
|
80
|
-
}
|
|
81
|
-
auto result =
|
|
82
|
-
context->makeContextFromNativeSurface(surface, width, height);
|
|
83
|
-
if (result == nullptr) {
|
|
84
|
-
throw std::runtime_error(
|
|
85
|
-
"Couldn't create a Skia context from the native surface");
|
|
86
|
-
}
|
|
87
|
-
// Return the newly constructed object
|
|
88
|
-
return makeJsiObject(runtime, std::make_shared<JsiSkiaContext>(
|
|
89
|
-
context, std::move(result)));
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
} // namespace RNSkia
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Dawn & Tint Authors
|
|
2
|
-
//
|
|
3
|
-
// Redistribution and use in source and binary forms, with or without
|
|
4
|
-
// modification, are permitted provided that the following conditions are met:
|
|
5
|
-
//
|
|
6
|
-
// 1. Redistributions of source code must retain the above copyright notice, this
|
|
7
|
-
// list of conditions and the following disclaimer.
|
|
8
|
-
//
|
|
9
|
-
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
-
// this list of conditions and the following disclaimer in the documentation
|
|
11
|
-
// and/or other materials provided with the distribution.
|
|
12
|
-
//
|
|
13
|
-
// 3. Neither the name of the copyright holder nor the names of its
|
|
14
|
-
// contributors may be used to endorse or promote products derived from
|
|
15
|
-
// this software without specific prior written permission.
|
|
16
|
-
//
|
|
17
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
-
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
-
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
|
|
28
|
-
#ifndef INCLUDE_DAWN_DAWN_PROC_H_
|
|
29
|
-
#define INCLUDE_DAWN_DAWN_PROC_H_
|
|
30
|
-
|
|
31
|
-
#include <webgpu/webgpu.h>
|
|
32
|
-
|
|
33
|
-
#include "dawn/dawn_proc_table.h"
|
|
34
|
-
|
|
35
|
-
#ifdef __cplusplus
|
|
36
|
-
extern "C" {
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
// Sets the static proctable used by libdawn_proc to implement the Dawn entrypoints. Passing NULL
|
|
40
|
-
// for `procs` sets up the null proctable that contains only null function pointers. It is the
|
|
41
|
-
// default value of the proctable. Setting the proctable back to null is good practice when you
|
|
42
|
-
// are done using libdawn_proc since further usage will cause a segfault instead of calling an
|
|
43
|
-
// unexpected function.
|
|
44
|
-
WGPU_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
|
|
45
|
-
|
|
46
|
-
// Returns the static array of uint8_t of size 20 representing the Dawn version.
|
|
47
|
-
WGPU_EXPORT const uint8_t* dawnProcGetVersion();
|
|
48
|
-
|
|
49
|
-
#ifdef __cplusplus
|
|
50
|
-
} // extern "C"
|
|
51
|
-
#endif
|
|
52
|
-
|
|
53
|
-
#endif // INCLUDE_DAWN_DAWN_PROC_H_
|