@shopify/react-native-skia 2.2.10 → 2.2.12

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.
Files changed (109) hide show
  1. package/cpp/api/JsiNativeBuffer.h +2 -0
  2. package/cpp/api/JsiSkAnimatedImage.h +6 -2
  3. package/cpp/api/JsiSkAnimatedImageFactory.h +6 -3
  4. package/cpp/api/JsiSkApi.h +2 -0
  5. package/cpp/api/JsiSkCanvas.h +2 -0
  6. package/cpp/api/JsiSkColorFilter.h +2 -0
  7. package/cpp/api/JsiSkColorFilterFactory.h +31 -23
  8. package/cpp/api/JsiSkContourMeasure.h +8 -4
  9. package/cpp/api/JsiSkContourMeasureIter.h +10 -4
  10. package/cpp/api/JsiSkData.h +5 -0
  11. package/cpp/api/JsiSkDataFactory.h +14 -7
  12. package/cpp/api/JsiSkFont.h +17 -10
  13. package/cpp/api/JsiSkFontMgr.h +6 -2
  14. package/cpp/api/JsiSkFontMgrFactory.h +5 -2
  15. package/cpp/api/JsiSkFontStyle.h +6 -3
  16. package/cpp/api/JsiSkHostObjects.h +21 -44
  17. package/cpp/api/JsiSkImage.h +17 -8
  18. package/cpp/api/JsiSkImageFactory.h +26 -13
  19. package/cpp/api/JsiSkImageFilter.h +2 -0
  20. package/cpp/api/JsiSkImageFilterFactory.h +160 -143
  21. package/cpp/api/JsiSkImageInfo.h +6 -3
  22. package/cpp/api/JsiSkMaskFilter.h +2 -0
  23. package/cpp/api/JsiSkMaskFilterFactory.h +7 -5
  24. package/cpp/api/JsiSkMatrix.h +6 -2
  25. package/cpp/api/JsiSkPaint.h +9 -4
  26. package/cpp/api/JsiSkParagraph.h +26 -23
  27. package/cpp/api/JsiSkParagraphBuilder.h +6 -3
  28. package/cpp/api/JsiSkParagraphBuilderFactory.h +6 -3
  29. package/cpp/api/JsiSkPath.h +33 -15
  30. package/cpp/api/JsiSkPathEffect.h +2 -0
  31. package/cpp/api/JsiSkPathEffectFactory.h +37 -32
  32. package/cpp/api/JsiSkPathFactory.h +22 -10
  33. package/cpp/api/JsiSkPicture.h +13 -2
  34. package/cpp/api/JsiSkPictureFactory.h +6 -2
  35. package/cpp/api/JsiSkPictureRecorder.h +14 -6
  36. package/cpp/api/JsiSkPoint.h +9 -5
  37. package/cpp/api/JsiSkRRect.h +13 -8
  38. package/cpp/api/JsiSkRSXform.h +14 -8
  39. package/cpp/api/JsiSkRect.h +13 -8
  40. package/cpp/api/JsiSkRuntimeEffect.h +10 -6
  41. package/cpp/api/JsiSkRuntimeEffectFactory.h +6 -3
  42. package/cpp/api/JsiSkRuntimeShaderBuilder.h +12 -6
  43. package/cpp/api/JsiSkSVG.h +24 -0
  44. package/cpp/api/JsiSkSVGFactory.h +8 -4
  45. package/cpp/api/JsiSkShader.h +2 -0
  46. package/cpp/api/JsiSkShaderFactory.h +34 -24
  47. package/cpp/api/JsiSkSkottie.h +29 -0
  48. package/cpp/api/JsiSkSurface.h +21 -5
  49. package/cpp/api/JsiSkSurfaceFactory.h +10 -6
  50. package/cpp/api/JsiSkTextBlob.h +12 -0
  51. package/cpp/api/JsiSkTextBlobFactory.h +18 -12
  52. package/cpp/api/JsiSkTypeface.h +19 -3
  53. package/cpp/api/JsiSkTypefaceFactory.h +6 -2
  54. package/cpp/api/JsiSkTypefaceFontProvider.h +10 -5
  55. package/cpp/api/JsiSkTypefaceFontProviderFactory.h +6 -3
  56. package/cpp/api/JsiSkVertices.h +16 -5
  57. package/cpp/api/JsiSkiaContext.h +10 -6
  58. package/cpp/api/JsiSkottieFactory.h +6 -3
  59. package/cpp/api/JsiVideo.h +10 -5
  60. package/cpp/api/recorder/DrawingCtx.h +2 -2
  61. package/cpp/api/recorder/JsiRecorder.h +12 -8
  62. package/cpp/api/recorder/Shaders.h +3 -2
  63. package/cpp/rnskia/RNSkJsiViewApi.h +22 -10
  64. package/lib/commonjs/renderer/Canvas.js +18 -1
  65. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  66. package/lib/commonjs/sksg/Container.d.ts +1 -1
  67. package/lib/commonjs/sksg/Container.js +2 -2
  68. package/lib/commonjs/sksg/Container.js.map +1 -1
  69. package/lib/commonjs/sksg/Container.native.js +2 -5
  70. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  71. package/lib/commonjs/sksg/Container.web.d.ts +2 -3
  72. package/lib/commonjs/sksg/Container.web.js +7 -14
  73. package/lib/commonjs/sksg/Container.web.js.map +1 -1
  74. package/lib/commonjs/sksg/StaticContainer.d.ts +2 -4
  75. package/lib/commonjs/sksg/StaticContainer.js +1 -8
  76. package/lib/commonjs/sksg/StaticContainer.js.map +1 -1
  77. package/lib/commonjs/specs/NativeSkiaModule.web.js +1 -0
  78. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  79. package/lib/module/renderer/Canvas.js +19 -2
  80. package/lib/module/renderer/Canvas.js.map +1 -1
  81. package/lib/module/sksg/Container.d.ts +1 -1
  82. package/lib/module/sksg/Container.js +2 -2
  83. package/lib/module/sksg/Container.js.map +1 -1
  84. package/lib/module/sksg/Container.native.js +2 -5
  85. package/lib/module/sksg/Container.native.js.map +1 -1
  86. package/lib/module/sksg/Container.web.d.ts +2 -3
  87. package/lib/module/sksg/Container.web.js +7 -14
  88. package/lib/module/sksg/Container.web.js.map +1 -1
  89. package/lib/module/sksg/StaticContainer.d.ts +2 -4
  90. package/lib/module/sksg/StaticContainer.js +1 -8
  91. package/lib/module/sksg/StaticContainer.js.map +1 -1
  92. package/lib/module/specs/NativeSkiaModule.web.js +1 -0
  93. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  94. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +1 -1
  95. package/lib/typescript/lib/commonjs/sksg/Container.web.d.ts +2 -3
  96. package/lib/typescript/lib/commonjs/sksg/StaticContainer.d.ts +1 -2
  97. package/lib/typescript/lib/module/sksg/Container.d.ts +1 -1
  98. package/lib/typescript/lib/module/sksg/Container.web.d.ts +2 -3
  99. package/lib/typescript/lib/module/sksg/StaticContainer.d.ts +1 -2
  100. package/lib/typescript/src/sksg/Container.d.ts +1 -1
  101. package/lib/typescript/src/sksg/Container.web.d.ts +2 -3
  102. package/lib/typescript/src/sksg/StaticContainer.d.ts +2 -4
  103. package/package.json +1 -1
  104. package/src/renderer/Canvas.tsx +17 -0
  105. package/src/sksg/Container.native.ts +2 -9
  106. package/src/sksg/Container.ts +2 -2
  107. package/src/sksg/Container.web.ts +7 -25
  108. package/src/sksg/StaticContainer.ts +2 -17
  109. package/src/specs/NativeSkiaModule.web.ts +1 -0
