@shopify/react-native-skia 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/android/README.md +14 -0
  2. package/cpp/skia/include/codec/SkCodec.h +4 -1
  3. package/cpp/skia/include/core/SkMesh.h +2 -2
  4. package/cpp/skia/include/core/SkMilestone.h +1 -1
  5. package/cpp/skia/include/core/SkPathEffect.h +11 -4
  6. package/cpp/skia/include/core/SkPathMeasure.h +7 -2
  7. package/cpp/skia/include/core/SkPoint3.h +2 -1
  8. package/cpp/skia/include/core/SkRSXform.h +2 -0
  9. package/cpp/skia/include/core/SkString.h +5 -5
  10. package/cpp/skia/include/core/SkSurfaceProps.h +18 -5
  11. package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +2 -37
  12. package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +3 -1
  13. package/cpp/skia/include/gpu/MutableTextureState.h +0 -13
  14. package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +46 -0
  15. package/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +4 -0
  16. package/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +5 -0
  17. package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -5
  18. package/cpp/skia/include/gpu/gl/egl/GrGLMakeEGLInterface.h +11 -2
  19. package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -3
  20. package/cpp/skia/include/gpu/graphite/Context.h +6 -0
  21. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -4
  22. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +6 -0
  23. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +6 -0
  24. package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +6 -5
  25. package/cpp/skia/include/gpu/vk/VulkanTypes.h +10 -0
  26. package/cpp/skia/include/ports/SkImageGeneratorCG.h +8 -2
  27. package/cpp/skia/include/ports/SkImageGeneratorWIC.h +8 -2
  28. package/cpp/skia/include/private/SkColorData.h +1 -2
  29. package/cpp/skia/include/private/base/README.md +4 -0
  30. package/cpp/skia/include/private/base/SkFloatingPoint.h +8 -0
  31. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +6 -0
  32. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +2 -2
  33. package/cpp/skia/include/third_party/vulkan/LICENSE +29 -0
  34. package/cpp/skia/modules/skcms/README.chromium +6 -0
  35. package/cpp/skia/modules/skresources/include/SkResources.h +11 -1
  36. package/cpp/skia/readme.txt +1 -0
  37. package/lib/commonjs/Platform/Platform.web.js +16 -6
  38. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  39. package/lib/commonjs/external/reanimated/buffers.js +6 -6
  40. package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
  41. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
  42. package/lib/commonjs/external/reanimated/moduleWrapper.js +4 -3
  43. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  44. package/lib/module/Platform/Platform.web.js +16 -6
  45. package/lib/module/Platform/Platform.web.js.map +1 -1
  46. package/lib/module/external/reanimated/buffers.js +7 -7
  47. package/lib/module/external/reanimated/buffers.js.map +1 -1
  48. package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
  49. package/lib/module/external/reanimated/moduleWrapper.js +3 -2
  50. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  51. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
  52. package/libs/android/arm64-v8a/libskia.a +0 -0
  53. package/libs/android/arm64-v8a/libskottie.a +0 -0
  54. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  55. package/libs/android/arm64-v8a/libsvg.a +0 -0
  56. package/libs/android/armeabi-v7a/libskia.a +0 -0
  57. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  58. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  59. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  60. package/libs/android/x86/libskia.a +0 -0
  61. package/libs/android/x86/libskottie.a +0 -0
  62. package/libs/android/x86/libskparagraph.a +0 -0
  63. package/libs/android/x86/libsvg.a +0 -0
  64. package/libs/android/x86_64/libskia.a +0 -0
  65. package/libs/android/x86_64/libskottie.a +0 -0
  66. package/libs/android/x86_64/libskparagraph.a +0 -0
  67. package/libs/android/x86_64/libsvg.a +0 -0
  68. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  69. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  70. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  71. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  72. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  73. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  74. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  75. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  76. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  77. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  78. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  79. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  80. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  81. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  82. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  83. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  84. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  85. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  86. package/package.json +2 -3
  87. package/react-native-skia.podspec +1 -1
  88. package/src/Platform/Platform.web.tsx +16 -6
  89. package/src/external/reanimated/buffers.ts +11 -9
  90. package/src/external/reanimated/moduleWrapper.ts +2 -0
  91. package/cpp/skia/include/utils/SkAnimCodecPlayer.h +0 -67
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e_x86_64-simulator</string>
9
+ <string>ios-arm64_arm64e</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libskia.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
- <string>x86_64</string>
17
16
  </array>
18
17
  <key>SupportedPlatform</key>
19
18
  <string>ios</string>
20
- <key>SupportedPlatformVariant</key>
21
- <string>simulator</string>
22
19
  </dict>
23
20
  <dict>
24
21
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_arm64e</string>
22
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
26
23
  <key>LibraryPath</key>
27
24
  <string>libskia.a</string>
28
25
  <key>SupportedArchitectures</key>
29
26
  <array>
30
27
  <string>arm64</string>
31
28
  <string>arm64e</string>
29
+ <string>x86_64</string>
32
30
  </array>
