@shopify/react-native-skia 2.10.0 → 2.11.0-next.1

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 (358) hide show
  1. package/android/CMakeLists.txt +7 -41
  2. package/android/build.gradle +33 -0
  3. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
  4. package/cpp/api/JsiNativeBuffer.h +14 -20
  5. package/cpp/api/JsiSkAnimatedImage.h +13 -16
  6. package/cpp/api/JsiSkAnimatedImageFactory.h +9 -7
  7. package/cpp/api/JsiSkApi.h +94 -90
  8. package/cpp/api/JsiSkCanvas.h +108 -251
  9. package/cpp/api/JsiSkColorFilterFactory.h +45 -63
  10. package/cpp/api/JsiSkContourMeasure.h +19 -29
  11. package/cpp/api/JsiSkContourMeasureIter.h +6 -6
  12. package/cpp/api/JsiSkConverters.h +410 -0
  13. package/cpp/api/JsiSkDataFactory.h +9 -15
  14. package/cpp/api/JsiSkFont.h +99 -180
  15. package/cpp/api/JsiSkFontMgr.h +19 -21
  16. package/cpp/api/JsiSkFontMgrFactory.h +4 -5
  17. package/cpp/api/JsiSkImage.h +66 -66
  18. package/cpp/api/JsiSkImageFactory.h +66 -63
  19. package/cpp/api/JsiSkImageFilterFactory.h +354 -608
  20. package/cpp/api/JsiSkImageInfo.h +10 -13
  21. package/cpp/api/JsiSkMaskFilterFactory.h +8 -11
  22. package/cpp/api/JsiSkMatrix.h +36 -73
  23. package/cpp/api/JsiSkNativeObjects.h +60 -92
  24. package/cpp/api/JsiSkPaint.h +73 -131
  25. package/cpp/api/JsiSkParagraph.h +36 -53
  26. package/cpp/api/JsiSkParagraphBuilder.h +36 -64
  27. package/cpp/api/JsiSkParagraphBuilderFactory.h +11 -16
  28. package/cpp/api/JsiSkPath.h +216 -349
  29. package/cpp/api/JsiSkPathBuilder.h +133 -269
  30. package/cpp/api/JsiSkPathBuilderFactory.h +11 -11
  31. package/cpp/api/JsiSkPathEffectFactory.h +52 -72
  32. package/cpp/api/JsiSkPathFactory.h +129 -195
  33. package/cpp/api/JsiSkPicture.h +12 -18
  34. package/cpp/api/JsiSkPictureRecorder.h +14 -15
  35. package/cpp/api/JsiSkPoint.h +4 -4
  36. package/cpp/api/JsiSkRRect.h +7 -8
  37. package/cpp/api/JsiSkRSXform.h +10 -23
  38. package/cpp/api/JsiSkRect.h +23 -31
  39. package/cpp/api/JsiSkRuntimeEffect.h +67 -83
  40. package/cpp/api/JsiSkRuntimeEffectFactory.h +6 -10
  41. package/cpp/api/JsiSkRuntimeShaderBuilder.h +5 -14
  42. package/cpp/api/JsiSkSVG.h +4 -4
  43. package/cpp/api/JsiSkShaderFactory.h +153 -225
  44. package/cpp/api/JsiSkSkottie.h +104 -126
  45. package/cpp/api/JsiSkSurface.h +11 -14
  46. package/cpp/api/JsiSkSurfaceFactory.h +6 -7
  47. package/cpp/api/JsiSkTextBlobFactory.h +31 -54
  48. package/cpp/api/JsiSkTypeface.h +8 -12
  49. package/cpp/api/JsiSkTypefaceFactory.h +9 -7
  50. package/cpp/api/JsiSkTypefaceFontProvider.h +22 -23
  51. package/cpp/api/JsiSkTypefaceFontProviderFactory.h +5 -6
  52. package/cpp/api/JsiSkVertices.h +6 -8
  53. package/cpp/api/JsiSkiaContext.h +10 -11
  54. package/cpp/api/JsiVideo.h +31 -71
  55. package/cpp/dawn/include/dawn/dawn_proc.h +53 -0
  56. package/cpp/dawn/include/dawn/dawn_proc_table.h +330 -0
  57. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +47 -0
  58. package/cpp/dawn/include/dawn/dawn_version.h +41 -0
  59. package/cpp/dawn/include/dawn/native/D3D11Backend.h +65 -0
  60. package/cpp/dawn/include/dawn/native/D3D12Backend.h +86 -0
  61. package/cpp/dawn/include/dawn/native/D3DBackend.h +56 -0
  62. package/cpp/dawn/include/dawn/native/DawnNative.h +369 -0
  63. package/cpp/dawn/include/dawn/native/MetalBackend.h +56 -0
  64. package/cpp/dawn/include/dawn/native/NullBackend.h +39 -0
  65. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +89 -0
  66. package/cpp/dawn/include/dawn/native/VulkanBackend.h +183 -0
  67. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +49 -0
  68. package/cpp/dawn/include/dawn/native/dawn_native_export.h +49 -0
  69. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +210 -0
  70. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +49 -0
  71. package/cpp/dawn/include/dawn/replay/Replay.h +99 -0
  72. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +49 -0
  73. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +2844 -0
  74. package/cpp/dawn/include/tint/tint.h +90 -0
  75. package/cpp/dawn/include/webgpu/webgpu.h +4987 -0
  76. package/cpp/dawn/include/webgpu/webgpu_cpp.h +10080 -0
  77. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +57 -0
  78. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +161 -0
  79. package/cpp/dawn/include/webgpu/webgpu_glfw.h +88 -0
  80. package/cpp/jsi/JSIConverter.h +0 -31
  81. package/cpp/jsi/NativeObject.h +11 -6
  82. package/cpp/rnskia/RNDawnContext.h +18 -2
  83. package/cpp/rnskia/RNDawnInterop.cpp +19 -0
  84. package/cpp/rnskia/RNDawnUtils.h +18 -1
  85. package/cpp/rnskia/RNSkManager.cpp +5 -162
  86. package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +2 -0
  87. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +45 -0
  88. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +360 -0
  89. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +105 -0
  90. package/lib/commonjs/mock/index.js +0 -1
  91. package/lib/commonjs/mock/index.js.map +1 -1
  92. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +15 -6
  93. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  94. package/lib/commonjs/skia/types/Skia.d.ts +5 -15
  95. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  96. package/lib/commonjs/skia/types/index.d.ts +0 -1
  97. package/lib/commonjs/skia/types/index.js +0 -11
  98. package/lib/commonjs/skia/types/index.js.map +1 -1
  99. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
  100. package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
  101. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  102. package/lib/commonjs/skia/web/JsiSkia.js +1 -4
  103. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  104. package/lib/commonjs/views/index.d.ts +0 -1
  105. package/lib/commonjs/views/index.js +0 -11
  106. package/lib/commonjs/views/index.js.map +1 -1
  107. package/lib/module/mock/index.js +0 -1
  108. package/lib/module/mock/index.js.map +1 -1
  109. package/lib/module/skia/types/Image/ImageFactory.d.ts +15 -6
  110. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  111. package/lib/module/skia/types/Skia.d.ts +5 -15
  112. package/lib/module/skia/types/Skia.js.map +1 -1
  113. package/lib/module/skia/types/index.d.ts +0 -1
  114. package/lib/module/skia/types/index.js +0 -1
  115. package/lib/module/skia/types/index.js.map +1 -1
  116. package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
  117. package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
  118. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  119. package/lib/module/skia/web/JsiSkia.js +1 -4
  120. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  121. package/lib/module/views/index.d.ts +0 -1
  122. package/lib/module/views/index.js +0 -1
  123. package/lib/module/views/index.js.map +1 -1
  124. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  125. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
  126. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -2
  127. package/lib/typescript/lib/module/mock/index.d.ts +0 -2
  128. package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -2
  129. package/lib/typescript/lib/module/skia/types/index.d.ts +0 -1
  130. package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
  131. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -2
  132. package/lib/typescript/lib/module/views/index.d.ts +0 -1
  133. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +15 -6
  134. package/lib/typescript/src/skia/types/Skia.d.ts +5 -15
  135. package/lib/typescript/src/skia/types/index.d.ts +0 -1
  136. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -2
  137. package/lib/typescript/src/views/index.d.ts +0 -1
  138. package/libs/.graphite +1 -0
  139. package/package.json +8 -9
  140. package/react-native-skia.podspec +38 -4
  141. package/src/mock/index.ts +0 -1
  142. package/src/skia/types/Image/ImageFactory.ts +15 -6
  143. package/src/skia/types/Skia.ts +5 -15
  144. package/src/skia/types/index.ts +0 -1
  145. package/src/skia/web/JsiSkImageFactory.ts +3 -3
  146. package/src/skia/web/JsiSkia.ts +2 -5
  147. package/src/views/index.ts +0 -1
  148. package/android/cpp/jni/JniWebGPUView.cpp +0 -112
  149. package/android/cpp/rnskia-android/SkiaPlatformContext.h +0 -26
  150. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +0 -43
  151. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +0 -50
  152. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +0 -98
  153. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +0 -19
  154. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +0 -58
  155. package/apple/RNWebGPUAppleNativeBuffer.mm +0 -33
  156. package/apple/SkiaPlatformContext.h +0 -20
  157. package/apple/SkiaPlatformContext.mm +0 -21
  158. package/apple/SkiaWebGPUView.mm +0 -81
  159. package/apple/WebGPUMetalView.mm +0 -136
  160. package/cpp/rnwgpu/ArrayBuffer.h +0 -116
  161. package/cpp/rnwgpu/Canvas.h +0 -52
  162. package/cpp/rnwgpu/PlatformContext.h +0 -18
  163. package/cpp/rnwgpu/SurfaceRegistry.h +0 -605
  164. package/cpp/rnwgpu/api/AppleNativeBuffer.h +0 -22
  165. package/cpp/rnwgpu/api/Convertors.h +0 -783
  166. package/cpp/rnwgpu/api/External.h +0 -12
  167. package/cpp/rnwgpu/api/GPU.cpp +0 -162
  168. package/cpp/rnwgpu/api/GPU.h +0 -60
  169. package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -239
  170. package/cpp/rnwgpu/api/GPUAdapter.h +0 -60
  171. package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
  172. package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
  173. package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
  174. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
  175. package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -107
  176. package/cpp/rnwgpu/api/GPUBuffer.h +0 -88
  177. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -75
  178. package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -70
  179. package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
  180. package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
  181. package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
  182. package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
  183. package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
  184. package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
  185. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
  186. package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
  187. package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
  188. package/cpp/rnwgpu/api/GPUDevice.cpp +0 -613
  189. package/cpp/rnwgpu/api/GPUDevice.h +0 -258
  190. package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
  191. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
  192. package/cpp/rnwgpu/api/GPUError.h +0 -35
  193. package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
  194. package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -139
  195. package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -95
  196. package/cpp/rnwgpu/api/GPUFeatures.h +0 -203
  197. package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
  198. package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
  199. package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
  200. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
  201. package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
  202. package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
  203. package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
  204. package/cpp/rnwgpu/api/GPUQueue.cpp +0 -179
  205. package/cpp/rnwgpu/api/GPUQueue.h +0 -84
  206. package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
  207. package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
  208. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
  209. package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
  210. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
  211. package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
  212. package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
  213. package/cpp/rnwgpu/api/GPUSampler.h +0 -44
  214. package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -56
  215. package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
  216. package/cpp/rnwgpu/api/GPUSharedFence.cpp +0 -80
  217. package/cpp/rnwgpu/api/GPUSharedFence.h +0 -53
  218. package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -135
  219. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -75
  220. package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
  221. package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
  222. package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
  223. package/cpp/rnwgpu/api/GPUTexture.h +0 -162
  224. package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
  225. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -60
  226. package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
  227. package/cpp/rnwgpu/api/ImageBitmap.h +0 -62
  228. package/cpp/rnwgpu/api/NativeBufferUtils.h +0 -87
  229. package/cpp/rnwgpu/api/RNWebGPU.h +0 -82
  230. package/cpp/rnwgpu/api/WebGPUConstants.h +0 -36
  231. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -64
  232. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -78
  233. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -56
  234. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -97
  235. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -57
  236. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -52
  237. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -56
  238. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -56
  239. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -59
  240. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
  241. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
  242. package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -66
  243. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -58
  244. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
  245. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -45
  246. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -45
  247. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -56
  248. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -58
  249. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -67
  250. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -56
  251. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -103
  252. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -109
  253. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -38
  254. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -90
  255. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -73
  256. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -62
  257. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
  258. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -65
  259. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -81
  260. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -54
  261. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
  262. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -54
  263. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -57
  264. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -69
  265. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -61
  266. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -55
  267. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -43
  268. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -45
  269. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -80
  270. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -81
  271. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -101
  272. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -92
  273. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -58
  274. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -103
  275. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -51
  276. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -45
  277. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -110
  278. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -60
  279. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -62
  280. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
  281. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +0 -58
  282. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +0 -51
  283. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -73
  284. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -64
  285. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -59
  286. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -59
  287. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -91
  288. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
  289. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -91
  290. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -64
  291. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -53
  292. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -62
  293. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -73
  294. package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1969
  295. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -213
  296. package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -58
  297. package/cpp/rnwgpu/async/RuntimeContext.cpp +0 -199
  298. package/cpp/rnwgpu/async/RuntimeContext.h +0 -134
  299. package/lib/commonjs/skia/types/WebGPU.d.ts +0 -184
  300. package/lib/commonjs/skia/types/WebGPU.js +0 -105
  301. package/lib/commonjs/skia/types/WebGPU.js.map +0 -1
  302. package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -8
  303. package/lib/commonjs/specs/WebGPUViewNativeComponent.js +0 -10
  304. package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +0 -1
  305. package/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
  306. package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +0 -103
  307. package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +0 -1
  308. package/lib/commonjs/specs/utils.d.ts +0 -1
  309. package/lib/commonjs/specs/utils.js +0 -11
  310. package/lib/commonjs/specs/utils.js.map +0 -1
  311. package/lib/commonjs/views/WebGPUCanvas.d.ts +0 -33
  312. package/lib/commonjs/views/WebGPUCanvas.js +0 -79
  313. package/lib/commonjs/views/WebGPUCanvas.js.map +0 -1
  314. package/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -23
  315. package/lib/commonjs/views/WebGPUCanvas.web.js +0 -20
  316. package/lib/commonjs/views/WebGPUCanvas.web.js.map +0 -1
  317. package/lib/module/skia/types/WebGPU.d.ts +0 -184
  318. package/lib/module/skia/types/WebGPU.js +0 -99
  319. package/lib/module/skia/types/WebGPU.js.map +0 -1
  320. package/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -8
  321. package/lib/module/specs/WebGPUViewNativeComponent.js +0 -4
  322. package/lib/module/specs/WebGPUViewNativeComponent.js.map +0 -1
  323. package/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
  324. package/lib/module/specs/WebGPUViewNativeComponent.web.js +0 -96
  325. package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +0 -1
  326. package/lib/module/specs/utils.d.ts +0 -1
  327. package/lib/module/specs/utils.js +0 -5
  328. package/lib/module/specs/utils.js.map +0 -1
  329. package/lib/module/views/WebGPUCanvas.d.ts +0 -33
  330. package/lib/module/views/WebGPUCanvas.js +0 -70
  331. package/lib/module/views/WebGPUCanvas.js.map +0 -1
  332. package/lib/module/views/WebGPUCanvas.web.d.ts +0 -23
  333. package/lib/module/views/WebGPUCanvas.web.js +0 -12
  334. package/lib/module/views/WebGPUCanvas.web.js.map +0 -1
  335. package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +0 -2
  336. package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -4
  337. package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -3
  338. package/lib/typescript/lib/commonjs/specs/utils.d.ts +0 -2
  339. package/lib/typescript/lib/commonjs/views/WebGPUCanvas.d.ts +0 -6
  340. package/lib/typescript/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -6
  341. package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +0 -31
  342. package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -2
  343. package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -2
  344. package/lib/typescript/lib/module/specs/utils.d.ts +0 -1
  345. package/lib/typescript/lib/module/views/WebGPUCanvas.d.ts +0 -7
  346. package/lib/typescript/lib/module/views/WebGPUCanvas.web.d.ts +0 -8
  347. package/lib/typescript/src/skia/types/WebGPU.d.ts +0 -184
  348. package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +0 -8
  349. package/lib/typescript/src/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
  350. package/lib/typescript/src/specs/utils.d.ts +0 -1
  351. package/lib/typescript/src/views/WebGPUCanvas.d.ts +0 -33
  352. package/lib/typescript/src/views/WebGPUCanvas.web.d.ts +0 -23
  353. package/src/skia/types/WebGPU.ts +0 -226
  354. package/src/specs/WebGPUViewNativeComponent.ts +0 -11
  355. package/src/specs/WebGPUViewNativeComponent.web.ts +0 -110
  356. package/src/specs/utils.ts +0 -4
  357. package/src/views/WebGPUCanvas.tsx +0 -125
  358. package/src/views/WebGPUCanvas.web.tsx +0 -36
