@shopify/react-native-skia 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/android/CMakeLists.txt +52 -13
  2. package/android/build.gradle +3 -0
  3. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +18 -1
  4. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +12 -1
  5. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +13 -0
  6. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -1
  7. package/cpp/api/JsiSkImage.h +15 -2
  8. package/cpp/api/JsiSkSurface.h +18 -3
  9. package/cpp/rnskia/DawnContext.h +241 -0
  10. package/cpp/rnskia/DawnUtils.h +127 -0
  11. package/cpp/rnskia/DawnWindowContext.cpp +19 -0
  12. package/cpp/rnskia/DawnWindowContext.h +77 -0
  13. package/cpp/rnskia/ImageProvider.h +100 -0
  14. package/cpp/rnskia/RNSkView.h +6 -0
  15. package/cpp/skia/include/android/SkAnimatedImage.h +14 -0
  16. package/cpp/skia/include/codec/SkAvifDecoder.h +39 -3
  17. package/cpp/skia/include/codec/SkCodec.h +16 -0
  18. package/cpp/skia/include/config/SkUserConfig.h +3 -2
  19. package/cpp/skia/include/core/SkCanvas.h +55 -10
  20. package/cpp/skia/include/core/SkContourMeasure.h +76 -0
  21. package/cpp/skia/include/core/SkFontScanner.h +48 -0
  22. package/cpp/skia/include/core/SkMilestone.h +1 -1
  23. package/cpp/skia/include/core/SkPath.h +11 -0
  24. package/cpp/skia/include/core/SkPathEffect.h +0 -23
  25. package/cpp/skia/include/core/SkRect.h +2 -0
  26. package/cpp/skia/include/core/SkString.h +4 -0
  27. package/cpp/skia/include/core/SkTypeface.h +5 -0
  28. package/cpp/skia/include/core/SkTypes.h +8 -3
  29. package/cpp/skia/include/docs/SkPDFDocument.h +3 -3
  30. package/cpp/skia/include/effects/SkOverdrawColorFilter.h +1 -0
  31. package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -1
  32. package/cpp/skia/include/encode/SkJpegEncoder.h +4 -0
  33. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +8 -1
  34. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +18 -3
  35. package/cpp/skia/include/gpu/ganesh/GrTypes.h +11 -0
  36. package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +5 -1
  37. package/cpp/skia/include/gpu/ganesh/gl/GrGLInterface.h +0 -1
  38. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +8 -0
  39. package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
  40. package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +7 -4
  41. package/cpp/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +2 -0
  42. package/cpp/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +2 -0
  43. package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +25 -0
  44. package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +4 -2
  45. package/cpp/skia/include/ports/SkFontScanner_Fontations.h +15 -0
  46. package/cpp/skia/include/ports/SkFontScanner_FreeType.h +15 -0
  47. package/cpp/skia/include/private/SkExif.h +14 -0
  48. package/cpp/skia/include/private/SkPathRef.h +36 -0
  49. package/cpp/skia/include/private/base/SkFeatures.h +4 -0
  50. package/cpp/skia/include/private/base/SkSpan_impl.h +1 -3
  51. package/cpp/skia/modules/skcms/src/skcms_internals.h +3 -0
  52. package/cpp/skia/src/base/SkMathPriv.h +1 -8
  53. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -2
  54. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +25 -19
  55. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +23 -0
  56. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +22 -8
  57. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -20
  58. package/libs/android/arm64-v8a/libskia.a +0 -0
  59. package/libs/android/arm64-v8a/libskottie.a +0 -0
  60. package/libs/android/armeabi-v7a/libskia.a +0 -0
  61. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  62. package/libs/android/x86/libskia.a +0 -0
  63. package/libs/android/x86/libskottie.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/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  67. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  68. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  69. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  70. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  71. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  72. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  73. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  74. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  75. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  76. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  77. package/libs/ios/libskunicode_core.xcframework/Info.plist +5 -5
  78. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  79. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  80. package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +5 -5
  81. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  82. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  83. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  84. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  85. package/package.json +1 -1
  86. package/react-native-skia.podspec +35 -9
  87. package/src/renderer/__tests__/e2e/SVG.spec.tsx +2 -1