33
31
  <key>SupportedPlatform</key>
34
32
  <string>ios</string>
33
+ <key>SupportedPlatformVariant</key>
34
+ <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e</string>
9
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libskottie.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
+ <string>x86_64</string>
16
17
  </array>
17
18
  <key>SupportedPlatform</key>
18
19
  <string>ios</string>
20
+ <key>SupportedPlatformVariant</key>
21
+ <string>simulator</string>
19
22
  </dict>
20
23
  <dict>
21
24
  <key>LibraryIdentifier</key>
22
- <string>ios-arm64_arm64e_x86_64-simulator</string>
25
+ <string>ios-arm64_arm64e</string>
23
26
  <key>LibraryPath</key>
24
27
  <string>libskottie.a</string>
25
28
  <key>SupportedArchitectures</key>
26
29
  <array>
27
30
  <string>arm64</string>
28
31
  <string>arm64e</string>
29
- <string>x86_64</string>
30
32
  </array>
31
33
  <key>SupportedPlatform</key>
32
34
  <string>ios</string>
33
- <key>SupportedPlatformVariant</key>
34
- <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e_x86_64-simulator</string>
9
+ <string>ios-arm64_arm64e</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libskunicode.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
- <string>x86_64</string>
17
16
  </array>
18
17
  <key>SupportedPlatform</key>
19
18
  <string>ios</string>
20
- <key>SupportedPlatformVariant</key>
21
- <string>simulator</string>
22
19
  </dict>
23
20
  <dict>
24
21
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_arm64e</string>
22
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
26
23
  <key>LibraryPath</key>
27
24
  <string>libskunicode.a</string>
28
25
  <key>SupportedArchitectures</key>
29
26
  <array>
30
27
  <string>arm64</string>
31
28
  <string>arm64e</string>
29
+ <string>x86_64</string>
32
30
  </array>
33
31
  <key>SupportedPlatform</key>
34
32
  <string>ios</string>
33
+ <key>SupportedPlatformVariant</key>
34
+ <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e_x86_64-simulator</string>
9
+ <string>ios-arm64_arm64e</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libsvg.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
- <string>x86_64</string>
17
16
  </array>
18
17
  <key>SupportedPlatform</key>
19
18
  <string>ios</string>
20
- <key>SupportedPlatformVariant</key>
21
- <string>simulator</string>
22
19
  </dict>
23
20
  <dict>
24
21
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_arm64e</string>
22
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
26
23
  <key>LibraryPath</key>
27
24
  <string>libsvg.a</string>
28
25
  <key>SupportedArchitectures</key>
29
26
  <array>
30
27
  <string>arm64</string>
31
28
  <string>arm64e</string>
29
+ <string>x86_64</string>
32
30
  </array>
33
31
  <key>SupportedPlatform</key>
34
32
  <string>ios</string>
33
+ <key>SupportedPlatformVariant</key>
34
+ <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "1.0.2",
10
+ "version": "1.0.4",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -49,7 +49,7 @@
49
49
  "test": "jest",
50
50
  "e2e": "E2E=true yarn test -i e2e",
51
51
  "build": "bob build && merge-dirs lib/typescript/src lib/commonjs && merge-dirs lib/typescript/src lib/module",
52
- "release": "standard-version"
52
+ "release": "semantic-release"
53
53
  },
54
54
  "repository": {
55
55
  "type": "git",
@@ -106,7 +106,6 @@
106
106
  "react-native": "0.72.6",
107
107
  "react-native-builder-bob": "0.18.2",
108
108
  "react-native-reanimated": "3.6.2",
109
- "standard-version": "^9.5.0",
110
109
  "ts-jest": "29.1.1",
111
110
  "typescript": "5.1.6",
112
111
  "ws": "8.11.0"
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
28
28
  "HEADER_SEARCH_PATHS" => '"$(PODS_TARGET_SRCROOT)/cpp/"/**'
29
29
  }
30
30
 
31
- s.frameworks = 'GLKit', 'MetalKit'
31
+ s.frameworks = 'MetalKit'
32
32
 