@@ -14,22 +14,8 @@ import { Container, StaticContainer } from "./StaticContainer";
14
14
  import "../skia/NativeSetup";
15
15
  import "../views/api";
16
16
 
17
- const drawOnscreen = (
18
- Skia: Skia,
19
- nativeId: number,
20
- recording: Recording,
21
- onSize?: SharedValue<SkSize>
22
- ) => {
17
+ const drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {
23
18
  "worklet";
24
- if (onSize) {
25
- const size = SkiaViewApi.size(nativeId);
26
- if (
27
- size.width !== onSize.value.width ||
28
- size.height !== onSize.value.height
29
- ) {
30
- onSize.value = size;
31
- }
32
- }
33
19
  const rec = Skia.PictureRecorder();
34
20
  const canvas = rec.beginRecording();
35
21
  //const start = performance.now();
@@ -45,11 +31,7 @@ const drawOnscreen = (
45
31
  class ReanimatedContainer extends Container {
46
32
  private mapperId: number | null = null;
47
33
 
48
- constructor(
49
- Skia: Skia,
50
- private nativeId: number,
51
- private onSize?: SharedValue<SkSize>
52
- ) {
34
+ constructor(Skia: Skia, private nativeId: number) {
53
35
  super(Skia);
54
36
  }
55
37
 
@@ -75,20 +57,20 @@ class ReanimatedContainer extends Container {
75
57
  drawOnscreen(Skia, nativeId, recording!);
76
58
  }, Array.from(animationValues));
77
59
  }
78
- Rea.runOnUI((onSize?: SharedValue<SkSize>) => {
60
+ Rea.runOnUI(() => {
79
61
  "worklet";
80
- drawOnscreen(Skia, nativeId, recording!, onSize);
81
- })(this.onSize);
62
+ drawOnscreen(Skia, nativeId, recording!);
63
+ })();
82
64
  }
83
65
  }
84
66
 
85
67
  export const createContainer = (
86
68
  Skia: Skia,
87
69
  nativeId: number,
88
- onSize?: SharedValue<SkSize>
70
+ _onSize?: SharedValue<SkSize>
89
71
  ) => {
90
72
  if (HAS_REANIMATED_3 && nativeId !== -1) {
91
- return new ReanimatedContainer(Skia, nativeId, onSize);
73
+ return new ReanimatedContainer(Skia, nativeId);
92
74
  } else {
93
75
  return new StaticContainer(Skia, nativeId);
94
76
  }
@@ -1,6 +1,4 @@
1
- import type { SharedValue } from "react-native-reanimated";
2
-
3
- import type { Skia, SkCanvas, SkSize } from "../skia/types";
1
+ import type { Skia, SkCanvas } from "../skia/types";
4
2
 
5
3
  import type { Node } from "./Node";
6
4
  import type { Recording } from "./Recorder/Recorder";
@@ -50,11 +48,7 @@ export abstract class Container {
50
48
  }
51
49
 
52
50
  export class StaticContainer extends Container {
53
- constructor(
54
- Skia: Skia,
55
- private nativeId: number,
56
- private onSize?: SharedValue<SkSize>
57
- ) {
51
+ constructor(Skia: Skia, private nativeId: number) {
58
52
  super(Skia);
59
53
  }
60
54
 
@@ -64,15 +58,6 @@ export class StaticContainer extends Container {
64
58
  this.recording = recorder.getRecording();
65
59
  const isOnScreen = this.nativeId !== -1;
66
60
  if (isOnScreen) {
67
- if (this.onSize) {
68
- const size = SkiaViewApi.size(this.nativeId);
69
- if (
70
- size.width !== this.onSize.value.width ||
71
- size.height !== this.onSize.value.height
72
- ) {
73
- this.onSize.value = size;
74
- }
75
- }
76
61
  const rec = this.Skia.PictureRecorder();
77
62
  const canvas = rec.beginRecording();
78
63
  this.drawOnCanvas(canvas);
@@ -12,6 +12,7 @@ export type ISkiaViewApiWeb = ISkiaViewApi & {
12
12
  global.SkiaViewApi = {
13
13
  views: {},
14
14
  deferedPictures: {},
15
+ deferedOnSize: {},
15
16
  web: true,
16
17
  registerView(nativeId: string, view: SkiaPictureViewHandle) {
17
18
  // Maybe a picture for this view was already set