@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
@@ -42,11 +42,11 @@ public:
|
|
42
42
|
if (hasOptionalArgument(arguments, count, 4)) {
|
43
43
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[4]);
|
44
44
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
46
|
+
getContext(), SkImageFilters::Blur(sigmaX, sigmaY, (SkTileMode)tileMode,
|
47
|
+
imageFilter, cropRect));
|
48
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
49
|
+
getContext());
|
50
50
|
}
|
51
51
|
|
52
52
|
JSI_HOST_FUNCTION(MakeColorFilter) {
|
@@ -59,11 +59,11 @@ public:
|
|
59
59
|
if (hasOptionalArgument(arguments, count, 2)) {
|
60
60
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[2]);
|
61
61
|
}
|
62
|
-
|
63
|
-
|
64
|
-
std::
|
65
|
-
|
66
|
-
|
62
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
63
|
+
getContext(),
|
64
|
+
SkImageFilters::ColorFilter(std::move(cf), std::move(input), cropRect));
|
65
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
66
|
+
getContext());
|
67
67
|
}
|
68
68
|
|
69
69
|
JSI_HOST_FUNCTION(MakeOffset) {
|
@@ -77,10 +77,10 @@ public:
|
|
77
77
|
if (hasOptionalArgument(arguments, count, 3)) {
|
78
78
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[3]);
|
79
79
|
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
81
|
+
getContext(), SkImageFilters::Offset(x, y, std::move(input), cropRect));
|
82
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
83
|
+
getContext());
|
84
84
|
}
|
85
85
|
|
86
86
|
JSI_HOST_FUNCTION(MakeDisplacementMap) {
|
@@ -98,12 +98,12 @@ public:
|
|
98
98
|
if (hasOptionalArgument(arguments, count, 5)) {
|
99
99
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[5]);
|
100
100
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
102
|
+
getContext(), SkImageFilters::DisplacementMap(
|
103
|
+
fXChannelSelector, fYChannelSelector, scale,
|
104
|
+
std::move(in2), std::move(input), cropRect));
|
105
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
106
|
+
getContext());
|
107
107
|
}
|
108
108
|
|
109
109
|
JSI_HOST_FUNCTION(MakeShader) {
|
@@ -117,10 +117,11 @@ public:
|
|
117
117
|
if (hasOptionalArgument(arguments, count, 2)) {
|
118
118
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[2]);
|
119
119
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
121
|
+
getContext(),
|
122
|
+
SkImageFilters::Shader(std::move(shader), dither, cropRect));
|
123
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
124
|
+
getContext());
|
124
125
|
}
|
125
126
|
|
126
127
|
JSI_HOST_FUNCTION(MakeCompose) {
|
@@ -132,10 +133,11 @@ public:
|
|
132
133
|
if (hasOptionalArgument(arguments, count, 1)) {
|
133
134
|
inner = JsiSkImageFilter::fromValue(runtime, arguments[1]);
|
134
135
|
}
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
137
|
+
getContext(),
|
138
|
+
SkImageFilters::Compose(std::move(outer), std::move(inner)));
|
139
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
140
|
+
getContext());
|
139
141
|
}
|
140
142
|
|
141
143
|
JSI_HOST_FUNCTION(MakeBlend) {
|
@@ -153,11 +155,12 @@ public:
|
|
153
155
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[3]);
|
154
156
|
}
|
155
157
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
158
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
159
|
+
getContext(),
|
160
|
+
SkImageFilters::Blend(std::move(mode), std::move(background),
|
161
|
+
std::move(foreground), cropRect));
|
162
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
163
|
+
getContext());
|
161
164
|
}
|
162
165
|
|
163
166
|
JSI_HOST_FUNCTION(MakeDropShadow) {
|
@@ -174,11 +177,11 @@ public:
|
|
174
177
|
if (hasOptionalArgument(arguments, count, 6)) {
|
175
178
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[6]);
|
176
179
|
}
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
180
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
181
|
+
getContext(), SkImageFilters::DropShadow(dx, dy, sigmaX, sigmaY, color,
|
182
|
+
std::move(input), cropRect));
|
183
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
184
|
+
getContext());
|
182
185
|
}
|
183
186
|
|
184
187
|
JSI_HOST_FUNCTION(MakeDropShadowOnly) {
|
@@ -195,11 +198,12 @@ public:
|
|
195
198
|
if (hasOptionalArgument(arguments, count, 6)) {
|
196
199
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[6]);
|
197
200
|
}
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
201
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
202
|
+
getContext(),
|
203
|
+
SkImageFilters::DropShadowOnly(dx, dy, sigmaX, sigmaY, color,
|
204
|
+
std::move(input), cropRect));
|
205
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
206
|
+
getContext());
|
203
207
|
}
|
204
208
|
|
205
209
|
JSI_HOST_FUNCTION(MakeErode) {
|
@@ -213,10 +217,11 @@ public:
|
|
213
217
|
if (hasOptionalArgument(arguments, count, 3)) {
|
214
218
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[3]);
|
215
219
|
}
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
221
|
+
getContext(),
|
222
|
+
SkImageFilters::Erode(rx, ry, std::move(input), cropRect));
|
223
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
224
|
+
getContext());
|
220
225
|
}
|
221
226
|
|
222
227
|
JSI_HOST_FUNCTION(MakeDilate) {
|
@@ -230,10 +235,11 @@ public:
|
|
230
235
|
if (hasOptionalArgument(arguments, count, 3)) {
|
231
236
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[3]);
|
232
237
|
}
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
238
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
239
|
+
getContext(),
|
240
|
+
SkImageFilters::Dilate(rx, ry, std::move(input), cropRect));
|
241
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
242
|
+
getContext());
|
237
243
|
}
|
238
244
|
|
239
245
|
JSI_HOST_FUNCTION(MakeRuntimeShader) {
|
@@ -248,10 +254,11 @@ public:
|
|
248
254
|
if (hasOptionalArgument(arguments, count, 2)) {
|
249
255
|
input = JsiSkImageFilter::fromValue(runtime, arguments[2]);
|
250
256
|
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
257
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
258
|
+
getContext(),
|
259
|
+
SkImageFilters::RuntimeShader(*rtb, childName, std::move(input)));
|
260
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
261
|
+
getContext());
|
255
262
|
}
|
256
263
|
|
257
264
|
JSI_HOST_FUNCTION(MakeArithmetic) {
|
@@ -272,12 +279,12 @@ public:
|
|
272
279
|
if (hasOptionalArgument(arguments, count, 7)) {
|
273
280
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[7]);
|
274
281
|
}
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
282
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
283
|
+
getContext(), SkImageFilters::Arithmetic(
|
284
|
+
k1, k2, k3, k4, enforcePMColor, std::move(background),
|
285
|
+
std::move(foreground), cropRect));
|
286
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
287
|
+
getContext());
|
281
288
|
}
|
282
289
|
|
283
290
|
JSI_HOST_FUNCTION(MakeCrop) {
|
@@ -290,17 +297,18 @@ public:
|
|
290
297
|
if (hasOptionalArgument(arguments, count, 2)) {
|
291
298
|
imageFilter = JsiSkImageFilter::fromValue(runtime, arguments[2]);
|
292
299
|
}
|
293
|
-
|
294
|
-
|
295
|
-
std::
|
296
|
-
|
297
|
-
|
300
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
301
|
+
getContext(),
|
302
|
+
SkImageFilters::Crop(rect, tileMode, std::move(imageFilter)));
|
303
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
304
|
+
getContext());
|
298
305
|
}
|
299
306
|
|
300
307
|
JSI_HOST_FUNCTION(MakeEmpty) {
|
301
|
-
|
302
|
-
|
303
|
-
|
308
|
+
auto filter = std::make_shared<JsiSkImageFilter>(getContext(),
|
309
|
+
SkImageFilters::Empty());
|
310
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
311
|
+
getContext());
|
304
312
|
}
|
305
313
|
|
306
314
|
inline SkPoint3 SkPoint3FromValue(jsi::Runtime &runtime,
|
@@ -325,11 +333,12 @@ public:
|
|
325
333
|
if (hasOptionalArgument(arguments, count, 5)) {
|
326
334
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[5]);
|
327
335
|
}
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
336
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
337
|
+
getContext(),
|
338
|
+
SkImageFilters::DistantLitDiffuse(direction, lightColor, surfaceScale,
|
339
|
+
kd, std::move(input), cropRect));
|
340
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
341
|
+
getContext());
|
333
342
|
}
|
334
343
|
|
335
344
|
JSI_HOST_FUNCTION(MakePointLitDiffuse) {
|
@@ -345,11 +354,12 @@ public:
|
|
345
354
|
if (hasOptionalArgument(arguments, count, 5)) {
|
346
355
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[5]);
|
347
356
|
}
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
357
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
358
|
+
getContext(),
|
359
|
+
SkImageFilters::PointLitDiffuse(location, lightColor, surfaceScale, kd,
|
360
|
+
std::move(input), cropRect));
|
361
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
362
|
+
getContext());
|
353
363
|
}
|
354
364
|
|
355
365
|
JSI_HOST_FUNCTION(MakeSpotLitDiffuse) {
|
@@ -368,12 +378,13 @@ public:
|
|
368
378
|
if (hasOptionalArgument(arguments, count, 8)) {
|
369
379
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[8]);
|
370
380
|
}
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
location, target, falloffExponent,
|
381
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
382
|
+
getContext(),
|
383
|
+
SkImageFilters::SpotLitDiffuse(location, target, falloffExponent,
|
375
384
|
cutoffAngle, lightColor, surfaceScale,
|
376
|
-
kd, std::move(input), cropRect))
|
385
|
+
kd, std::move(input), cropRect));
|
386
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
387
|
+
getContext());
|
377
388
|
}
|
378
389
|
|
379
390
|
JSI_HOST_FUNCTION(MakeDistantLitSpecular) {
|
@@ -390,11 +401,12 @@ public:
|
|
390
401
|
if (hasOptionalArgument(arguments, count, 6)) {
|
391
402
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[6]);
|
392
403
|
}
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
404
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
405
|
+
getContext(), SkImageFilters::DistantLitSpecular(
|
406
|
+
direction, lightColor, surfaceScale, ks, shininess,
|
407
|
+
std::move(input), cropRect));
|
408
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
409
|
+
getContext());
|
398
410
|
}
|
399
411
|
|
400
412
|
JSI_HOST_FUNCTION(MakePointLitSpecular) {
|
@@ -411,11 +423,12 @@ public:
|
|
411
423
|
if (hasOptionalArgument(arguments, count, 6)) {
|
412
424
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[6]);
|
413
425
|
}
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
426
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
427
|
+
getContext(), SkImageFilters::PointLitSpecular(
|
428
|
+
location, lightColor, surfaceScale, ks, shininess,
|
429
|
+
std::move(input), cropRect));
|
430
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
431
|
+
getContext());
|
419
432
|
}
|
420
433
|
|
421
434
|
JSI_HOST_FUNCTION(MakeSpotLitSpecular) {
|
@@ -435,13 +448,13 @@ public:
|
|
435
448
|
if (hasOptionalArgument(arguments, count, 9)) {
|
436
449
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[9]);
|
437
450
|
}
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
451
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
452
|
+
getContext(),
|
453
|
+
SkImageFilters::SpotLitSpecular(
|
454
|
+
location, target, falloffExponent, cutoffAngle, lightColor,
|
455
|
+
surfaceScale, ks, shininess, std::move(input), cropRect));
|
456
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
457
|
+
getContext());
|
445
458
|
}
|
446
459
|
|
447
460
|
JSI_HOST_FUNCTION(MakeImage) {
|
@@ -466,11 +479,12 @@ public:
|
|
466
479
|
if (hasOptionalArgument(arguments, count, 4)) {
|
467
480
|
mipmap = (SkMipmapMode)arguments[4].asNumber();
|
468
481
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
482
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
483
|
+
getContext(),
|
484
|
+
SkImageFilters::Image(std::move(image), srcRect, dstRect,
|
485
|
+
SkSamplingOptions(filterMode, mipmap)));
|
486
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
487
|
+
getContext());
|
474
488
|
}
|
475
489
|
|
476
490
|
JSI_HOST_FUNCTION(MakeMagnifier) {
|
@@ -493,12 +507,13 @@ public:
|
|
493
507
|
if (hasOptionalArgument(arguments, count, 6)) {
|
494
508
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[6]);
|
495
509
|
}
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
510
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
511
|
+
getContext(),
|
512
|
+
SkImageFilters::Magnifier(lensBounds, zoomAmount, inset,
|
513
|
+
SkSamplingOptions(filterMode, mipmap), input,
|
514
|
+
cropRect));
|
515
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
516
|
+
getContext());
|
502
517
|
}
|
503
518
|
|
504
519
|
JSI_HOST_FUNCTION(MakeMatrixConvolution) {
|
@@ -524,12 +539,12 @@ public:
|
|
524
539
|
if (hasOptionalArgument(arguments, count, 10)) {
|
525
540
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[10]);
|
526
541
|
}
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
542
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
543
|
+
getContext(), SkImageFilters::MatrixConvolution(
|
544
|
+
kernelSize, kernel.data(), gain, bias, kernelOffset,
|
545
|
+
tileMode, convolveAlpha, std::move(input), cropRect));
|
546
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
547
|
+
getContext());
|
533
548
|
}
|
534
549
|
|
535
550
|
JSI_HOST_FUNCTION(MakeMatrixTransform) {
|
@@ -546,12 +561,12 @@ public:
|
|
546
561
|
if (hasOptionalArgument(arguments, count, 3)) {
|
547
562
|
input = JsiSkImageFilter::fromValue(runtime, arguments[3]);
|
548
563
|
}
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
564
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
565
|
+
getContext(),
|
566
|
+
SkImageFilters::MatrixTransform(
|
567
|
+
matrix, SkSamplingOptions(filterMode, mipmap), std::move(input)));
|
568
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
569
|
+
getContext());
|
555
570
|
}
|
556
571
|
|
557
572
|
JSI_HOST_FUNCTION(MakeMerge) {
|
@@ -570,11 +585,11 @@ public:
|
|
570
585
|
if (hasOptionalArgument(arguments, count, 1)) {
|
571
586
|
cropRect = *JsiSkRect::fromValue(runtime, arguments[1]);
|
572
587
|
}
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
588
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
589
|
+
getContext(),
|
590
|
+
SkImageFilters::Merge(filters.data(), filtersCount, cropRect));
|
591
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
592
|
+
getContext());
|
578
593
|
}
|
579
594
|
|
580
595
|
JSI_HOST_FUNCTION(MakePicture) {
|
@@ -585,10 +600,10 @@ public:
|
|
585
600
|
} else {
|
586
601
|
targetRect = picture ? picture->cullRect() : SkRect::MakeEmpty();
|
587
602
|
}
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
603
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
604
|
+
getContext(), SkImageFilters::Picture(std::move(picture), targetRect));
|
605
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
606
|
+
getContext());
|
592
607
|
}
|
593
608
|
|
594
609
|
JSI_HOST_FUNCTION(MakeRuntimeShaderWithChildren) {
|
@@ -620,12 +635,12 @@ public:
|
|
620
635
|
inputs.push_back(JsiSkImageFilter::fromValue(runtime, element));
|
621
636
|
}
|
622
637
|
}
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
638
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
639
|
+
getContext(), SkImageFilters::RuntimeShader(*rtb, maxSampleRadius,
|
640
|
+
childNamesStringView.data(),
|
641
|
+
inputs.data(), length));
|
642
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
643
|
+
getContext());
|
629
644
|
}
|
630
645
|
|
631
646
|
JSI_HOST_FUNCTION(MakeTile) {
|
@@ -635,10 +650,10 @@ public:
|
|
635
650
|
if (hasOptionalArgument(arguments, count, 2)) {
|
636
651
|
input = JsiSkImageFilter::fromValue(runtime, arguments[2]);
|
637
652
|
}
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
653
|
+
auto filter = std::make_shared<JsiSkImageFilter>(
|
654
|
+
getContext(), SkImageFilters::Tile(src, dst, std::move(input)));
|
655
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, filter,
|
656
|
+
getContext());
|
642
657
|
}
|
643
658
|
|
644
659
|
JSI_EXPORT_FUNCTIONS(
|
@@ -672,6 +687,8 @@ public:
|
|
672
687
|
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakePointLitSpecular),
|
673
688
|
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeSpotLitSpecular))
|
674
689
|
|
690
|
+
size_t getMemoryPressure() const override { return 2048; }
|
691
|
+
|
675
692
|
explicit JsiSkImageFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|
676
693
|
: JsiSkHostObject(std::move(context)) {}
|
677
694
|
};
|
package/cpp/api/JsiSkImageInfo.h
CHANGED
@@ -52,9 +52,10 @@ public:
|
|
52
52
|
static jsi::Value toValue(jsi::Runtime &runtime,
|
53
53
|
std::shared_ptr<RNSkPlatformContext> context,
|
54
54
|
const SkImageInfo &imageInfo) {
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
auto imageInfoObj =
|
56
|
+
std::make_shared<JsiSkImageInfo>(std::move(context), imageInfo);
|
57
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, imageInfoObj,
|
58
|
+
context);
|
58
59
|
}
|
59
60
|
|
60
61
|
JSI_PROPERTY_GET(width) { return static_cast<double>(getObject()->width()); }
|
@@ -68,6 +69,8 @@ public:
|
|
68
69
|
return static_cast<double>(getObject()->alphaType());
|
69
70
|
}
|
70
71
|
|
72
|
+
size_t getMemoryPressure() const override { return sizeof(SkImageInfo); }
|
73
|
+
|
71
74
|
JSI_API_TYPENAME(ImageInfo);
|
72
75
|
|
73
76
|
JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkImageInfo, width),
|
@@ -25,13 +25,15 @@ public:
|
|
25
25
|
int blurStyle = arguments[0].asNumber();
|
26
26
|
float sigma = arguments[1].asNumber();
|
27
27
|
bool respectCTM = arguments[2].getBool();
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
auto maskFilter = std::make_shared<JsiSkMaskFilter>(
|
29
|
+
getContext(),
|
30
|
+
SkMaskFilter::MakeBlur((SkBlurStyle)blurStyle, sigma, respectCTM));
|
31
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, maskFilter,
|
32
|
+
getContext());
|
33
33
|
}
|
34
34
|
|
35
|
+
size_t getMemoryPressure() const override { return 1024; }
|
36
|
+
|
35
37
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkMaskFilterFactory, MakeBlur))
|
36
38
|
|
37
39
|
explicit JsiSkMaskFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|
package/cpp/api/JsiSkMatrix.h
CHANGED
@@ -166,6 +166,8 @@ public:
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
+
size_t getMemoryPressure() const override { return sizeof(SkMatrix); }
|
170
|
+
|
169
171
|
static const jsi::HostFunctionType
|
170
172
|
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
171
173
|
return JSI_HOST_FUNCTION_LAMBDA {
|
@@ -175,8 +177,10 @@ public:
|
|
175
177
|
} else {
|
176
178
|
matrix = SkMatrix::I();
|
177
179
|
}
|
178
|
-
|
179
|
-
|
180
|
+
auto hostObjectInstance =
|
181
|
+
std::make_shared<JsiSkMatrix>(context, std::move(matrix));
|
182
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
183
|
+
runtime, hostObjectInstance, context);
|
180
184
|
};
|
181
185
|
}
|
182
186
|
};
|
package/cpp/api/JsiSkPaint.h
CHANGED
@@ -35,8 +35,10 @@ public:
|
|
35
35
|
|
36
36
|
JSI_HOST_FUNCTION(copy) {
|
37
37
|
const auto *paint = getObject().get();
|
38
|
-
|
39
|
-
|
38
|
+
auto hostObjectInstance =
|
39
|
+
std::make_shared<JsiSkPaint>(getContext(), SkPaint(*paint));
|
40
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
41
|
+
runtime, hostObjectInstance, getContext());
|
40
42
|
}
|
41
43
|
|
42
44
|
JSI_HOST_FUNCTION(reset) {
|
@@ -206,6 +208,8 @@ public:
|
|
206
208
|
setObject(std::make_shared<SkPaint>(std::move(paint)));
|
207
209
|
}
|
208
210
|
|
211
|
+
size_t getMemoryPressure() const override { return sizeof(SkPaint); }
|
212
|
+
|
209
213
|
/**
|
210
214
|
* Creates the function for construction a new instance of the SkPaint
|
211
215
|
* wrapper
|
@@ -219,8 +223,9 @@ public:
|
|
219
223
|
auto paint = SkPaint();
|
220
224
|
paint.setAntiAlias(true);
|
221
225
|
// Return the newly constructed object
|
222
|
-
|
223
|
-
|
226
|
+
auto hostObjectInstance = std::make_shared<JsiSkPaint>(context, paint);
|
227
|
+
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
228
|
+
runtime, hostObjectInstance, context);
|
224
229
|
};
|
225
230
|
}
|
226
231
|
};
|
package/cpp/api/JsiSkParagraph.h
CHANGED
@@ -171,6 +171,8 @@ public:
|
|
171
171
|
JSI_EXPORT_FUNC(JsiSkParagraph, getLineMetrics),
|
172
172
|
JSI_EXPORT_FUNC(JsiSkParagraph, dispose))
|
173
173
|
|
174
|
+
size_t getMemoryPressure() const override { return 8192; }
|
175
|
+
|
174
176
|
explicit JsiSkParagraph(std::shared_ptr<RNSkPlatformContext> context,
|
175
177
|
para::ParagraphBuilder *paragraphBuilder)
|
176
178
|
: JsiSkWrappingSharedPtrHostObject<para::Paragraph>(
|