@shopify/react-native-skia 2.2.11 → 2.2.13
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/cpp/api/JsiNativeBuffer.h +2 -0
- package/cpp/api/JsiSkAnimatedImage.h +6 -2
- package/cpp/api/JsiSkAnimatedImageFactory.h +6 -3
- package/cpp/api/JsiSkApi.h +2 -0
- package/cpp/api/JsiSkCanvas.h +2 -0
- package/cpp/api/JsiSkColorFilter.h +2 -0
- package/cpp/api/JsiSkColorFilterFactory.h +31 -23
- package/cpp/api/JsiSkContourMeasure.h +8 -4
- package/cpp/api/JsiSkContourMeasureIter.h +10 -4
- package/cpp/api/JsiSkData.h +5 -0
- package/cpp/api/JsiSkDataFactory.h +14 -7
- package/cpp/api/JsiSkFont.h +17 -10
- package/cpp/api/JsiSkFontMgr.h +6 -2
- package/cpp/api/JsiSkFontMgrFactory.h +5 -2
- package/cpp/api/JsiSkFontStyle.h +6 -3
- package/cpp/api/JsiSkHostObjects.h +21 -44
- package/cpp/api/JsiSkImage.h +17 -8
- package/cpp/api/JsiSkImageFactory.h +26 -13
- package/cpp/api/JsiSkImageFilter.h +2 -0
- package/cpp/api/JsiSkImageFilterFactory.h +160 -143
- package/cpp/api/JsiSkImageInfo.h +6 -3
- package/cpp/api/JsiSkMaskFilter.h +2 -0
- package/cpp/api/JsiSkMaskFilterFactory.h +7 -5
- package/cpp/api/JsiSkMatrix.h +6 -2
- package/cpp/api/JsiSkPaint.h +9 -4
- package/cpp/api/JsiSkParagraph.h +2 -0
- package/cpp/api/JsiSkParagraphBuilder.h +6 -3
- package/cpp/api/JsiSkParagraphBuilderFactory.h +6 -3
- package/cpp/api/JsiSkPath.h +33 -15
- package/cpp/api/JsiSkPathEffect.h +2 -0
- package/cpp/api/JsiSkPathEffectFactory.h +37 -32
- package/cpp/api/JsiSkPathFactory.h +22 -10
- package/cpp/api/JsiSkPicture.h +13 -2
- package/cpp/api/JsiSkPictureFactory.h +6 -2
- package/cpp/api/JsiSkPictureRecorder.h +14 -6
- package/cpp/api/JsiSkPoint.h +9 -5
- package/cpp/api/JsiSkRRect.h +13 -8
- package/cpp/api/JsiSkRSXform.h +14 -8
- package/cpp/api/JsiSkRect.h +13 -8
- package/cpp/api/JsiSkRuntimeEffect.h +10 -6
- package/cpp/api/JsiSkRuntimeEffectFactory.h +6 -3
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +12 -6
- package/cpp/api/JsiSkSVG.h +24 -0
- package/cpp/api/JsiSkSVGFactory.h +8 -4
- package/cpp/api/JsiSkShader.h +2 -0
- package/cpp/api/JsiSkShaderFactory.h +34 -24
- package/cpp/api/JsiSkSkottie.h +29 -0
- package/cpp/api/JsiSkSurface.h +21 -5
- package/cpp/api/JsiSkSurfaceFactory.h +10 -6
- package/cpp/api/JsiSkTextBlob.h +12 -0
- package/cpp/api/JsiSkTextBlobFactory.h +18 -12
- package/cpp/api/JsiSkTypeface.h +19 -3
- package/cpp/api/JsiSkTypefaceFactory.h +6 -2
- package/cpp/api/JsiSkTypefaceFontProvider.h +10 -5
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +6 -3
- package/cpp/api/JsiSkVertices.h +16 -5
- package/cpp/api/JsiSkiaContext.h +10 -6
- package/cpp/api/JsiSkottieFactory.h +6 -3
- package/cpp/api/JsiVideo.h +10 -5
- package/cpp/api/recorder/JsiRecorder.h +9 -4
- package/cpp/jsi/JsiHostObject.h +3 -3
- package/cpp/rnskia/RNSkJsiViewApi.h +10 -2
- package/package.json +1 -1
package/cpp/api/JsiVideo.h
CHANGED
@@ -39,8 +39,10 @@ public:
|
|
39
39
|
if (!image) {
|
40
40
|
return jsi::Value::null();
|
41
41
|
}
|
42
|
-
|
43
|
-
|
42
|
+
auto hostObjectInstance =
|
43
|
+
std::make_shared<JsiSkImage>(getContext(), std::move(image));
|
44
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
45
|
+
runtime, hostObjectInstance, getContext());
|
44
46
|
}
|
45
47
|
|
46
48
|
JSI_HOST_FUNCTION(duration) { return getObject()->duration(); }
|
@@ -96,6 +98,8 @@ public:
|
|
96
98
|
: JsiSkWrappingSharedPtrHostObject(std::move(context), std::move(video)) {
|
97
99
|
}
|
98
100
|
|
101
|
+
size_t getMemoryPressure() const override { return 32768; }
|
102
|
+
|
99
103
|
/**
|
100
104
|
* Creates the function for construction a new instance of the SkFont
|
101
105
|
* wrapper
|
@@ -109,9 +113,10 @@ public:
|
|
109
113
|
auto url = arguments[0].asString(runtime).utf8(runtime);
|
110
114
|
auto video = context->createVideo(url);
|
111
115
|
// Return the newly constructed object
|
112
|
-
|
113
|
-
|
114
|
-
|
116
|
+
auto videoObj =
|
117
|
+
std::make_shared<JsiVideo>(std::move(context), std::move(video));
|
118
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, videoObj,
|
119
|
+
context);
|
115
120
|
};
|
116
121
|
}
|
117
122
|
};
|
@@ -58,8 +58,10 @@ public:
|
|
58
58
|
DrawingCtx ctx(canvas);
|
59
59
|
getObject()->play(&ctx);
|
60
60
|
auto picture = pictureRecorder.finishRecordingAsPicture();
|
61
|
-
|
62
|
-
|
61
|
+
auto hostObjectInstance =
|
62
|
+
std::make_shared<JsiSkPicture>(getContext(), std::move(picture));
|
63
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
64
|
+
runtime, hostObjectInstance, getContext());
|
63
65
|
}
|
64
66
|
|
65
67
|
JSI_HOST_FUNCTION(applyUpdates) {
|
@@ -312,12 +314,15 @@ public:
|
|
312
314
|
JSI_EXPORT_FUNC(JsiRecorder, play),
|
313
315
|
JSI_EXPORT_FUNC(JsiRecorder, applyUpdates))
|
314
316
|
|
317
|
+
size_t getMemoryPressure() const override { return 16384; }
|
318
|
+
|
315
319
|
static const jsi::HostFunctionType
|
316
320
|
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
317
321
|
return JSI_HOST_FUNCTION_LAMBDA {
|
318
322
|
// Return the newly constructed object
|
319
|
-
|
320
|
-
|
323
|
+
auto recorder = std::make_shared<JsiRecorder>(std::move(context));
|
324
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, recorder,
|
325
|
+
context);
|
321
326
|
};
|
322
327
|
}
|
323
328
|
};
|
package/cpp/jsi/JsiHostObject.h
CHANGED
@@ -47,7 +47,7 @@
|
|
47
47
|
* Creates a JSI export function declaration
|
48
48
|
*/
|
49
49
|
#define JSI_EXPORT_FUNC(CLASS, FUNCTION) \
|
50
|
-
{#FUNCTION, (jsi::Value(JsiHostObject::*)(
|
50
|
+
{#FUNCTION, (jsi::Value (JsiHostObject::*)( \
|
51
51
|
jsi::Runtime & runtime, const jsi::Value &thisValue, \
|
52
52
|
const jsi::Value *arguments, size_t)) & \
|
53
53
|
CLASS::FUNCTION}
|
@@ -65,7 +65,7 @@
|
|
65
65
|
* Creates a JSI export getter declaration
|
66
66
|
*/
|
67
67
|
#define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \
|
68
|
-
{#FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) &
|
68
|
+
{#FUNCTION, (jsi::Value (JsiHostObject::*)(jsi::Runtime & runtime)) & \
|
69
69
|
CLASS::STR_CAT(STR_GET, FUNCTION)}
|
70
70
|
|
71
71
|
/**
|
@@ -83,7 +83,7 @@
|
|
83
83
|
*/
|
84
84
|
#define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \
|
85
85
|
{#FUNCTION, \
|
86
|
-
(void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) &
|
86
|
+
(void (JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
|
87
87
|
CLASS::STR_CAT(STR_SET, FUNCTION)}
|
88
88
|
|
89
89
|
/**
|
@@ -104,8 +104,16 @@ public:
|
|
104
104
|
auto name = arguments[1].asString(runtime).utf8(runtime);
|
105
105
|
if (name == "onSize" && isSharedValue(runtime, arguments[2])) {
|
106
106
|
jsi::Object size(runtime);
|
107
|
-
|
108
|
-
|
107
|
+
auto pd = _platformContext->getPixelDensity();
|
108
|
+
auto w = info->view != nullptr
|
109
|
+
? std::max(info->view->getScaledWidth(), 0)
|
110
|
+
: 0;
|
111
|
+
auto h = info->view != nullptr
|
112
|
+
? std::max(info->view->getScaledHeight(), 0)
|
113
|
+
: 0;
|
114
|
+
|
115
|
+
size.setProperty(runtime, "width", w / pd);
|
116
|
+
size.setProperty(runtime, "height", h / pd);
|
109
117
|
arguments[2].asObject(runtime).setProperty(runtime, "value", size);
|
110
118
|
} else {
|
111
119
|
info->props.insert_or_assign(
|
package/package.json
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
9
9
|
},
|
10
10
|
"title": "React Native Skia",
|
11
|
-
"version": "2.2.
|
11
|
+
"version": "2.2.13",
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
13
13
|
"main": "lib/module/index.js",
|
14
14
|
"react-native": "src/index.ts",
|