@@ -2,13 +2,16 @@
2
2
 
3
3
  #include <algorithm>
4
4
  #include <memory>
5
+ #include <optional>
5
6
  #include <set>
6
7
  #include <string>
7
8
  #include <utility>
9
+ #include <variant>
8
10
  #include <vector>
9
11
 
10
12
  #include <jsi/jsi.h>
11
13
 
14
+ #include "JsiSkConverters.h"
12
15
  #include "JsiSkMatrix.h"
13
16
  #include "JsiSkNativeObjects.h"
14
17
  #include "JsiSkPoint.h"
@@ -77,338 +80,233 @@ private:
77
80
  SkPath asPath() const { return getObject()->snapshot(); }
78
81
 
79
82
  public:
80
- // Mutable building methods (deprecated)
83
+ // Mutable building methods (deprecated) — chainable, and they take the
84
+ // runtime for the JS console deprecation warning.
81
85
 
82
- JSI_HOST_FUNCTION(moveTo) {
86
+ void moveTo(jsi::Runtime &runtime, double x, double y) {
83
87
  warnDeprecatedPathMethod(runtime, "moveTo",
84
88
  "Use Skia.PathBuilder.Make().moveTo() instead.");
85
- SkScalar x = arguments[0].asNumber();
86
- SkScalar y = arguments[1].asNumber();
87
89
  getObject()->moveTo(x, y);
88
- return thisValue.getObject(runtime);
89
90
  }
90
91
 
91
- JSI_HOST_FUNCTION(rMoveTo) {
92
+ void rMoveTo(jsi::Runtime &runtime, double x, double y) {
92
93
  warnDeprecatedPathMethod(runtime, "rMoveTo",
93
94
  "Use Skia.PathBuilder.Make().rMoveTo() instead.");
94
- SkScalar x = arguments[0].asNumber();
95
- SkScalar y = arguments[1].asNumber();
96
- getObject()->rMoveTo({x, y});
97
- return thisValue.getObject(runtime);
95
+ getObject()->rMoveTo({static_cast<SkScalar>(x), static_cast<SkScalar>(y)});
98
96
  }
99
97
 
100
- JSI_HOST_FUNCTION(lineTo) {
98
+ void lineTo(jsi::Runtime &runtime, double x, double y) {
101
99
  warnDeprecatedPathMethod(runtime, "lineTo",
102
100
  "Use Skia.PathBuilder.Make().lineTo() instead.");
103
- SkScalar x = arguments[0].asNumber();
104
- SkScalar y = arguments[1].asNumber();
105
101
  getObject()->lineTo(x, y);
106
- return thisValue.getObject(runtime);
107
102
  }
108
103
 
109
- JSI_HOST_FUNCTION(rLineTo) {
104
+ void rLineTo(jsi::Runtime &runtime, double x, double y) {
110
105
  warnDeprecatedPathMethod(runtime, "rLineTo",
111
106
  "Use Skia.PathBuilder.Make().rLineTo() instead.");
112
- SkScalar x = arguments[0].asNumber();
113
- SkScalar y = arguments[1].asNumber();
114
107
  getObject()->rLineTo(x, y);
115
- return thisValue.getObject(runtime);
116
108
  }
117
109
 
118
- JSI_HOST_FUNCTION(quadTo) {
110
+ void quadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
111
+ double y2) {
119
112
  warnDeprecatedPathMethod(runtime, "quadTo",
120
113
  "Use Skia.PathBuilder.Make().quadTo() instead.");
121
- SkScalar x1 = arguments[0].asNumber();
122
- SkScalar y1 = arguments[1].asNumber();
123
- SkScalar x2 = arguments[2].asNumber();
124
- SkScalar y2 = arguments[3].asNumber();
125
114
  getObject()->quadTo(x1, y1, x2, y2);
126
- return thisValue.getObject(runtime);
127
115
  }
128
116
 
129
- JSI_HOST_FUNCTION(rQuadTo) {
117
+ void rQuadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
118
+ double y2) {
130
119
  warnDeprecatedPathMethod(runtime, "rQuadTo",
131
120
  "Use Skia.PathBuilder.Make().rQuadTo() instead.");
132
- SkScalar x1 = arguments[0].asNumber();
133
- SkScalar y1 = arguments[1].asNumber();
134
- SkScalar x2 = arguments[2].asNumber();
135
- SkScalar y2 = arguments[3].asNumber();
136
121
  getObject()->rQuadTo(x1, y1, x2, y2);
137
- return thisValue.getObject(runtime);
138
122
  }
139
123
 
140
- JSI_HOST_FUNCTION(conicTo) {
124
+ void conicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
125
+ double y2, double w) {
141
126
  warnDeprecatedPathMethod(runtime, "conicTo",
142
127
  "Use Skia.PathBuilder.Make().conicTo() instead.");
143
- SkScalar x1 = arguments[0].asNumber();
144
- SkScalar y1 = arguments[1].asNumber();
145
- SkScalar x2 = arguments[2].asNumber();
146
- SkScalar y2 = arguments[3].asNumber();
147
- SkScalar w = arguments[4].asNumber();
148
128
  getObject()->conicTo(x1, y1, x2, y2, w);
149
- return thisValue.getObject(runtime);
150
129
  }
151
130
 
152
- JSI_HOST_FUNCTION(rConicTo) {
131
+ void rConicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
132
+ double y2, double w) {
153
133
  warnDeprecatedPathMethod(runtime, "rConicTo",
154
134
  "Use Skia.PathBuilder.Make().rConicTo() instead.");
155
- SkScalar x1 = arguments[0].asNumber();
156
- SkScalar y1 = arguments[1].asNumber();
157
- SkScalar x2 = arguments[2].asNumber();
158
- SkScalar y2 = arguments[3].asNumber();
159
- SkScalar w = arguments[4].asNumber();
160
135
  getObject()->rConicTo(x1, y1, x2, y2, w);
161
- return thisValue.getObject(runtime);
162
136
  }
163
137
 
164
- JSI_HOST_FUNCTION(cubicTo) {
138
+ void cubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
139
+ double y2, double x3, double y3) {
165
140
  warnDeprecatedPathMethod(runtime, "cubicTo",
166
141
  "Use Skia.PathBuilder.Make().cubicTo() instead.");
167
- SkScalar x1 = arguments[0].asNumber();
168
- SkScalar y1 = arguments[1].asNumber();
169
- SkScalar x2 = arguments[2].asNumber();
170
- SkScalar y2 = arguments[3].asNumber();
171
- SkScalar x3 = arguments[4].asNumber();
172
- SkScalar y3 = arguments[5].asNumber();
173
142
  getObject()->cubicTo(x1, y1, x2, y2, x3, y3);
174
- return thisValue.getObject(runtime);
175
143
  }
176
144
 
177
- JSI_HOST_FUNCTION(rCubicTo) {
145
+ void rCubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
146
+ double y2, double x3, double y3) {
178
147
  warnDeprecatedPathMethod(runtime, "rCubicTo",
179
148
  "Use Skia.PathBuilder.Make().rCubicTo() instead.");
180
- SkScalar x1 = arguments[0].asNumber();
181
- SkScalar y1 = arguments[1].asNumber();
182
- SkScalar x2 = arguments[2].asNumber();
183
- SkScalar y2 = arguments[3].asNumber();
184
- SkScalar x3 = arguments[4].asNumber();
185
- SkScalar y3 = arguments[5].asNumber();
186
149
  getObject()->rCubicTo(x1, y1, x2, y2, x3, y3);
187
- return thisValue.getObject(runtime);
188
150
  }
189
151
 
190
- JSI_HOST_FUNCTION(close) {
152
+ void close(jsi::Runtime &runtime) {
191
153
  warnDeprecatedPathMethod(runtime, "close",
192
154
  "Use Skia.PathBuilder.Make().close() instead.");
193
155
  getObject()->close();
194
- return thisValue.getObject(runtime);
195
156
  }
196
157
 
197
- JSI_HOST_FUNCTION(reset) {
158
+ void reset(jsi::Runtime &runtime) {
198
159
  warnDeprecatedPathMethod(runtime, "reset",
199
160
  "Use Skia.PathBuilder.Make().reset() instead.");
200
161
  getObject()->reset();
201
- return thisValue.getObject(runtime);
202
162
  }
203
163
 
204
- JSI_HOST_FUNCTION(rewind) {
164
+ void rewind(jsi::Runtime &runtime) {
205
165
  warnDeprecatedPathMethod(runtime, "rewind",
206
166
  "Use Skia.PathBuilder.Make().reset() instead.");
207
167
  getObject()->reset();
208
- return thisValue.getObject(runtime);
209
168
  }
210
169
 
211
- JSI_HOST_FUNCTION(addPath) {
170
+ void addPath(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> src,
171
+ JsiOptional<std::shared_ptr<SkMatrix>> matrix,
172
+ JsiOptional<bool> extend) {
212
173
  warnDeprecatedPathMethod(runtime, "addPath",
213
174
  "Use Skia.PathBuilder.Make().addPath() instead.");
214
- auto src = JsiSkPath::fromValue(runtime, arguments[0]);
215
175
  auto srcPath = src->snapshot();
216
- auto matrix =
217
- count > 1 && !arguments[1].isUndefined() && !arguments[1].isNull()
218
- ? JsiSkMatrix::fromValue(runtime, arguments[1])
219
- : nullptr;
220
- auto extend = count > 2 && arguments[2].getBool();
221
- auto mode =
222
- extend ? SkPath::kExtend_AddPathMode : SkPath::kAppend_AddPathMode;
223
- if (matrix) {
224
- getObject()->addPath(srcPath, *matrix, mode);
176
+ auto mode = extend.has_value() && *extend ? SkPath::kExtend_AddPathMode
177
+ : SkPath::kAppend_AddPathMode;
178
+ if (matrix.has_value()) {
179
+ getObject()->addPath(srcPath, **matrix, mode);
225
180
  } else {
226
181
  getObject()->addPath(srcPath, mode);
227
182
  }
228
- return thisValue.getObject(runtime);
229
183
  }
230
184
 
231
- JSI_HOST_FUNCTION(addArc) {
185
+ void addArc(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
186
+ double start, double sweep) {
232
187
  warnDeprecatedPathMethod(runtime, "addArc",
233
188
  "Use Skia.PathBuilder.Make().addArc() instead.");
234
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
235
- auto start = arguments[1].asNumber();
236
- auto sweep = arguments[2].asNumber();
237
189
  getObject()->addArc(*rect, start, sweep);
238
- return thisValue.getObject(runtime);
239
190
  }
240
191
 
241
- JSI_HOST_FUNCTION(addOval) {
192
+ void addOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
193
+ JsiOptional<bool> isCCW, JsiOptional<double> startIndex) {
242
194
  warnDeprecatedPathMethod(
243
195
  runtime, "addOval",
244
196
  "Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead.");
245
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
246
- auto isCCW = count > 1 && arguments[1].getBool();
247
- auto startIndex =
248
- count > 2 ? static_cast<unsigned>(arguments[2].asNumber()) : 1;
249
- auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
250
- getObject()->addOval(*rect, direction, startIndex);
251
- return thisValue.getObject(runtime);
197
+ getObject()->addOval(*rect, toDirection(isCCW),
198
+ startIndex.has_value()
199
+ ? static_cast<unsigned>(*startIndex)
200
+ : 1);
252
201
  }
253
202
 
254
- JSI_HOST_FUNCTION(addRect) {
203
+ void addRect(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
204
+ JsiOptional<bool> isCCW) {
255
205
  warnDeprecatedPathMethod(
256
206
  runtime, "addRect",
257
207
  "Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead.");
258
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
259
- auto isCCW = count > 1 && arguments[1].getBool();
260
- auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
261
- getObject()->addRect(*rect, direction);
262
- return thisValue.getObject(runtime);
208
+ getObject()->addRect(*rect, toDirection(isCCW));
263
209
  }
264
210
 
265
- JSI_HOST_FUNCTION(addRRect) {
211
+ void addRRect(jsi::Runtime &runtime, std::shared_ptr<SkRRect> rrect,
212
+ JsiOptional<bool> isCCW) {
266
213
  warnDeprecatedPathMethod(
267
214
  runtime, "addRRect",
268
215
  "Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead.");
269
- auto rrect = JsiSkRRect::fromValue(runtime, arguments[0]);
270
- auto isCCW = count > 1 && arguments[1].getBool();
271
- auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
272
- getObject()->addRRect(*rrect, direction);
273
- return thisValue.getObject(runtime);
216
+ getObject()->addRRect(*rrect, toDirection(isCCW));
274
217
  }
275
218
 
276
- JSI_HOST_FUNCTION(addCircle) {
219
+ void addCircle(jsi::Runtime &runtime, double x, double y, double r) {
277
220
  warnDeprecatedPathMethod(
278
221
  runtime, "addCircle",
279
222
  "Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() "
280
223
  "instead.");
281
- SkScalar x = arguments[0].asNumber();
282
- SkScalar y = arguments[1].asNumber();
283
- SkScalar r = arguments[2].asNumber();
284
224
  getObject()->addCircle(x, y, r);
285
- return thisValue.getObject(runtime);
286
225
  }
287
226
 
288
- JSI_HOST_FUNCTION(addPoly) {
227
+ void addPoly(jsi::Runtime &runtime, std::vector<SkPoint> points,
228
+ bool close) {
289
229
  warnDeprecatedPathMethod(
290
230
  runtime, "addPoly",
291
231
  "Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() "
292
232
  "instead.");
293
- auto jsiPoints = arguments[0].asObject(runtime).asArray(runtime);
294
- auto close = arguments[1].getBool();
295
- auto pointsSize = static_cast<int>(jsiPoints.size(runtime));
296
- std::vector<SkPoint> points;
297
- points.reserve(pointsSize);
298
- for (int i = 0; i < pointsSize; i++) {
299
- auto pt =
300
- JsiSkPoint::fromValue(runtime, jsiPoints.getValueAtIndex(runtime, i));
301
- points.push_back(*pt);
302
- }
303
233
  getObject()->addPolygon(SkSpan<const SkPoint>(points.data(), points.size()),
304
234
  close);
305
- return thisValue.getObject(runtime);
306
235
  }
307
236
 
308
- JSI_HOST_FUNCTION(arcToOval) {
237
+ void arcToOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
238
+ double start, double sweep, bool forceMoveTo) {
309
239
  warnDeprecatedPathMethod(
310
240
  runtime, "arcToOval",
311
241
  "Use Skia.PathBuilder.Make().arcToOval() instead.");
312
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
313
- auto start = arguments[1].asNumber();
314
- auto sweep = arguments[2].asNumber();
315
- auto forceMoveTo = arguments[3].getBool();
316
242
  getObject()->arcTo(*rect, start, sweep, forceMoveTo);
317
- return thisValue.getObject(runtime);
318
243
  }
319
244
 
320
- JSI_HOST_FUNCTION(arcToRotated) {
245
+ void arcToRotated(jsi::Runtime &runtime, double rx, double ry,
246
+ double xAxisRotate, bool useSmallArc, bool isCCW, double x,
247
+ double y) {
321
248
  warnDeprecatedPathMethod(
322
249
  runtime, "arcToRotated",
323
250
  "Use Skia.PathBuilder.Make().arcToRotated() instead.");
324
- SkScalar rx = arguments[0].asNumber();
325
- SkScalar ry = arguments[1].asNumber();
326
- SkScalar xAxisRotate = arguments[2].asNumber();
327
- auto useSmallArc = arguments[3].getBool();
328
- auto isCCW = arguments[4].getBool();
329
- SkScalar x = arguments[5].asNumber();
330
- SkScalar y = arguments[6].asNumber();
331
251
  auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
332
252
  : SkPathBuilder::kLarge_ArcSize;
333
253
  auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
334
254
  getObject()->arcTo(SkPoint::Make(rx, ry), xAxisRotate, arcSize, sweep,
335
255
  SkPoint::Make(x, y));
336
- return thisValue.getObject(runtime);
337
256
  }
338
257
 
339
- JSI_HOST_FUNCTION(rArcTo) {
258
+ void rArcTo(jsi::Runtime &runtime, double rx, double ry, double xAxisRotate,
259
+ bool useSmallArc, bool isCCW, double dx, double dy) {
340
260
  warnDeprecatedPathMethod(runtime, "rArcTo",
341
261
  "Use Skia.PathBuilder.Make().rArcTo() instead.");
342
- SkScalar rx = arguments[0].asNumber();
343
- SkScalar ry = arguments[1].asNumber();
344
- SkScalar xAxisRotate = arguments[2].asNumber();
345
- auto useSmallArc = arguments[3].getBool();
346
- auto isCCW = arguments[4].getBool();
347
- SkScalar dx = arguments[5].asNumber();
348
- SkScalar dy = arguments[6].asNumber();
349
262
  auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
350
263
  : SkPathBuilder::kLarge_ArcSize;
351
264
  auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
352
265
  SkVector dxdy(dx, dy);
353
266
  SkPoint r(rx, ry);
354
267
  getObject()->rArcTo(r, xAxisRotate, arcSize, sweep, dxdy);
355
- return thisValue.getObject(runtime);
356
268
  }
357
269
 
358
- JSI_HOST_FUNCTION(arcToTangent) {
270
+ void arcToTangent(jsi::Runtime &runtime, double x1, double y1, double x2,
271
+ double y2, double r) {
359
272
  warnDeprecatedPathMethod(
360
273
  runtime, "arcToTangent",
361
274
  "Use Skia.PathBuilder.Make().arcToTangent() instead.");
362
- SkScalar x1 = arguments[0].asNumber();
363
- SkScalar y1 = arguments[1].asNumber();
364
- SkScalar x2 = arguments[2].asNumber();
365
- SkScalar y2 = arguments[3].asNumber();
366
- SkScalar r = arguments[4].asNumber();
367
275
  getObject()->arcTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2), r);
368
- return thisValue.getObject(runtime);
369
276
  }
370
277
 
371
- JSI_HOST_FUNCTION(setFillType) {
278
+ void setFillType(jsi::Runtime &runtime, double ft) {
372
279
  warnDeprecatedPathMethod(
373
280
  runtime, "setFillType",
374
281
  "Use Skia.PathBuilder.Make().setFillType() instead.");
375
- auto ft = arguments[0].asNumber();
376
282
  getObject()->setFillType(static_cast<SkPathFillType>(static_cast<int>(ft)));
377
- return thisValue.getObject(runtime);
378
283
  }
379
284
 
380
- JSI_HOST_FUNCTION(setIsVolatile) {
285
+ void setIsVolatile(jsi::Runtime &runtime, bool v) {
381
286
  warnDeprecatedPathMethod(
382
287
  runtime, "setIsVolatile",
383
288
  "Use Skia.PathBuilder.Make().setIsVolatile() instead.");
384
- auto v = arguments[0].getBool();
385
289
  getObject()->setIsVolatile(v);
386
- return thisValue.getObject(runtime);
387
290
  }
388
291
 
389
292
  // Mutable transform methods (deprecated)
390
293
 
391
- JSI_HOST_FUNCTION(transform) {
294
+ void transform(jsi::Runtime &runtime, std::shared_ptr<SkMatrix> m3) {
392
295
  warnDeprecatedPathMethod(
393
296
  runtime, "transform",
394
297
  "Use Skia.PathBuilder.Make().transform() instead.");
395
- auto m3 = *JsiSkMatrix::fromValue(runtime, arguments[0]);
396
- getObject()->transform(m3);
397
- return thisValue.getObject(runtime);
298
+ getObject()->transform(*m3);
398
299
  }
399
300
 
400
- JSI_HOST_FUNCTION(offset) {
301
+ void offset(jsi::Runtime &runtime, double dx, double dy) {
401
302
  warnDeprecatedPathMethod(runtime, "offset",
402
303
  "Use Skia.PathBuilder.Make().offset() instead.");
403
- SkScalar dx = arguments[0].asNumber();
404
- SkScalar dy = arguments[1].asNumber();
405
304
  getObject()->offset(dx, dy);
406
- return thisValue.getObject(runtime);
407
305
  }
408
306
 
409
307
  // Mutable path operations (deprecated)
410
308
 
411
- JSI_HOST_FUNCTION(simplify) {
309
+ void simplify(jsi::Runtime &runtime) {
412
310
  warnDeprecatedPathMethod(runtime, "simplify",
413
311
  "Use Skia.Path.Simplify(path) instead.");
414
312
  auto path = asPath();
@@ -416,25 +314,22 @@ public:
416
314
  if (result.has_value()) {
417
315
  *getObject() = SkPathBuilder(result.value());
418
316
  }
419
- return thisValue.getObject(runtime);
420
317
  }
421
318
 
422
- JSI_HOST_FUNCTION(op) {
319
+ void op(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> path2,
320
+ double pathOp) {
423
321
  warnDeprecatedPathMethod(runtime, "op",
424
322
  "Use Skia.Path.MakeFromOp() instead.");
425
- auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
426
- auto pathOp =
427
- static_cast<SkPathOp>(static_cast<int>(arguments[1].asNumber()));
428
323
  auto p1 = asPath();
429
324
  auto p2 = path2->snapshot();
430
- auto result = ::Op(p1, p2, pathOp);
325
+ auto result =
326
+ ::Op(p1, p2, static_cast<SkPathOp>(static_cast<int>(pathOp)));
431
327
  if (result.has_value()) {
432
328
  *getObject() = SkPathBuilder(result.value());
433
329
  }
434
- return thisValue.getObject(runtime);
435
330
  }
436
331
 
437
- JSI_HOST_FUNCTION(makeAsWinding) {
332
+ void makeAsWinding(jsi::Runtime &runtime) {
438
333
  warnDeprecatedPathMethod(runtime, "makeAsWinding",
439
334
  "Use Skia.Path.AsWinding(path) instead.");
440
335
  auto path = asPath();
@@ -442,17 +337,14 @@ public:
442
337
  if (result.has_value()) {
443
338
  *getObject() = SkPathBuilder(result.value());
444
339
  }
445
- return thisValue.getObject(runtime);
446
340
  }
447
341
 
448
- JSI_HOST_FUNCTION(dash) {
342
+ void dash(jsi::Runtime &runtime, double on, double off, double phase) {
449
343
  warnDeprecatedPathMethod(
450
344
  runtime, "dash", "Use Skia.Path.Dash(path, on, off, phase) instead.");
451
345
  auto path = asPath();
452
- SkScalar on = arguments[0].asNumber();
453
- SkScalar off = arguments[1].asNumber();
454
- auto phase = arguments[2].asNumber();
455
- SkScalar intervals[] = {on, off};
346
+ SkScalar intervals[] = {static_cast<SkScalar>(on),
347
+ static_cast<SkScalar>(off)};
456
348
  auto pe = SkDashPathEffect::Make(SkSpan(intervals, 2), phase);
457
349
  if (pe) {
458
350
  SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
@@ -461,9 +353,9 @@ public:
461
353
  *getObject() = std::move(resultBuilder);
462
354
  }
463
355
  }
464
- return thisValue.getObject(runtime);
465
356
  }
466
357
 
358
+ // Stays raw: the options object is read leniently property by property.
467
359
  JSI_HOST_FUNCTION(stroke) {
468
360
  warnDeprecatedPathMethod(runtime, "stroke",
469
361
  "Use Skia.Path.Stroke(path, opts) instead.");
@@ -505,16 +397,14 @@ public:
505
397
  return thisValue.getObject(runtime);
506
398
  }
507
399
 
508
- JSI_HOST_FUNCTION(trim) {
400
+ void trim(jsi::Runtime &runtime, double startValue, double endValue,
401
+ bool isComplement) {
509
402
  warnDeprecatedPathMethod(
510
403
  runtime, "trim",
511
404
  "Use Skia.Path.Trim(path, start, end, isComplement) instead.");
512
405
  auto path = asPath();
513
- float start =
514
- std::clamp(static_cast<float>(arguments[0].asNumber()), 0.0f, 1.0f);
515
- float end =
516
- std::clamp(static_cast<float>(arguments[1].asNumber()), 0.0f, 1.0f);
517
- auto isComplement = arguments[2].getBool();
406
+ float start = std::clamp(static_cast<float>(startValue), 0.0f, 1.0f);
407
+ float end = std::clamp(static_cast<float>(endValue), 0.0f, 1.0f);
518
408
  auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted
519
409
  : SkTrimPathEffect::Mode::kNormal;
520
410
  auto pe = SkTrimPathEffect::Make(start, end, mode);
@@ -525,106 +415,77 @@ public:
525
415
  *getObject() = std::move(resultBuilder);
526
416
  }
527
417
  }
528
- return thisValue.getObject(runtime);
529
418
  }
530
419
 
531
420
  // Query methods
532
421
 
533
- JSI_HOST_FUNCTION(computeTightBounds) {
422
+ std::shared_ptr<JsiSkRect> computeTightBounds() {
534
423
  auto path = asPath();
535
- auto result = path.computeTightBounds();
536
- return makeJsiObject(runtime,
537
- std::make_shared<JsiSkRect>(getContext(), result));
424
+ return std::make_shared<JsiSkRect>(getContext(),
425
+ path.computeTightBounds());
538
426
  }
539
427
 
540
- JSI_HOST_FUNCTION(getBounds) {
541
- auto result = getObject()->computeBounds();
542
- return makeJsiObject(runtime,
543
- std::make_shared<JsiSkRect>(getContext(), result));
428
+ std::shared_ptr<JsiSkRect> getBounds() {
429
+ return std::make_shared<JsiSkRect>(getContext(),
430
+ getObject()->computeBounds());
544
431
  }
545
432
 
546
- JSI_HOST_FUNCTION(contains) {
547
- auto x = arguments[0].asNumber();
548
- auto y = arguments[1].asNumber();
549
- return jsi::Value(asPath().contains(x, y));
550
- }
433
+ bool contains(double x, double y) { return asPath().contains(x, y); }
551
434
 
552
- JSI_HOST_FUNCTION(getFillType) {
553
- auto fillType = getObject()->fillType();
554
- return jsi::Value(static_cast<int>(fillType));
555
- }
435
+ int getFillType() { return static_cast<int>(getObject()->fillType()); }
556
436
 
557
- JSI_HOST_FUNCTION(isVolatile) { return jsi::Value(asPath().isVolatile()); }
437
+ bool isVolatile() { return asPath().isVolatile(); }
558
438
 
559
- JSI_HOST_FUNCTION(getPoint) {
560
- auto index = arguments[0].asNumber();
439
+ std::shared_ptr<JsiSkPoint> getPoint(int index) {
561
440
  auto point = asPath().getPoint(index);
562
- return makeJsiObject(runtime,
563
- std::make_shared<JsiSkPoint>(getContext(), point));
441
+ return std::make_shared<JsiSkPoint>(getContext(), point);
564
442
  }
565
443
 
566
- JSI_HOST_FUNCTION(isEmpty) { return jsi::Value(getObject()->isEmpty()); }
444
+ bool isEmpty() { return getObject()->isEmpty(); }
567
445
 
568
- JSI_HOST_FUNCTION(countPoints) {
569
- auto points = asPath().countPoints();
570
- return jsi::Value(points);
571
- }
446
+ int countPoints() { return asPath().countPoints(); }
572
447
 
573
- JSI_HOST_FUNCTION(getLastPt) {
448
+ SkPoint getLastPt() {
574
449
  auto last = getObject()->getLastPt();
575
- auto point = jsi::Object(runtime);
576
- if (last.has_value()) {
577
- point.setProperty(runtime, "x", static_cast<double>(last->fX));
578
- point.setProperty(runtime, "y", static_cast<double>(last->fY));
579
- } else {
580
- point.setProperty(runtime, "x", 0.0);
581
- point.setProperty(runtime, "y", 0.0);
582
- }
583
- return point;
450
+ return last.value_or(SkPoint::Make(0, 0));
584
451
  }
585
452
 
586
- JSI_HOST_FUNCTION(toSVGString) {
453
+ std::string toSVGString() {
587
454
  auto path = asPath();
588
455
  auto s = SkParsePath::ToSVGString(path);
589
- return jsi::String::createFromUtf8(runtime, s.c_str());
456
+ return std::string(s.c_str());
590
457
  }
591
458
 
592
- JSI_HOST_FUNCTION(equals) {
593
- auto p1 = JsiSkPath::fromValue(runtime, arguments[0]);
594
- auto p2 = JsiSkPath::fromValue(runtime, arguments[1]);
595
- return jsi::Value(p1->snapshot() == p2->snapshot());
459
+ bool equals(std::shared_ptr<SkPathBuilder> p1,
460
+ std::shared_ptr<SkPathBuilder> p2) {
461
+ return p1->snapshot() == p2->snapshot();
596
462
  }
597
463
 
598
- JSI_HOST_FUNCTION(copy) {
599
- auto path = asPath();
600
- return makeJsiObject(runtime,
601
- std::make_shared<JsiSkPath>(getContext(), path));
464
+ std::shared_ptr<JsiSkPath> copy() {
465
+ return std::make_shared<JsiSkPath>(getContext(), asPath());
602
466
  }
603
467
 
604
- JSI_HOST_FUNCTION(isInterpolatable) {
605
- auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
468
+ bool isInterpolatable(std::shared_ptr<SkPathBuilder> path2) {
606
469
  auto p1 = asPath();
607
470
  auto p2 = path2->snapshot();
608
471
  return p1.isInterpolatable(p2);
609
472
  }
610
473
 
611
- JSI_HOST_FUNCTION(interpolate) {
612
- auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
613
- auto weight = arguments[1].asNumber();
474
+ std::variant<std::nullptr_t, std::shared_ptr<JsiSkPath>>
475
+ interpolate(std::shared_ptr<SkPathBuilder> path2, double weight) {
614
476
  auto p1 = asPath();
615
477
  auto p2 = path2->snapshot();
616
478
  SkPath result;
617
479
  auto succeed = p1.interpolate(p2, weight, &result);
618
480
  if (!succeed) {
619
- return jsi::Value::null();
481
+ return nullptr;
620
482
  }
621
- return makeJsiObject(
622
- runtime, std::make_shared<JsiSkPath>(getContext(), std::move(result)));
483
+ return std::make_shared<JsiSkPath>(getContext(), std::move(result));
623
484
  }
624
485
 
625
- JSI_HOST_FUNCTION(toCmds) {
486
+ std::vector<std::vector<double>> toCmds() {
626
487
  auto path = asPath();
627
- std::vector<jsi::Array> cmdList;
488
+ std::vector<std::vector<double>> cmds;
628
489
  SkPoint pts[4];
629
490
  SkPath::Iter iter(path, false);
630
491
  SkPath::Verb verb;
@@ -632,141 +493,141 @@ public:
632
493
  while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
633
494
  switch (verb) {
634
495
  case SkPath::kMove_Verb: {
635
- auto cmd = jsi::Array(runtime, 3);
636
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(MOVE));
637
- cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[0].x()));
638
- cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[0].y()));
639
- cmdList.push_back(std::move(cmd));
496
+ cmds.push_back({static_cast<double>(MOVE),
497
+ static_cast<double>(pts[0].x()),
498
+ static_cast<double>(pts[0].y())});
640
499
  break;
641
500
  }
642
501
  case SkPath::kLine_Verb: {
643
- auto cmd = jsi::Array(runtime, 3);
644
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(LINE));
645
- cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
646
- cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
647
- cmdList.push_back(std::move(cmd));
502
+ cmds.push_back({static_cast<double>(LINE),
503
+ static_cast<double>(pts[1].x()),
504
+ static_cast<double>(pts[1].y())});
648
505
  break;
649
506
  }
650
507
  case SkPath::kQuad_Verb: {
651
- auto cmd = jsi::Array(runtime, 5);
652
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(QUAD));
653
- cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
654
- cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
655
- cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
656
- cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
657
- cmdList.push_back(std::move(cmd));
508
+ cmds.push_back(
509
+ {static_cast<double>(QUAD), static_cast<double>(pts[1].x()),
510
+ static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
511
+ static_cast<double>(pts[2].y())});
658
512
  break;
659
513
  }
660
514
  case SkPath::kConic_Verb: {
661
- auto cmd = jsi::Array(runtime, 6);
662
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(CONIC));
663
- cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
664
- cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
665
- cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
666
- cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
667
- cmd.setValueAtIndex(runtime, 5,
668
- static_cast<double>(iter.conicWeight()));
669
- cmdList.push_back(std::move(cmd));
515
+ cmds.push_back(
516
+ {static_cast<double>(CONIC), static_cast<double>(pts[1].x()),
517
+ static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
518
+ static_cast<double>(pts[2].y()),
519
+ static_cast<double>(iter.conicWeight())});
670
520
  break;
671
521
  }
672
522
  case SkPath::kCubic_Verb: {
673
- auto cmd = jsi::Array(runtime, 7);
674
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(CUBIC));
675
- cmd.setValueAtIndex(runtime, 1, static_cast<double>(pts[1].x()));
676
- cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
677
- cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
678
- cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
679
- cmd.setValueAtIndex(runtime, 5, static_cast<double>(pts[3].x()));
680
- cmd.setValueAtIndex(runtime, 6, static_cast<double>(pts[3].y()));
681
- cmdList.push_back(std::move(cmd));
523
+ cmds.push_back(
524
+ {static_cast<double>(CUBIC), static_cast<double>(pts[1].x()),
525
+ static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
526
+ static_cast<double>(pts[2].y()), static_cast<double>(pts[3].x()),
527
+ static_cast<double>(pts[3].y())});
682
528
  break;
683
529
  }
684
530
  case SkPath::kClose_Verb: {
685
- auto cmd = jsi::Array(runtime, 1);
686
- cmd.setValueAtIndex(runtime, 0, static_cast<double>(CLOSE));
687
- cmdList.push_back(std::move(cmd));
531
+ cmds.push_back({static_cast<double>(CLOSE)});
688
532
  break;
689
533
  }
690
534
  default:
691
535
  break;
692
536
  }
693
537
  }
694
-
695
- // Create the jsi::Array with the exact size
696
- auto cmds = jsi::Array(runtime, cmdList.size());
697
- for (size_t i = 0; i < cmdList.size(); ++i) {
698
- cmds.setValueAtIndex(runtime, i, cmdList[i]);
699
- }
700
-
701
538
  return cmds;
702
539
  }
703
540
 
704
541
  static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
705
542
  installCommon(runtime, prototype);
706
543
  // Mutable building methods
707
- installHostMethod(runtime, prototype, "moveTo", &JsiSkPath::moveTo);
708
- installHostMethod(runtime, prototype, "rMoveTo", &JsiSkPath::rMoveTo);
709
- installHostMethod(runtime, prototype, "lineTo", &JsiSkPath::lineTo);
710
- installHostMethod(runtime, prototype, "rLineTo", &JsiSkPath::rLineTo);
711
- installHostMethod(runtime, prototype, "quadTo", &JsiSkPath::quadTo);
712
- installHostMethod(runtime, prototype, "rQuadTo", &JsiSkPath::rQuadTo);
713
- installHostMethod(runtime, prototype, "conicTo", &JsiSkPath::conicTo);
714
- installHostMethod(runtime, prototype, "rConicTo", &JsiSkPath::rConicTo);
715
- installHostMethod(runtime, prototype, "cubicTo", &JsiSkPath::cubicTo);
716
- installHostMethod(runtime, prototype, "rCubicTo", &JsiSkPath::rCubicTo);
717
- installHostMethod(runtime, prototype, "close", &JsiSkPath::close);
718
- installHostMethod(runtime, prototype, "reset", &JsiSkPath::reset);
719
- installHostMethod(runtime, prototype, "rewind", &JsiSkPath::rewind);
720
- installHostMethod(runtime, prototype, "addPath", &JsiSkPath::addPath);
721
- installHostMethod(runtime, prototype, "addArc", &JsiSkPath::addArc);
722
- installHostMethod(runtime, prototype, "addOval", &JsiSkPath::addOval);
723
- installHostMethod(runtime, prototype, "addRect", &JsiSkPath::addRect);
724
- installHostMethod(runtime, prototype, "addRRect", &JsiSkPath::addRRect);
725
- installHostMethod(runtime, prototype, "addCircle", &JsiSkPath::addCircle);
726
- installHostMethod(runtime, prototype, "addPoly", &JsiSkPath::addPoly);
727
- installHostMethod(runtime, prototype, "arcToOval", &JsiSkPath::arcToOval);
728
- installHostMethod(runtime, prototype, "arcToRotated",
729
- &JsiSkPath::arcToRotated);
730
- installHostMethod(runtime, prototype, "rArcTo", &JsiSkPath::rArcTo);
731
- installHostMethod(runtime, prototype, "arcToTangent",
732
- &JsiSkPath::arcToTangent);
733
- installHostMethod(runtime, prototype, "setFillType",
734
- &JsiSkPath::setFillType);
735
- installHostMethod(runtime, prototype, "setIsVolatile",
736
- &JsiSkPath::setIsVolatile);
544
+ installChainableMethodWithRuntime(runtime, prototype, "moveTo",
545
+ &JsiSkPath::moveTo);
546
+ installChainableMethodWithRuntime(runtime, prototype, "rMoveTo",
547
+ &JsiSkPath::rMoveTo);
548
+ installChainableMethodWithRuntime(runtime, prototype, "lineTo",
549
+ &JsiSkPath::lineTo);
550
+ installChainableMethodWithRuntime(runtime, prototype, "rLineTo",
551
+ &JsiSkPath::rLineTo);
552
+ installChainableMethodWithRuntime(runtime, prototype, "quadTo",
553
+ &JsiSkPath::quadTo);
554
+ installChainableMethodWithRuntime(runtime, prototype, "rQuadTo",
555
+ &JsiSkPath::rQuadTo);
556
+ installChainableMethodWithRuntime(runtime, prototype, "conicTo",
557
+ &JsiSkPath::conicTo);
558
+ installChainableMethodWithRuntime(runtime, prototype, "rConicTo",
559
+ &JsiSkPath::rConicTo);
560
+ installChainableMethodWithRuntime(runtime, prototype, "cubicTo",
561
+ &JsiSkPath::cubicTo);
562
+ installChainableMethodWithRuntime(runtime, prototype, "rCubicTo",
563
+ &JsiSkPath::rCubicTo);
564
+ installChainableMethodWithRuntime(runtime, prototype, "close",
565
+ &JsiSkPath::close);
566
+ installChainableMethodWithRuntime(runtime, prototype, "reset",
567
+ &JsiSkPath::reset);
568
+ installChainableMethodWithRuntime(runtime, prototype, "rewind",
569
+ &JsiSkPath::rewind);
570
+ installChainableMethodWithRuntime(runtime, prototype, "addPath",
571
+ &JsiSkPath::addPath);
572
+ installChainableMethodWithRuntime(runtime, prototype, "addArc",
573
+ &JsiSkPath::addArc);
574
+ installChainableMethodWithRuntime(runtime, prototype, "addOval",
575
+ &JsiSkPath::addOval);
576
+ installChainableMethodWithRuntime(runtime, prototype, "addRect",
577
+ &JsiSkPath::addRect);
578
+ installChainableMethodWithRuntime(runtime, prototype, "addRRect",
579
+ &JsiSkPath::addRRect);
580
+ installChainableMethodWithRuntime(runtime, prototype, "addCircle",
581
+ &JsiSkPath::addCircle);
582
+ installChainableMethodWithRuntime(runtime, prototype, "addPoly",
583
+ &JsiSkPath::addPoly);
584
+ installChainableMethodWithRuntime(runtime, prototype, "arcToOval",
585
+ &JsiSkPath::arcToOval);
586
+ installChainableMethodWithRuntime(runtime, prototype, "arcToRotated",
587
+ &JsiSkPath::arcToRotated);
588
+ installChainableMethodWithRuntime(runtime, prototype, "rArcTo",
589
+ &JsiSkPath::rArcTo);
590
+ installChainableMethodWithRuntime(runtime, prototype, "arcToTangent",
591
+ &JsiSkPath::arcToTangent);
592
+ installChainableMethodWithRuntime(runtime, prototype, "setFillType",
593
+ &JsiSkPath::setFillType);
594
+ installChainableMethodWithRuntime(runtime, prototype, "setIsVolatile",
595
+ &JsiSkPath::setIsVolatile);
737
596
  // Mutable transform methods
738
- installHostMethod(runtime, prototype, "transform", &JsiSkPath::transform);
739
- installHostMethod(runtime, prototype, "offset", &JsiSkPath::offset);
597
+ installChainableMethodWithRuntime(runtime, prototype, "transform",
598
+ &JsiSkPath::transform);
599
+ installChainableMethodWithRuntime(runtime, prototype, "offset",
600
+ &JsiSkPath::offset);
740
601
  // Mutable path operations
741
- installHostMethod(runtime, prototype, "simplify", &JsiSkPath::simplify);
742
- installHostMethod(runtime, prototype, "op", &JsiSkPath::op);
743
- installHostMethod(runtime, prototype, "makeAsWinding",
744
- &JsiSkPath::makeAsWinding);
745
- installHostMethod(runtime, prototype, "dash", &JsiSkPath::dash);
602
+ installChainableMethodWithRuntime(runtime, prototype, "simplify",
603
+ &JsiSkPath::simplify);
604
+ installChainableMethodWithRuntime(runtime, prototype, "op",
605
+ &JsiSkPath::op);
606
+ installChainableMethodWithRuntime(runtime, prototype, "makeAsWinding",
607
+ &JsiSkPath::makeAsWinding);
608
+ installChainableMethodWithRuntime(runtime, prototype, "dash",
609
+ &JsiSkPath::dash);
746
610
  installHostMethod(runtime, prototype, "stroke", &JsiSkPath::stroke);
747
- installHostMethod(runtime, prototype, "trim", &JsiSkPath::trim);
611
+ installChainableMethodWithRuntime(runtime, prototype, "trim",
612
+ &JsiSkPath::trim);
748
613
  // Query methods
749
- installHostMethod(runtime, prototype, "computeTightBounds",
750
- &JsiSkPath::computeTightBounds);
751
- installHostMethod(runtime, prototype, "getBounds", &JsiSkPath::getBounds);
752
- installHostMethod(runtime, prototype, "contains", &JsiSkPath::contains);
753
- installHostMethod(runtime, prototype, "getFillType",
754
- &JsiSkPath::getFillType);
755
- installHostMethod(runtime, prototype, "isVolatile", &JsiSkPath::isVolatile);
756
- installHostMethod(runtime, prototype, "getPoint", &JsiSkPath::getPoint);
757
- installHostMethod(runtime, prototype, "isEmpty", &JsiSkPath::isEmpty);
758
- installHostMethod(runtime, prototype, "countPoints",
759
- &JsiSkPath::countPoints);
760
- installHostMethod(runtime, prototype, "getLastPt", &JsiSkPath::getLastPt);
761
- installHostMethod(runtime, prototype, "toSVGString",
762
- &JsiSkPath::toSVGString);
763
- installHostMethod(runtime, prototype, "equals", &JsiSkPath::equals);
764
- installHostMethod(runtime, prototype, "copy", &JsiSkPath::copy);
765
- installHostMethod(runtime, prototype, "isInterpolatable",
766
- &JsiSkPath::isInterpolatable);
767
- installHostMethod(runtime, prototype, "interpolate",
768
- &JsiSkPath::interpolate);
769
- installHostMethod(runtime, prototype, "toCmds", &JsiSkPath::toCmds);
614
+ installMethod(runtime, prototype, "computeTightBounds",
615
+ &JsiSkPath::computeTightBounds);
616
+ installMethod(runtime, prototype, "getBounds", &JsiSkPath::getBounds);
617
+ installMethod(runtime, prototype, "contains", &JsiSkPath::contains);
618
+ installMethod(runtime, prototype, "getFillType", &JsiSkPath::getFillType);
619
+ installMethod(runtime, prototype, "isVolatile", &JsiSkPath::isVolatile);
620
+ installMethod(runtime, prototype, "getPoint", &JsiSkPath::getPoint);
621
+ installMethod(runtime, prototype, "isEmpty", &JsiSkPath::isEmpty);
622
+ installMethod(runtime, prototype, "countPoints", &JsiSkPath::countPoints);
623
+ installMethod(runtime, prototype, "getLastPt", &JsiSkPath::getLastPt);
624
+ installMethod(runtime, prototype, "toSVGString", &JsiSkPath::toSVGString);
625
+ installMethod(runtime, prototype, "equals", &JsiSkPath::equals);
626
+ installMethod(runtime, prototype, "copy", &JsiSkPath::copy);
627
+ installMethod(runtime, prototype, "isInterpolatable",
628
+ &JsiSkPath::isInterpolatable);
629
+ installMethod(runtime, prototype, "interpolate", &JsiSkPath::interpolate);
630
+ installMethod(runtime, prototype, "toCmds", &JsiSkPath::toCmds);
770
631
  }
771
632
 
772
633
  JsiSkPath(std::shared_ptr<RNSkPlatformContext> context, SkPathBuilder builder)
@@ -810,6 +671,12 @@ public:
810
671
  return makeJsiObject(runtime,
811
672
  std::make_shared<JsiSkPath>(context, std::move(path)));
812
673
  }
674
+
675
+ private:
676
+ static SkPathDirection toDirection(const JsiOptional<bool> &isCCW) {
677
+ return isCCW.has_value() && *isCCW ? SkPathDirection::kCCW
678
+ : SkPathDirection::kCW;
679
+ }
813
680
  };
814
681
 
815
682
  } // namespace RNSkia