@shopify/react-native-skia 0.1.154 → 0.1.156
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/jni/JniLoad.cpp +5 -5
- package/android/cpp/jni/JniPlatformContext.cpp +107 -119
- package/android/cpp/jni/JniSkiaManager.cpp +18 -20
- package/android/cpp/jni/include/JniPlatformContext.h +41 -45
- package/android/cpp/jni/include/JniSkiaBaseView.h +52 -55
- package/android/cpp/jni/include/JniSkiaDrawView.h +72 -77
- package/android/cpp/jni/include/JniSkiaManager.h +51 -53
- package/android/cpp/jni/include/JniSkiaPictureView.h +74 -78
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +36 -45
- package/android/cpp/rnskia-android/RNSkAndroidView.h +87 -92
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +62 -65
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +20 -17
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +257 -313
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +107 -110
- package/cpp/api/JsiSkApi.h +66 -62
- package/cpp/api/JsiSkCanvas.h +38 -30
- package/cpp/api/JsiSkColor.h +58 -56
- package/cpp/api/JsiSkColorFilter.h +5 -3
- package/cpp/api/JsiSkColorFilterFactory.h +23 -21
- package/cpp/api/JsiSkContourMeasure.h +74 -85
- package/cpp/api/JsiSkContourMeasureIter.h +68 -75
- package/cpp/api/JsiSkData.h +16 -22
- package/cpp/api/JsiSkDataFactory.h +86 -79
- package/cpp/api/JsiSkFont.h +286 -311
- package/cpp/api/JsiSkHostObjects.h +15 -16
- package/cpp/api/JsiSkImage.h +107 -103
- package/cpp/api/JsiSkImageFactory.h +34 -36
- package/cpp/api/JsiSkImageFilter.h +5 -3
- package/cpp/api/JsiSkImageFilterFactory.h +71 -68
- package/cpp/api/JsiSkImageInfo.h +41 -38
- package/cpp/api/JsiSkMaskFilter.h +5 -3
- package/cpp/api/JsiSkMaskFilterFactory.h +2 -3
- package/cpp/api/JsiSkMatrix.h +26 -36
- package/cpp/api/JsiSkPaint.h +20 -13
- package/cpp/api/JsiSkPath.h +70 -85
- package/cpp/api/JsiSkPathEffect.h +5 -3
- package/cpp/api/JsiSkPathEffectFactory.h +33 -28
- package/cpp/api/JsiSkPathFactory.h +68 -67
- package/cpp/api/JsiSkPicture.h +28 -22
- package/cpp/api/JsiSkPictureFactory.h +13 -12
- package/cpp/api/JsiSkPictureRecorder.h +21 -19
- package/cpp/api/JsiSkPoint.h +6 -8
- package/cpp/api/JsiSkRRect.h +11 -7
- package/cpp/api/JsiSkRSXform.h +82 -85
- package/cpp/api/JsiSkRect.h +9 -9
- package/cpp/api/JsiSkRuntimeEffect.h +182 -186
- package/cpp/api/JsiSkRuntimeEffectFactory.h +10 -11
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +64 -61
- package/cpp/api/JsiSkSVG.h +4 -5
- package/cpp/api/JsiSkSVGFactory.h +28 -27
- package/cpp/api/JsiSkShader.h +3 -2
- package/cpp/api/JsiSkShaderFactory.h +37 -25
- package/cpp/api/JsiSkSurface.h +44 -40
- package/cpp/api/JsiSkSurfaceFactory.h +22 -22
- package/cpp/api/JsiSkTextBlob.h +28 -31
- package/cpp/api/JsiSkTextBlobFactory.h +88 -87
- package/cpp/api/JsiSkTypeface.h +6 -5
- package/cpp/api/JsiSkTypefaceFactory.h +22 -21
- package/cpp/api/JsiSkVertices.h +137 -124
- package/cpp/api/third_party/CSSColorParser.cpp +161 -174
- package/cpp/api/third_party/CSSColorParser.h +172 -96
- package/cpp/jsi/JsiHostObject.cpp +11 -9
- package/cpp/jsi/JsiHostObject.h +31 -24
- package/cpp/jsi/JsiSimpleValueWrapper.h +74 -83
- package/cpp/jsi/JsiValueWrapper.h +52 -54
- package/cpp/rnskia/RNSkAnimation.h +26 -29
- package/cpp/rnskia/RNSkDispatchQueue.cpp +50 -61
- package/cpp/rnskia/RNSkDispatchQueue.h +3 -1
- package/cpp/rnskia/RNSkInfoParameter.h +12 -12
- package/cpp/rnskia/RNSkJsView.cpp +82 -81
- package/cpp/rnskia/RNSkJsView.h +45 -41
- package/cpp/rnskia/RNSkJsiViewApi.h +99 -89
- package/cpp/rnskia/RNSkManager.cpp +8 -7
- package/cpp/rnskia/RNSkManager.h +8 -6
- package/cpp/rnskia/RNSkPictureView.h +44 -37
- package/cpp/rnskia/RNSkPlatformContext.h +39 -28
- package/cpp/rnskia/RNSkValueApi.h +33 -34
- package/cpp/rnskia/RNSkView.h +108 -93
- package/cpp/rnskia/values/RNSkClockValue.h +63 -64
- package/cpp/rnskia/values/RNSkComputedValue.h +32 -30
- package/cpp/rnskia/values/RNSkReadonlyValue.h +60 -59
- package/cpp/rnskia/values/RNSkValue.h +38 -40
- package/cpp/utils/RNSkLog.h +9 -7
- package/cpp/utils/RNSkMeasureTime.h +7 -7
- package/cpp/utils/RNSkTimingInfo.h +27 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +8 -9
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +24 -23
- package/ios/RNSkia-iOS/RNSkiOSView.h +16 -13
- package/ios/RNSkia-iOS/SkiaUIView.h +9 -8
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +6 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/LayerNode.js +43 -0
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.js +1 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js +3 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +19 -4
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +6 -1
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +3 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +6 -3
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +5 -0
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/LayerNode.js +32 -0
- package/lib/module/dom/nodes/LayerNode.js.map +1 -0
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/types/NodeType.js +1 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/renderer/HostComponents.js +3 -0
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/components/Group.js +16 -3
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +7 -1
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +4 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/LayerNode.d.ts +8 -0
- package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -0
- package/lib/typescript/src/renderer/HostComponents.d.ts +2 -1
- package/lib/typescript/src/renderer/components/Group.d.ts +5 -1
- package/lib/typescript/src/views/SkiaView.d.ts +3 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +42 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +42 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -1
- package/src/dom/nodes/JsiSkDOM.ts +5 -0
- package/src/dom/nodes/LayerNode.ts +35 -0
- package/src/dom/nodes/RenderNode.ts +4 -3
- package/src/dom/types/NodeType.ts +1 -0
- package/src/dom/types/SkDOM.ts +1 -0
- package/src/renderer/HostComponents.ts +3 -0
- package/src/renderer/components/Group.tsx +16 -3
- package/src/renderer/components/Paint.tsx +7 -1
- package/src/views/SkiaPictureView.tsx +2 -3
- package/src/views/SkiaView.tsx +2 -2
@@ -3,90 +3,97 @@
|
|
3
3
|
#include <memory>
|
4
4
|
#include <utility>
|
5
5
|
|
6
|
-
#include <jsi/jsi.h>
|
7
6
|
#include <ReactCommon/TurboModuleUtils.h>
|
7
|
+
#include <jsi/jsi.h>
|
8
8
|
|
9
|
-
#include
|
9
|
+
#include <SkBase64.h>
|
10
10
|
|
11
|
+
#include "JsiSkData.h"
|
11
12
|
|
12
13
|
namespace RNSkia {
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
15
|
+
namespace jsi = facebook::jsi;
|
16
|
+
namespace react = facebook::react;
|
17
|
+
|
18
|
+
class JsiSkDataFactory : public JsiSkHostObject {
|
19
|
+
public:
|
20
|
+
JSI_HOST_FUNCTION(fromURI) {
|
21
|
+
auto jsiLocalUri = arguments[0].asString(runtime);
|
22
|
+
auto localUri = jsiLocalUri.utf8(runtime);
|
23
|
+
auto context = getContext();
|
24
|
+
return react::createPromiseAsJSIValue(
|
25
|
+
runtime,
|
26
|
+
[context = std::move(context), localUri = std::move(localUri)](
|
27
|
+
jsi::Runtime &runtime,
|
28
|
+
std::shared_ptr<react::Promise> promise) -> void {
|
29
|
+
// Create a stream operation - this will be run in a
|
30
|
+
// separate thread
|
31
|
+
context->performStreamOperation(
|
32
|
+
localUri,
|
33
|
+
[&runtime, context = std::move(context),
|
34
|
+
promise = std::move(promise)](
|
35
|
+
std::unique_ptr<SkStreamAsset> stream) -> void {
|
36
|
+
// Schedule drawCallback on the Javascript thread
|
37
|
+
auto result =
|
38
|
+
SkData::MakeFromStream(stream.get(), stream->getLength());
|
39
|
+
context->runOnJavascriptThread([&runtime,
|
40
|
+
context = std::move(context),
|
41
|
+
promise = std::move(promise),
|
42
|
+
result = std::move(result)]() {
|
43
|
+
promise->resolve(jsi::Object::createFromHostObject(
|
44
|
+
runtime, std::make_shared<JsiSkData>(std::move(context),
|
45
|
+
std::move(result))));
|
46
|
+
});
|
47
|
+
});
|
48
|
+
});
|
49
|
+
};
|
50
|
+
|
51
|
+
JSI_HOST_FUNCTION(fromBytes) {
|
52
|
+
auto array = arguments[0].asObject(runtime);
|
53
|
+
jsi::ArrayBuffer buffer =
|
54
|
+
array.getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer"))
|
55
|
+
.asObject(runtime)
|
56
|
+
.getArrayBuffer(runtime);
|
57
|
+
|
58
|
+
auto data =
|
59
|
+
SkData::MakeWithCopy(buffer.data(runtime), buffer.size(runtime));
|
60
|
+
return jsi::Object::createFromHostObject(
|
61
|
+
runtime, std::make_shared<JsiSkData>(getContext(), std::move(data)));
|
62
|
+
}
|
63
|
+
|
64
|
+
JSI_HOST_FUNCTION(fromBase64) {
|
65
|
+
auto base64 = arguments[0].asString(runtime);
|
66
|
+
auto base64Str = base64.utf8(runtime);
|
67
|
+
auto size = base64Str.size();
|
68
|
+
|
69
|
+
// Calculate length
|
70
|
+
size_t len;
|
71
|
+
auto err =
|
72
|
+
SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size, nullptr, &len);
|
73
|
+
if (err != SkBase64::Error::kNoError) {
|
74
|
+
throw jsi::JSError(runtime, "Error decoding base64 string");
|
75
|
+
return jsi::Value::undefined();
|
76
|
+
}
|
77
|
+
|
78
|
+
// Create data object and decode
|
79
|
+
auto data = SkData::MakeUninitialized(len);
|
80
|
+
err = SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size,
|
81
|
+
data->writable_data(), &len);
|
82
|
+
if (err != SkBase64::Error::kNoError) {
|
83
|
+
throw jsi::JSError(runtime, "Error decoding base64 string");
|
84
|
+
return jsi::Value::undefined();
|
85
|
+
}
|
86
|
+
|
87
|
+
return jsi::Object::createFromHostObject(
|
88
|
+
runtime, std::make_shared<JsiSkData>(getContext(), std::move(data)));
|
89
|
+
}
|
90
|
+
|
91
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkDataFactory, fromURI),
|
92
|
+
JSI_EXPORT_FUNC(JsiSkDataFactory, fromBytes),
|
93
|
+
JSI_EXPORT_FUNC(JsiSkDataFactory, fromBase64))
|
94
|
+
|
95
|
+
explicit JsiSkDataFactory(std::shared_ptr<RNSkPlatformContext> context)
|
96
|
+
: JsiSkHostObject(std::move(context)) {}
|
97
|
+
};
|
91
98
|
|
92
99
|
} // namespace RNSkia
|