33
33
  s.ios.vendored_frameworks = [
34
34
  'libs/ios/libskia.xcframework',
@@ -97,13 +97,23 @@ const View = (({ children, onLayout, style: rawStyle }: ViewProps) => {
97
97
  useElementLayout(ref, onLayout);
98
98
  const cssStyles = useMemo(() => {
99
99
  return {
100
+ alignItems: "stretch" as const,
101
+ backgroundColor: "transparent" as const,
102
+ border: "0 solid black" as const,
103
+ boxSizing: "border-box" as const,
104
+ display: "flex" as const,
105
+ flexBasis: "auto" as const,
106
+ flexDirection: "column" as const,
107
+ flexShrink: 0,
108
+ listStyle: "none" as const,
109
+ margin: 0,
110
+ minHeight: 0,
111
+ minWidth: 0,
112
+ padding: 0,
113
+ position: "relative" as const,
114
+ textDecoration: "none" as const,
115
+ zIndex: 0,
100
116
  ...style,
101
- display: "flex",
102
- flexDirection: style.flexDirection || "inherit",
103
- flexWrap: style.flexWrap || "nowrap",
104
- justifyContent: style.justifyContent || "flex-start",
105
- alignItems: style.alignItems || "stretch",
106
- alignContent: style.alignContent || "stretch",
107
117
  };
108
118
  }, [style]);
109
119
 
@@ -4,27 +4,29 @@ import type { WorkletFunction } from "react-native-reanimated/lib/typescript/rea
4
4
  import type { SkColor, SkHostRect, SkPoint, SkRSXform } from "../../skia/types";
5
5
  import { Skia } from "../../skia";
6
6
 
7
- import { startMapper, stopMapper, useSharedValue } from "./moduleWrapper";
7
+ import { startMapper, stopMapper, makeMutable } from "./moduleWrapper";
8
8
  import { notifyChange } from "./interpolators";
9
9
 
10
10
  type Modifier<T> = (input: T, index: number) => void;
11
11
 
12
+ const useBufferValue = <T>(size: number, bufferInitializer: () => T) =>
13
+ useMemo(
14
+ () => makeMutable(new Array(size).fill(0).map(bufferInitializer)),
15
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16
+ [size]
17
+ );
18
+
12
19
  const useBuffer = <T>(
13
20
  size: number,
14
21
  bufferInitializer: () => T,
15
22
  modifier: Modifier<T>
16
23
  ) => {
17
- const buffer = useMemo(
18
- () => new Array(size).fill(0).map(bufferInitializer),
19
- // eslint-disable-next-line react-hooks/exhaustive-deps
20
- [size]
21
- );
22
- const values = useSharedValue(buffer);
24
+ const values = useBufferValue(size, bufferInitializer);
23
25
  const mod = modifier as WorkletFunction;
24
- const deps = Object.values(mod.__closure ?? {});
26
+ const deps = [size, ...Object.values(mod.__closure ?? {})];
25
27
  const mapperId = startMapper(() => {
26
28
  "worklet";
27
- buffer.forEach((val, index) => {
29
+ values.value.forEach((val, index) => {
28
30
  modifier(val, index);
29
31
  });
30
32
  notifyChange(values);
@@ -64,6 +64,8 @@ export const stopMapper: (mapperID: number) => void =
64
64
 
65
65
  export const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;
66
66
  export const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;
67
+ export const makeMutable: <T>(val: T) => SharedValue<T> =
68
+ Reanimated2?.makeMutable || throwOnMissingReanimated;
67
69
 
68
70
  export const useAnimatedReaction: <T>(
69
71
  prepare: () => T,
@@ -1,67 +0,0 @@
1
- /*
2
- * Copyright 2018 Google Inc.
3
- *
4
- * Use of this source code is governed by a BSD-style license that can be
5
- * found in the LICENSE file.
6
- */
7
-
8
- #ifndef SkAnimCodecPlayer_DEFINED
9
- #define SkAnimCodecPlayer_DEFINED
10
-
11
- #include "include/codec/SkCodec.h"
12
- #include "include/core/SkImageInfo.h"
13
- #include "include/core/SkRefCnt.h"
14
- #include "include/core/SkSize.h"
15
-
16
- #include <cstdint>
17
- #include <memory>
18
- #include <vector>
19
-
20
- class SkImage;
21
-
22
- class SkAnimCodecPlayer {
23
- public:
24
- SkAnimCodecPlayer(std::unique_ptr<SkCodec> codec);
25
- ~SkAnimCodecPlayer();
26
-
27
- /**
28
- * Returns the current frame of the animation. This defaults to the first frame for
29
- * animated codecs (i.e. msec = 0). Calling this multiple times (without calling seek())
30
- * will always return the same image object (or null if there was an error).
31
- */
32
- sk_sp<SkImage> getFrame();
33
-
34
- /**
35
- * Return the size of the image(s) that will be returned by getFrame().
36
- */
37
- SkISize dimensions() const;
38
-
39
- /**
40
- * Returns the total duration of the animation in milliseconds. Returns 0 for a single-frame
41
- * image.
42
- */
43
- uint32_t duration() const { return fTotalDuration; }
44
-
45
- /**
46
- * Finds the closest frame associated with the time code (in milliseconds) and sets that
47
- * to be the current frame (call getFrame() to retrieve that image).
48
- * Returns true iff this call to seek() changed the "current frame" for the animation.
49
- * Thus if seek() returns false, then getFrame() will return the same image as it did
50
- * before this call to seek().
51
- */
52
- bool seek(uint32_t msec);
53
-
54
-
55
- private:
56
- std::unique_ptr<SkCodec> fCodec;
57
- SkImageInfo fImageInfo;
58
- std::vector<SkCodec::FrameInfo> fFrameInfos;
59
- std::vector<sk_sp<SkImage> > fImages;
60
- int fCurrIndex = 0;
61
- uint32_t fTotalDuration;
62
-
63
- sk_sp<SkImage> getFrameAt(int index);
64
- };
65
-
66
- #endif
67
-