@shopify/react-native-skia 2.12.0-next.1 → 2.13.0

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 (295) hide show
  1. package/LICENSE.md +2 -1
  2. package/Package.swift +117 -0
  3. package/android/CMakeLists.txt +23 -179
  4. package/android/build.gradle +40 -209
  5. package/android/cpp/jni/JniSkiaManager.cpp +3 -45
  6. package/android/cpp/jni/include/JniPlatformContext.h +1 -1
  7. package/android/cpp/jni/include/JniSkiaBaseView.h +18 -11
  8. package/android/cpp/jni/include/JniSkiaManager.h +3 -4
  9. package/android/cpp/jni/include/JniSkiaPictureView.h +5 -5
  10. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -10
  11. package/android/cpp/rnskia-android/RNSkAndroidView.h +6 -6
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
  13. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  14. package/android/src/main/AndroidManifest.xml +1 -1
  15. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/PlatformContext.java +1 -1
  16. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkVideo.java +1 -1
  17. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkiaModule.java +1 -8
  18. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +57 -0
  19. package/android/src/main/java/com/reactnative/skia/SkiaBaseView.java +185 -0
  20. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaBaseViewManager.java +20 -1
  21. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaManager.java +11 -6
  22. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureView.java +3 -3
  23. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureViewManager.java +1 -1
  24. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaSurfaceView.java +13 -3
  25. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaTextureView.java +5 -3
  26. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaViewAPI.java +1 -1
  27. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/ViewScreenshotService.java +10 -13
  28. package/apple/MetalContext.mm +1 -1
  29. package/apple/RNSkApplePlatformContext.h +0 -3
  30. package/apple/RNSkApplePlatformContext.mm +0 -11
  31. package/apple/RNSkiaModule.h +1 -10
  32. package/apple/RNSkiaModule.mm +2 -10
  33. package/apple/SkiaManager.h +0 -2
  34. package/apple/SkiaManager.mm +4 -6
  35. package/apple/SkiaPictureView.h +2 -2
  36. package/apple/SkiaPictureView.mm +0 -4
  37. package/apple/SkiaUIView.h +3 -18
  38. package/apple/SkiaUIView.mm +0 -30
  39. package/cpp/api/CustomBlendModes.h +17 -0
  40. package/cpp/api/JsiSkApi.h +0 -6
  41. package/cpp/api/JsiSkCanvas.h +19 -10
  42. package/cpp/api/JsiSkFont.h +5 -10
  43. package/cpp/api/JsiSkMatrix.h +4 -2
  44. package/cpp/api/JsiSkSVGFactory.h +4 -0
  45. package/cpp/api/recorder/Convertor.h +5 -2
  46. package/cpp/api/recorder/Drawings.h +13 -3
  47. package/cpp/api/recorder/ImageFilters.h +15 -1
  48. package/cpp/api/recorder/Paint.h +8 -1
  49. package/cpp/jsi/JSICache.cpp +99 -0
  50. package/cpp/jsi/JSICache.h +90 -0
  51. package/cpp/jsi/NativeObject.h +38 -87
  52. package/cpp/jsi/ViewProperty.h +0 -28
  53. package/cpp/rnskia/RNDawnContext.h +2 -1
  54. package/cpp/rnskia/RNDawnWindowContext.h +22 -0
  55. package/cpp/rnskia/RNSkManager.cpp +0 -6
  56. package/cpp/rnskia/RNSkPlatformContext.h +0 -3
  57. package/cpp/skia/include/core/RasterContext.h +25 -0
  58. package/cpp/skia/include/core/SkCanvas.h +0 -1
  59. package/cpp/skia/include/core/SkContext.h +62 -0
  60. package/cpp/skia/include/core/SkContextOptions.h +15 -0
  61. package/cpp/skia/include/core/SkMilestone.h +1 -1
  62. package/cpp/skia/include/core/SkPicture.h +36 -18
  63. package/cpp/skia/include/core/SkRecorder.h +8 -0
  64. package/cpp/skia/include/core/SkSerialProcs.h +2 -6
  65. package/cpp/skia/include/effects/SkImageFilters.h +15 -2
  66. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +73 -47
  67. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +7 -4
  68. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +12 -0
  69. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +11 -0
  70. package/cpp/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +11 -0
  71. package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +13 -0
  72. package/cpp/skia/include/gpu/graphite/ContextOptions.h +6 -0
  73. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +5 -4
  74. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +9 -1
  75. package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
  76. package/cpp/skia/include/gpu/graphite/Recording.h +3 -0
  77. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -0
  78. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +11 -0
  79. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +11 -0
  80. package/cpp/skia/include/private/SkLog.h +1 -19
  81. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +2 -1
  82. package/cpp/skia/include/utils/SkLogHandler.h +53 -0
  83. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -0
  84. package/cpp/skia/modules/skcms/src/Transform_inl.h +9 -10
  85. package/cpp/skia/modules/skcms/src/skcms_internals.h +8 -3
  86. package/cpp/skia/modules/skottie/include/SkottieProperty.h +2 -0
  87. package/cpp/skia/modules/skottie/include/TextShaper.h +1 -0
  88. package/cpp/skia/modules/skshaper/include/SkShaper.h +23 -1
  89. package/include/ReactNativeSkia.h +6 -0
  90. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  91. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  92. package/lib/commonjs/external/reanimated/useVideo.js +8 -2
  93. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  94. package/lib/commonjs/mock/index.js +0 -1
  95. package/lib/commonjs/mock/index.js.map +1 -1
  96. package/lib/commonjs/renderer/Canvas.d.ts +11 -3
  97. package/lib/commonjs/renderer/Canvas.js +8 -6
  98. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  99. package/lib/commonjs/renderer/components/Mask.js +3 -9
  100. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  101. package/lib/commonjs/skia/types/JsiInstance.d.ts +1 -0
  102. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  103. package/lib/commonjs/skia/types/Matrix4.js +7 -2
  104. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  105. package/lib/commonjs/skia/types/Skia.d.ts +1 -6
  106. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  107. package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -7
  108. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  109. package/lib/commonjs/skia/web/JsiSkImage.js +6 -3
  110. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  111. package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
  112. package/lib/commonjs/skia/web/JsiSkPathBuilder.js +2 -2
  113. package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -1
  114. package/lib/commonjs/skia/web/JsiSkTextStyle.js +5 -5
  115. package/lib/commonjs/skia/web/JsiSkTextStyle.js.map +1 -1
  116. package/lib/commonjs/skia/web/JsiSkia.js +0 -3
  117. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  118. package/lib/commonjs/skia/web/JsiSkottieAnimation.js +8 -8
  119. package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -1
  120. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
  121. package/lib/commonjs/sksg/Recorder/DrawingContext.js +15 -0
  122. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
  123. package/lib/commonjs/sksg/Recorder/Player.js +1 -1
  124. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  125. package/lib/commonjs/sksg/Recorder/Visitor.js +6 -1
  126. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  127. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +12 -9
  128. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  129. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +15 -1
  130. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  131. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +1 -1
  132. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  133. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  134. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  135. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  136. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  137. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  138. package/lib/commonjs/views/SkiaPictureView.js +2 -12
  139. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  140. package/lib/commonjs/views/SkiaPictureView.web.js +247 -57
  141. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  142. package/lib/commonjs/views/types.d.ts +19 -8
  143. package/lib/commonjs/views/types.js.map +1 -1
  144. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  145. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  146. package/lib/module/external/reanimated/useVideo.js +8 -2
  147. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  148. package/lib/module/mock/index.js +0 -1
  149. package/lib/module/mock/index.js.map +1 -1
  150. package/lib/module/renderer/Canvas.d.ts +11 -3
  151. package/lib/module/renderer/Canvas.js +7 -5
  152. package/lib/module/renderer/Canvas.js.map +1 -1
  153. package/lib/module/renderer/components/Mask.js +3 -9
  154. package/lib/module/renderer/components/Mask.js.map +1 -1
  155. package/lib/module/skia/types/JsiInstance.d.ts +1 -0
  156. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  157. package/lib/module/skia/types/Matrix4.js +7 -2
  158. package/lib/module/skia/types/Matrix4.js.map +1 -1
  159. package/lib/module/skia/types/Skia.d.ts +1 -6
  160. package/lib/module/skia/types/Skia.js.map +1 -1
  161. package/lib/module/skia/web/JsiSkCanvas.js +12 -7
  162. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  163. package/lib/module/skia/web/JsiSkImage.js +6 -3
  164. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  165. package/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
  166. package/lib/module/skia/web/JsiSkPathBuilder.js +2 -2
  167. package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -1
  168. package/lib/module/skia/web/JsiSkTextStyle.js +5 -5
  169. package/lib/module/skia/web/JsiSkTextStyle.js.map +1 -1
  170. package/lib/module/skia/web/JsiSkia.js +0 -3
  171. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  172. package/lib/module/skia/web/JsiSkottieAnimation.js +8 -8
  173. package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -1
  174. package/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
  175. package/lib/module/sksg/Recorder/DrawingContext.js +15 -0
  176. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
  177. package/lib/module/sksg/Recorder/Player.js +1 -1
  178. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  179. package/lib/module/sksg/Recorder/Visitor.js +6 -1
  180. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  181. package/lib/module/sksg/Recorder/commands/Drawing.js +12 -9
  182. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  183. package/lib/module/sksg/Recorder/commands/ImageFilters.js +15 -1
  184. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  185. package/lib/module/sksg/Recorder/commands/Shaders.js +1 -1
  186. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  187. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  188. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  189. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  190. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  191. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  192. package/lib/module/views/SkiaPictureView.js +2 -12
  193. package/lib/module/views/SkiaPictureView.js.map +1 -1
  194. package/lib/module/views/SkiaPictureView.web.js +247 -57
  195. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  196. package/lib/module/views/types.d.ts +19 -8
  197. package/lib/module/views/types.js.map +1 -1
  198. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  199. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
  200. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
  201. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +0 -1
  202. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
  203. package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  204. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  205. package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -2
  206. package/lib/typescript/lib/module/skia/Skia.web.d.ts +0 -1
  207. package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
  208. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +0 -1
  209. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
  210. package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  211. package/lib/typescript/react-native.config.d.ts +3 -0
  212. package/lib/typescript/src/renderer/Canvas.d.ts +11 -3
  213. package/lib/typescript/src/skia/types/JsiInstance.d.ts +1 -0
  214. package/lib/typescript/src/skia/types/Skia.d.ts +1 -6
  215. package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +1 -1
  216. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +1 -0
  217. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  218. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  219. package/lib/typescript/src/views/types.d.ts +19 -8
  220. package/package.json +15 -12
  221. package/react-native-skia.podspec +4 -10
  222. package/react-native.config.js +5 -0
  223. package/src/dom/nodes/datatypes/Rect.ts +6 -1
  224. package/src/external/reanimated/useVideo.ts +7 -2
  225. package/src/mock/index.ts +0 -1
  226. package/src/renderer/Canvas.tsx +23 -5
  227. package/src/renderer/components/Mask.tsx +10 -3
  228. package/src/skia/types/JsiInstance.ts +2 -0
  229. package/src/skia/types/Matrix4.ts +6 -2
  230. package/src/skia/types/Skia.ts +1 -7
  231. package/src/skia/web/JsiSkCanvas.ts +22 -12
  232. package/src/skia/web/JsiSkImage.ts +6 -3
  233. package/src/skia/web/JsiSkPathBuilder.ts +2 -2
  234. package/src/skia/web/JsiSkTextStyle.ts +20 -15
  235. package/src/skia/web/JsiSkia.ts +0 -4
  236. package/src/skia/web/JsiSkottieAnimation.ts +8 -8
  237. package/src/sksg/Recorder/DrawingContext.ts +15 -0
  238. package/src/sksg/Recorder/Player.ts +1 -1
  239. package/src/sksg/Recorder/Visitor.ts +9 -6
  240. package/src/sksg/Recorder/commands/Drawing.ts +12 -9
  241. package/src/sksg/Recorder/commands/ImageFilters.ts +20 -1
  242. package/src/sksg/Recorder/commands/Shaders.ts +1 -1
  243. package/src/specs/SkiaPictureViewNativeComponent.ts +5 -0
  244. package/src/specs/SkiaPictureViewNativeComponent.web.ts +5 -0
  245. package/src/views/SkiaPictureView.tsx +2 -10
  246. package/src/views/SkiaPictureView.web.tsx +245 -57
  247. package/src/views/types.ts +23 -10
  248. package/android/src/latest/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -11
  249. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +0 -79
  250. package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +0 -113
  251. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -136
  252. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +0 -41
  253. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +0 -20
  254. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +0 -35
  255. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +0 -17
  256. package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +0 -38
  257. package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -14
  258. package/apple/SkiaPictureViewManager.h +0 -8
  259. package/apple/SkiaPictureViewManager.mm +0 -60
  260. package/apple/SkiaWebGPUView.h +0 -20
  261. package/apple/WebGPUMetalView.h +0 -12
  262. package/cpp/api/JsiSkiaContext.h +0 -94
  263. package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
  264. package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
  265. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
  266. package/cpp/dawn/include/dawn/dawn_version.h +0 -41
  267. package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
  268. package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -103
  269. package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
  270. package/cpp/dawn/include/dawn/native/DawnNative.h +0 -368
  271. package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
  272. package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
  273. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
  274. package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
  275. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
  276. package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
  277. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -207
  278. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
  279. package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
  280. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
  281. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2856
  282. package/cpp/dawn/include/tint/tint.h +0 -91
  283. package/cpp/dawn/include/webgpu/webgpu.h +0 -5029
  284. package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10353
  285. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
  286. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -162
  287. package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
  288. package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
  289. package/cpp/jsi/RuntimeAwareCache.h +0 -117
  290. package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
  291. package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
  292. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
  293. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
  294. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
  295. package/libs/.graphite +0 -1