@@ -4,6 +4,29 @@ require "json"
4
4
 
5
5
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
6
6
 
7
+ # Check for GRAPHITE env var
8
+ use_graphite = ENV['SK_GRAPHITE'] == '1'
9
+
10
+ # Set preprocessor definitions based on GRAPHITE flag
11
+ preprocessor_defs = use_graphite ?
12
+ '$(inherited) SK_GRAPHITE=1' :
13
+ '$(inherited) SK_METAL=1 SK_GANESH=1'
14
+
15
+ # Define base frameworks
16
+ base_frameworks = ['libs/ios/libskia.xcframework',
17
+ 'libs/ios/libsvg.xcframework',
18
+ 'libs/ios/libskshaper.xcframework',
19
+ 'libs/ios/libskparagraph.xcframework',
20
+ 'libs/ios/libskunicode_core.xcframework',
21
+ 'libs/ios/libskunicode_libgrapheme.xcframework',]
22
+
23
+ # Add Graphite frameworks if enabled
24
+ graphite_frameworks = [
25
+ 'libs/ios/libdawn_native_static.xcframework',
26
+ 'libs/ios/libdawn_platform_static.xcframework',
27
+ 'libs/ios/libdawn_proc_static.xcframework'
28
+ ]
29
+
7
30
  Pod::Spec.new do |s|
8
31
  s.name = "react-native-skia"
9
32
  s.version = package["version"]
@@ -23,7 +46,7 @@ Pod::Spec.new do |s|
23
46
 
24
47
  s.requires_arc = true
25
48
  s.pod_target_xcconfig = {
26
- 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_METAL=1 SK_GANESH=1',
49
+ 'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_defs,
27
50
  'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
28
51
  'DEFINES_MODULE' => 'YES',
29
52
  "HEADER_SEARCH_PATHS" => '"$(PODS_TARGET_SRCROOT)/cpp/"/**'
@@ -31,14 +54,9 @@ Pod::Spec.new do |s|
31
54
 
32
55
  s.frameworks = 'MetalKit'
33
56
 
34
- s.ios.vendored_frameworks = [
35
- 'libs/ios/libskia.xcframework',
36
- 'libs/ios/libsvg.xcframework',
37
- 'libs/ios/libskshaper.xcframework',
38
- 'libs/ios/libskparagraph.xcframework',
39
- 'libs/ios/libskunicode_core.xcframework',
40
- 'libs/ios/libskunicode_libgrapheme.xcframework',
41
- ]
57
+ s.ios.vendored_frameworks = use_graphite ?
58
+ base_frameworks + graphite_frameworks :
59
+ base_frameworks
42
60
 
43
61
  # All iOS cpp/h files
44
62
  s.source_files = [
@@ -46,6 +64,14 @@ Pod::Spec.new do |s|
46
64
  "cpp/**/*.{h,cpp}"
47
65
  ]
48
66
 
67
+ graphite_exclusions = [
68
+ 'cpp/rnskia/DawnContext.h',
69
+ 'cpp/rnskia/DawnUtils.h',
70
+ 'cpp/rnskia/DawnWindowContext.h',
71
+ 'cpp/rnskia/DawnWindowContext.cpp',
72
+ 'cpp/rnskia/ImageProvider.h'
73
+ ]
74
+ s.exclude_files = graphite_exclusions unless use_graphite
49
75
 
50
76
  if defined?(install_modules_dependencies()) != nil
51
77
  install_modules_dependencies(s)
@@ -170,7 +170,8 @@ describe("Displays SVGs", () => {
170
170
  </Group>
171
171
  </>
172
172
  );
173
- checkImage(image, docPath("opacity-tiger.png"));
173
+ // TODO: Currently there are artifacts on Graphite/iOS
174
+ checkImage(image, docPath("opacity-tiger.png"), { maxPixelDiff: 500 });
174
175
  });
175
176
 
176
177
  itRunsE2eOnly("text shouldn't crash on iOS", async () => {