@@ -2,39 +2,23 @@ import java.nio.file.Paths
2
2
 
3
3
  // android/build.gradle
4
4
 
5
- // based on:
6
- //
7
- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
8
- // previous location:
9
- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
10
- //
11
- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
12
- // previous location:
13
- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
14
-
15
5
  // FBJNI build is based on:
16
6
  // https://github.com/facebookincubator/fbjni/blob/main/docs/android_setup.md
17
7
 
18
8
  // These defaults should reflect the SDK versions used by
19
- // the minimum React Native version supported.
20
- def DEFAULT_COMPILE_SDK_VERSION = 28
21
- def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
22
- def DEFAULT_MIN_SDK_VERSION = 21
23
- def DEFAULT_TARGET_SDK_VERSION = 28
9
+ // the minimum React Native version supported (0.78).
10
+ def DEFAULT_COMPILE_SDK_VERSION = 35
11
+ def DEFAULT_BUILD_TOOLS_VERSION = '35.0.0'
12
+ def DEFAULT_MIN_SDK_VERSION = 24
13
+ def DEFAULT_TARGET_SDK_VERSION = 34
24
14
 
25
15
  def safeExtGet(prop, fallback) {
26
16
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
27
17
  }
28
18
 
29
- def isNewArchitectureEnabled() {
30
- // To opt-in for the New Architecture, you can either:
31
- // - Set `newArchEnabled` to true inside the `gradle.properties` file
32
- // - Invoke gradle with `-newArchEnabled=true`
33
- // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
34
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
35
- }
36
-
37
19
  apply plugin: 'com.android.library'
20
+ // Runs codegen for the TurboModule spec and the Fabric component (src/specs).
21
+ apply plugin: 'com.facebook.react'
38
22
 
39
23
  def reactNativeArchitectures() {
40
24
  def value = project.getProperties().get("reactNativeArchitectures")
@@ -128,10 +112,6 @@ logger.warn("react-native-skia: node_modules/ found at: ${nodeModules}")
128
112
  def sourceBuild = false
129
113
  def defaultDir
130
114
 
131
- if (isNewArchitectureEnabled()) {
132
- apply plugin: "com.facebook.react"
133
- }
134
-
135
115
  if (rootProject.ext.has('reactNativeAndroidRoot')) {
136
116
  defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
137
117
  } else if (findProject(':ReactAndroid') != null) {
@@ -147,54 +127,18 @@ if (!defaultDir.exists()) {
147
127
  )
148
128
  }
149
129
 
150
- def prebuiltDir = sourceBuild
151
- ? "$nodeModules/react-native/ReactAndroid/src/main/jni/prebuilt/lib"
152
- : "$buildDir/react-native-0*/jni"
153
-
154
-
155
- def buildType = "debug"
156
- if (gradle.startParameter.taskRequests.args[0].toString().contains("Release")) {
157
- buildType = "release"
158
- } else if (gradle.startParameter.taskRequests.args[0].toString().contains("Debug")) {
159
- buildType = "debug"
160
- }
161
-
162
130
  def reactProperties = new Properties()
163
131
  file("$nodeModules/react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
164
132
  def FULL_RN_VERSION = (System.getenv("REACT_NATIVE_OVERRIDE_VERSION") ?: reactProperties.getProperty("VERSION_NAME"))
165
133
  def REACT_NATIVE_VERSION = FULL_RN_VERSION.split("\\.")[1].toInteger()
166
- def ENABLE_PREFAB = REACT_NATIVE_VERSION > 68
167
134
 
168
135
  logger.warn("react-native-skia: RN Version: ${REACT_NATIVE_VERSION} / ${FULL_RN_VERSION}")
169
136
  logger.warn("react-native-skia: isSourceBuild: ${sourceBuild}")
170
- logger.warn("react-native-skia: PrebuiltDir: ${prebuiltDir}")
171
- logger.warn("react-native-skia: buildType: ${buildType}")
172
137
  logger.warn("react-native-skia: buildDir: ${buildDir}")
173
138
  logger.warn("react-native-skia: node_modules: ${nodeModules}")
174
- logger.warn("react-native-skia: Enable Prefab: ${ENABLE_PREFAB}")
175
-
176
- buildscript {
177
- // The Android Gradle plugin is only required when opening the android folder stand-alone.
178
- // This avoids unnecessary downloads and potential conflicts when the library is included as a
179
- // module dependency in an application project.
180
- // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
181
- if (project == rootProject) {
182
- repositories {
183
- google()
184
- }
185
- dependencies {
186
- // This should reflect the Gradle plugin version used by
187
- // the minimum React Native version supported.
188
- classpath 'com.android.tools.build:gradle:3.4.1'
189
- }
190
- }
191
- }
192
139
 
193
140
  android {
194
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
195
- if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
196
- namespace "com.shopify.reactnative.skia"
197
- }
141
+ namespace "com.reactnative.skia"
198
142
 
199
143
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
200
144
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
@@ -213,17 +157,15 @@ android {
213
157
  targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
214
158
  versionCode 1
215
159
  versionName "1.0"
216
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
217
160
 
218
161
  externalNativeBuild {
219
162
  cmake {
220
- cppFlags "-fexceptions", "-frtti", "-std=c++1y", "-DONANDROID"
163
+ cppFlags "-fexceptions", "-frtti"
221
164
  abiFilters (*reactNativeArchitectures())
222
165
  arguments '-DANDROID_STL=c++_shared',
223
166
  "-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
224
167
  "-DREACT_NATIVE_DIR=${defaultDir}",
225
168
  "-DNODE_MODULES_DIR=${nodeModules}",
226
- "-DPREBUILT_DIR=${prebuiltDir}",
227
169
  "-DSKIA_LIBS_PATH=${skiaLibsPath}",
228
170
  "-DSK_GRAPHITE=${useGraphite ? 'ON' : 'OFF'}",
229
171
  "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
@@ -245,25 +187,6 @@ android {
245
187
  jniLibs {
246
188
  srcDirs += [skiaLibsPath]
247
189
  }
248
- java {
249
- if (!isNewArchitectureEnabled()) {
250
- srcDirs += [
251
- "src/paper/java",
252
- ]
253
- }
254
-
255
- if (REACT_NATIVE_VERSION == 74) {
256
- srcDirs += [
257
- "src/reactnative74/java"
258
- ]
259
- } else {
260
- // the name latest here might be confusing as it applies for versions
261
- // below 74 as well
262
- srcDirs += [
263
- "src/latest/java"
264
- ]
265
- }
266
- }
267
190
  }
268
191
 
269
192
  externalNativeBuild {
@@ -277,45 +200,23 @@ android {
277
200
  "**/libc++_shared.so",
278
201
  "**/libfbjni.so",
279
202
  "**/libjsi.so",
280
- "**/libreact_nativemodule_core.so",
281
- "**/libreactnativejni.so",
282
- "**/libruntimeexecutor.so",
283
- "**/libturbomodulejsijni.so",
284
203
  "**/libreactnative.so",
285
204
  "META-INF/**"
286
205
  ]
287
206
  }
288
207
 
289
- if (ENABLE_PREFAB) {
290
- buildFeatures {
291
- prefab true
292
- prefabPublishing true
293
- }
294
- prefab {
295
- rnskia {
296
- headers "${project.buildDir}/headers/rnskia/"
297
- }
298
- }
208
+ buildFeatures {
209
+ prefab true
210
+ prefabPublishing true
299
211
  }
300
-
301
- // Create new configurations that can be referred to in dependencies.
302
- // The Android Gradle Plugin 3.* does not allow hooking into existing
303
- // configurations like `implementation`.
304
- configurations {
305
- extractHeaders
306
- extractJNI
212
+ prefab {
213
+ rnskia {
214
+ headers "${project.buildDir}/headers/rnskia/"
215
+ }
307
216
  }
308
217
  }
309
218
 
310
219
  repositories {
311
- maven {
312
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
313
- url("$rootDir/../node_modules/react-native/android")
314
- }
315
- maven {
316
- // Android JSC is installed from npm
317
- url("$rootDir/../node_modules/jsc-android/dist")
318
- }
319
220
  mavenCentral {
320
221
  // We don't want to fetch react-native from Maven Central as there are
321
222
  // older versions over there.
@@ -329,102 +230,32 @@ repositories {
329
230
  dependencies {
330
231
  //noinspection GradleDynamicVersion
331
232
  implementation 'com.facebook.react:react-native:+' // From node_modules
332
-
333
- if (REACT_NATIVE_VERSION < 71) {
334
- logger.warn("react-native-skia: Extracting files from AAR (pre RN 0.71)")
335
- //noinspection GradleDynamicVersion
336
- extractHeaders("com.facebook.fbjni:fbjni:0.2.2:headers")
337
- //noinspection GradleDynamicVersion
338
- extractJNI("com.facebook.fbjni:fbjni:0.2.2")
339
- }
340
-
341
- if (!sourceBuild) {
342
- def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
343
- if (REACT_NATIVE_VERSION < 69) {
344
- logger.warn("react-native-skia: aar state pre 69. match **/**/*.aar")
345
- rnAarMatcher = "**/**/*.aar"
346
- } else if (REACT_NATIVE_VERSION >= 71) {
347
- logger.warn("react-native-skia: aar state post 70, do nothing")
348
- return
349
- }
350
- def rnAAR = fileTree("${nodeModules}/react-native/android").matching({ it.include rnAarMatcher }).singleFile
351
- logger.warn("react-native-skia: Extracting JNI files (pre RN 0.71) ${rnAAR}")
352
- extractJNI(files(rnAAR))
353
- }
354
233
  }
355
234
 
356
- def localBuildDir = buildDir
357
- def headersConfiguration = configurations.extractHeaders
358
- def jniConfiguration = configurations.extractJNI
359
-
360
- task extractAARHeaders {
361
- doLast {
362
- headersConfiguration.files.each { file ->
363
- def absFile = file.absoluteFile
364
- project.copy {
365
- from project.zipTree(absFile)
366
- into "${localBuildDir}/${absFile.name}"
367
- include "**/*.h"
368
- }
235
+ // Package all the cpp code in a flattened directory structure
236
+ task prepareHeaders(type: Copy) {
237
+ from("../cpp")
238
+ from("./cpp")
239
+ into "${project.buildDir}/headers/rnskia/react-native-skia"
240
+ includeEmptyDirs = false
241
+ include "**/*.h"
242
+ eachFile {
243
+ String path = it.path
244
+
245
+ if (path.contains("api/third_party")) {
246
+ // Skip flattening third_party dir
247
+ path = path.substring("api/".length())
248
+ } else if (path.contains("skia/include") || path.contains("skia/modules") || path.contains("skia/src")) {
249
+ // Skip flattening Skia dir
250
+ path = path.substring("skia/".length())
251
+ } else if (path.startsWith("dawn/include/")) {
252
+ // Flatten dawn/include/dawn and dawn/include/webgpu
253
+ path = path.substring("dawn/include/".length())
254
+ } else {
255
+ // flatten anything else
256
+ path = path.substring(path.lastIndexOf("/") + 1)
369
257
  }
258
+ it.path = path
370
259
  }
371
260
  }
372
-
373
- task extractJNIFiles {
374
- doLast {
375
- jniConfiguration.files.each { file ->
376
- def absFile = file.absoluteFile
377
- project.copy {
378
- from project.zipTree(absFile)
379
- into "${localBuildDir}/${absFile.name}"
380
- include "jni/**/*"
381
- }
382
- }
383
- }
384
- }
385
-
386
- extractJNIFiles.mustRunAfter extractAARHeaders
387
-
388
- if (ENABLE_PREFAB) {
389
- // Package all the cpp code in a flattened directory structure
390
- task prepareHeaders(type: Copy) {
391
- from("../cpp")
392
- from("./cpp")
393
- into "${project.buildDir}/headers/rnskia/react-native-skia"
394
- includeEmptyDirs = false
395
- include "**/*.h"
396
- eachFile {
397
- String path = it.path
398
-
399
- if (path.contains("api/third_party")) {
400
- // Skip flattening third_party dir
401
- path = path.substring("api/".length())
402
- } else if (path.contains("skia/include") || path.contains("skia/modules") || path.contains("skia/src")) {
403
- // Skip flattening Skia dir
404
- path = path.substring("skia/".length())
405
- } else if (path.startsWith("dawn/include/")) {
406
- // Flatten dawn/include/dawn and dawn/include/webgpu
407
- path = path.substring("dawn/include/".length())
408
- } else {
409
- // flatten anything else
410
- path = path.substring(path.lastIndexOf("/") + 1)
411
- }
412
- it.path = path
413
- }
414
- }
415
- preBuild.dependsOn(prepareHeaders)
416
- }
417
-
418
- def nativeBuildDependsOn(dependsOnTask, variant) {
419
- def buildTasks = tasks.findAll({ task ->
420
- !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake")) })
421
- if (variant != null) {
422
- buildTasks = buildTasks.findAll({ task -> task.name.contains(variant) })
423
- }
424
- buildTasks.forEach { task -> task.dependsOn(dependsOnTask) }
425
- }
426
-
427
- afterEvaluate {
428
- nativeBuildDependsOn(extractAARHeaders, null)
429
- nativeBuildDependsOn(extractJNIFiles, null)
430
- }
261
+ preBuild.dependsOn(prepareHeaders)
@@ -7,47 +7,6 @@
7
7
 
8
8
  #include "RNSkManager.h"
9
9
 
10
- namespace {
11
-
12
- #if REACT_NATIVE_VERSION >= 75
13
- using CallFuncType = facebook::react::CallFunc;
14
- #else
15
- using CallFuncType = std::function<void()>;
16
- #endif
17
-
18
- // For bridgeless mode, currently we don't have a way to get the JSCallInvoker
19
- // from Java. Workaround to use RuntimeExecutor to simulate the behavior of
20
- // JSCallInvoker. In the future when bridgeless mode is a standard and no more
21
- // backward compatible to be considered, we could just use RuntimeExecutor to
22
- // run task on JS thread.
23
- class BridgelessJSCallInvoker : public facebook::react::CallInvoker {
24
- public:
25
- explicit BridgelessJSCallInvoker(
26
- facebook::react::RuntimeExecutor runtimeExecutor)
27
- : runtimeExecutor_(std::move(runtimeExecutor)) {}
28
-
29
- void invokeAsync(CallFuncType &&func) noexcept override {
30
- runtimeExecutor_([func = std::move(func)](facebook::jsi::Runtime &runtime) {
31
- #if REACT_NATIVE_VERSION >= 75
32
- func(runtime);
33
- #else
34
- func();
35
- #endif
36
- });
37
- }
38
-
39
- void invokeSync(CallFuncType &&func) override {
40
- throw std::runtime_error(
41
- "Synchronous native -> JS calls are currently not supported.");
42
- }
43
-
44
- private:
45
- facebook::react::RuntimeExecutor runtimeExecutor_;
46
-
47
- }; // class BridgelessJSCallInvoker
48
-
49
- } // namespace
50
-
51
10
  namespace RNSkia {
52
11
 
53
12
  namespace jsi = facebook::jsi;
@@ -65,12 +24,11 @@ void JniSkiaManager::registerNatives() {
65
24
  jni::local_ref<jni::HybridClass<JniSkiaManager>::jhybriddata>
66
25
  JniSkiaManager::initHybrid(
67
26
  jni::alias_ref<jhybridobject> jThis, jlong jsContext,
68
- jni::alias_ref<facebook::react::JRuntimeExecutor::javaobject>
69
- jRuntimeExecutor,
27
+ jni::alias_ref<facebook::react::CallInvokerHolder::javaobject>
28
+ jsCallInvokerHolder,
70
29
  JavaPlatformContext skiaContext) {
71
30
 
72
- auto jsCallInvoker = std::make_shared<BridgelessJSCallInvoker>(
73
- jRuntimeExecutor->cthis()->get());
31
+ auto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker();
74
32
  // cast from JNI hybrid objects to C++ instances
75
33
  return makeCxxInstance(jThis, reinterpret_cast<jsi::Runtime *>(jsContext),
76
34
  jsCallInvoker, skiaContext->cthis());
@@ -21,7 +21,7 @@ namespace jni = facebook::jni;
21
21
  class JniPlatformContext : public jni::HybridClass<JniPlatformContext> {
22
22
  public:
23
23
  static auto constexpr kJavaDescriptor =
24
- "Lcom/shopify/reactnative/skia/PlatformContext;";
24
+ "Lcom/reactnative/skia/PlatformContext;";
25
25
 
26
26
  static jni::local_ref<jhybriddata>
27
27
  initHybrid(jni::alias_ref<jhybridobject> jThis, const float);
@@ -21,24 +21,28 @@ class JniSkiaBaseView {
21
21
  public:
22
22
  JniSkiaBaseView(jni::alias_ref<JniSkiaManager::javaobject> skiaManager,
23
23
  std::shared_ptr<RNSkBaseAndroidView> skiaView)
24
- : _skiaAndroidView(std::move(skiaView)), _manager(skiaManager->cthis()) {}
24
+ : _skiaAndroidView(std::move(skiaView)),
25
+ _manager(skiaManager->cthis()->getSkiaManager()) {}
25
26
 
26
27
  ~JniSkiaBaseView() = default;
27
28
 
28
- std::shared_ptr<RNSkManager> getSkiaManager() {
29
- return _manager->getSkiaManager();
30
- }
29
+ // The manager is owned by the RNSkiaModule and is destroyed when the module
30
+ // is invalidated (reload). Fabric drops views on the UI thread while the
31
+ // module is invalidated on a background thread, so a view can outlive its
32
+ // manager: holding a weak reference makes a late unregister a no-op and a
33
+ // concurrent one keep the manager alive for the duration of the call.
34
+ std::shared_ptr<RNSkManager> getSkiaManager() { return _manager.lock(); }
31
35
 
32
36
  protected:
33
37
  virtual void surfaceAvailable(jobject surface, int width, int height,
34
- bool opaque, bool highBitDepth) {
35
- _skiaAndroidView->surfaceAvailable(surface, width, height, opaque,
38
+ bool isSurface, bool highBitDepth) {
39
+ _skiaAndroidView->surfaceAvailable(surface, width, height, isSurface,
36
40
  highBitDepth);
37
41
  }
38
42
 
39
43
  virtual void surfaceSizeChanged(jobject surface, int width, int height,
40
- bool opaque, bool highBitDepth) {
41
- _skiaAndroidView->surfaceSizeChanged(surface, width, height, opaque,
44
+ bool isSurface, bool highBitDepth) {
45
+ _skiaAndroidView->surfaceSizeChanged(surface, width, height, isSurface,
42
46
  highBitDepth);
43
47
  }
44
48
 
@@ -49,8 +53,11 @@ protected:
49
53
  }
50
54
 
51
55
  virtual void registerView(int nativeId) {
52
- getSkiaManager()->registerSkiaView(nativeId,
53
- _skiaAndroidView->getSkiaView());
56
+ auto manager = getSkiaManager();
57
+ if (manager == nullptr) {
58
+ return;
59
+ }
60
+ manager->registerSkiaView(nativeId, _skiaAndroidView->getSkiaView());
54
61
  }
55
62
 
56
63
  virtual void unregisterView() {
@@ -74,7 +81,7 @@ protected:
74
81
  std::shared_ptr<RNSkBaseAndroidView> _skiaAndroidView;
75
82
 
76
83
  private:
77
- JniSkiaManager *_manager;
84
+ std::weak_ptr<RNSkManager> _manager;
78
85
  };
79
86
 
80
87
  } // namespace RNSkia
@@ -5,7 +5,6 @@
5
5
  #include <fbjni/fbjni.h>
6
6
  #include <jsi/jsi.h>
7
7
  #include <memory>
8
- #include <react/jni/JRuntimeExecutor.h>
9
8
 
10
9
  #include "JniPlatformContext.h"
11
10
  #include "RNSkAndroidPlatformContext.h"
@@ -23,13 +22,13 @@ using JavaPlatformContext = jni::alias_ref<JniPlatformContext::javaobject>;
23
22
  class JniSkiaManager : public jni::HybridClass<JniSkiaManager> {
24
23
  public:
25
24
  static auto constexpr kJavaDescriptor =
26
- "Lcom/shopify/reactnative/skia/SkiaManager;";
25
+ "Lcom/reactnative/skia/SkiaManager;";
27
26
  static auto constexpr TAG = "ReactNativeSkia";
28
27
 
29
28
  static jni::local_ref<jni::HybridClass<JniSkiaManager>::jhybriddata>
30
29
  initHybrid(jni::alias_ref<jhybridobject> jThis, jlong jsContext,
31
- jni::alias_ref<facebook::react::JRuntimeExecutor::javaobject>
32
- jRuntimeExecutor,
30
+ jni::alias_ref<facebook::react::CallInvokerHolder::javaobject>
31
+ jsCallInvokerHolder,
33
32
  JavaPlatformContext platformContext);
34
33
 
35
34
  static void registerNatives();
@@ -39,7 +39,7 @@ class JniSkiaPictureView : public jni::HybridClass<JniSkiaPictureView>,
39
39
  public JniSkiaBaseView {
40
40
  public:
41
41
  static auto constexpr kJavaDescriptor =
42
- "Lcom/shopify/reactnative/skia/SkiaPictureView;";
42
+ "Lcom/reactnative/skia/SkiaPictureView;";
43
43
 
44
44
  static jni::local_ref<jhybriddata>
45
45
  initHybrid(jni::alias_ref<jhybridobject> jThis,
@@ -63,15 +63,15 @@ public:
63
63
  }
64
64
 
65
65
  protected:
66
- void surfaceAvailable(jobject surface, int width, int height, bool opaque,
66
+ void surfaceAvailable(jobject surface, int width, int height, bool isSurface,
67
67
  bool highBitDepth) override {
68
- JniSkiaBaseView::surfaceAvailable(surface, width, height, opaque,
68
+ JniSkiaBaseView::surfaceAvailable(surface, width, height, isSurface,
69
69
  highBitDepth);
70
70
  }
71
71
 
72
- void surfaceSizeChanged(jobject surface, int width, int height, bool opaque,
72
+ void surfaceSizeChanged(jobject surface, int width, int height, bool isSurface,
73
73
  bool highBitDepth) override {
74
- JniSkiaBaseView::surfaceSizeChanged(surface, width, height, opaque,
74
+ JniSkiaBaseView::surfaceSizeChanged(surface, width, height, isSurface,
75
75
  highBitDepth);
76
76
  }
77
77
 
@@ -63,16 +63,6 @@ public:
63
63
  #endif
64
64
  }
65
65
 
66
- std::shared_ptr<WindowContext>
67
- makeContextFromNativeSurface(void *surface, int width, int height) override {
68
- #if defined(SK_GRAPHITE)
69
- return DawnContext::getInstance().MakeWindow(surface, width, height);
70
- #else
71
- auto aWindow = reinterpret_cast<ANativeWindow *>(surface);
72
- return OpenGLContext::getInstance().MakeWindow(aWindow);
73
- #endif
74
- }
75
-
76
66
  sk_sp<SkImage> makeImageFromNativeBuffer(void *buffer) override {
77
67
  #if defined(SK_GRAPHITE)
78
68
  return DawnContext::getInstance().MakeImageFromBuffer(buffer);
@@ -12,12 +12,12 @@ namespace RNSkia {
12
12
  class RNSkBaseAndroidView {
13
13
  public:
14
14
  virtual void surfaceAvailable(jobject surface, int width, int height,
15
- bool opaque, bool highBitDepth) = 0;
15
+ bool isSurface, bool highBitDepth) = 0;
16
16
 
17
17
  virtual void surfaceDestroyed() = 0;
18
18
 
19
19
  virtual void surfaceSizeChanged(jobject surface, int width, int height,
20
- bool opaque, bool highBitDepth) = 0;
20
+ bool isSurface, bool highBitDepth) = 0;
21
21
 
22
22
  virtual float getPixelDensity() = 0;
23
23
 
@@ -34,10 +34,10 @@ public:
34
34
  std::make_shared<RNSkOpenGLCanvasProvider>(
35
35
  std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
36
36
 
37
- void surfaceAvailable(jobject surface, int width, int height, bool opaque,
37
+ void surfaceAvailable(jobject surface, int width, int height, bool isSurface,
38
38
  bool highBitDepth) override {
39
39
  std::static_pointer_cast<RNSkOpenGLCanvasProvider>(T::getCanvasProvider())
40
- ->surfaceAvailable(surface, width, height, opaque, highBitDepth);
40
+ ->surfaceAvailable(surface, width, height, isSurface, highBitDepth);
41
41
  RNSkView::redraw();
42
42
  }
43
43
 
@@ -46,10 +46,10 @@ public:
46
46
  ->surfaceDestroyed();
47
47
  }
48
48
 
49
- void surfaceSizeChanged(jobject surface, int width, int height, bool opaque,
49
+ void surfaceSizeChanged(jobject surface, int width, int height, bool isSurface,
50
50
  bool highBitDepth) override {
51
51
  std::static_pointer_cast<RNSkOpenGLCanvasProvider>(T::getCanvasProvider())
52
- ->surfaceSizeChanged(surface, width, height, opaque, highBitDepth);
52
+ ->surfaceSizeChanged(surface, width, height, isSurface, highBitDepth);
53
53
  // This is only need for the first time to frame, this renderImmediate call
54
54
  // will invoke updateTexImage for the previous frame
55
55
  RNSkView::redraw();
@@ -78,7 +78,7 @@ bool RNSkOpenGLCanvasProvider::renderToCanvas(
78
78
 
79
79
  void RNSkOpenGLCanvasProvider::surfaceAvailable(jobject jSurfaceTexture,
80
80
  int width, int height,
81
- bool opaque,
81
+ bool isSurface,
82
82
  bool highBitDepth) {
83
83
  // Release the old surface
84
84
  _surfaceHolder = nullptr;
@@ -86,7 +86,7 @@ void RNSkOpenGLCanvasProvider::surfaceAvailable(jobject jSurfaceTexture,
86
86
  // Create renderer!
87
87
  ANativeWindow *window = nullptr;
88
88
  JNIEnv *env = facebook::jni::Environment::current();
89
- if (!opaque) {
89
+ if (!isSurface) {
90
90
  _jSurfaceTexture = env->NewGlobalRef(jSurfaceTexture);
91
91
  jclass surfaceClass = env->FindClass("android/view/Surface");
92
92
  jmethodID surfaceConstructor = env->GetMethodID(
@@ -131,7 +131,7 @@ void RNSkOpenGLCanvasProvider::surfaceDestroyed() {
131
131
  }
132
132
 
133
133
  void RNSkOpenGLCanvasProvider::surfaceSizeChanged(jobject jSurface, int width,
134
- int height, bool opaque,
134
+ int height, bool isSurface,
135
135
  bool highBitDepth) {
136
136
  if (width == 0 && height == 0) {
137
137
  // Setting width/height to zero is nothing we need to care about when
@@ -141,7 +141,7 @@ void RNSkOpenGLCanvasProvider::surfaceSizeChanged(jobject jSurface, int width,
141
141
 
142
142
  if (_surfaceHolder == nullptr) {
143
143
  _surfaceHolder = nullptr;
144
- surfaceAvailable(jSurface, width, height, opaque, highBitDepth);
144
+ surfaceAvailable(jSurface, width, height, isSurface, highBitDepth);
145
145
  } else {
146
146
  _surfaceHolder->resize(width, height);
147
147
  }
@@ -27,12 +27,12 @@ public:
27
27
 
28
28
  bool renderToCanvas(const std::function<void(SkCanvas *)> &cb) override;
29
29
 
30
- void surfaceAvailable(jobject surface, int width, int height, bool opaque,
30
+ void surfaceAvailable(jobject surface, int width, int height, bool isSurface,
31
31
  bool highBitDepth);
32
32
 
33
33
  void surfaceDestroyed();
34
34
 
35
- void surfaceSizeChanged(jobject jSurface, int width, int height, bool opaque,
35
+ void surfaceSizeChanged(jobject jSurface, int width, int height, bool isSurface,
36
36
  bool highBitDepth);
37
37
 
38
38
  private:
@@ -1,6 +1,6 @@
1
1
  <!-- AndroidManifest.xml -->
2
2
 
3
3
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
4
- package="com.shopify.reactnative.skia">
4
+ package="com.reactnative.skia">
5
5
 
6
6
  </manifest>
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.os.Handler;
4
4
  import android.os.Looper;
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.graphics.ImageFormat;