@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
@@ -1,9 +1,11 @@
1
1
  #pragma once
2
2
 
3
3
  #include <memory>
4
+ #include <string>
4
5
  #include <utility>
5
6
  #include <vector>
6
7
 
8
+ #include "JsiSkConverters.h"
7
9
  #include "JsiSkFont.h"
8
10
  #include "JsiSkImage.h"
9
11
  #include "JsiSkImageInfo.h"
@@ -53,29 +55,21 @@ class JsiSkCanvas : public JsiSkNativeObject<JsiSkCanvas> {
53
55
  public:
54
56
  static constexpr const char *CLASS_NAME = "Canvas";
55
57
 
56
- JSI_HOST_FUNCTION(drawPaint) {
57
- auto paint = JsiSkPaint::fromValue(runtime, arguments[0]);
58
+ void drawPaint(std::shared_ptr<SkPaint> paint) {
58
59
  _canvas->drawPaint(*paint);
59
- return jsi::Value::undefined();
60
60
  }
61
61
 
62
- JSI_HOST_FUNCTION(drawLine) {
63
- SkScalar x1 = arguments[0].asNumber();
64
- SkScalar y1 = arguments[1].asNumber();
65
- SkScalar x2 = arguments[2].asNumber();
66
- SkScalar y2 = arguments[3].asNumber();
67
- auto paint = JsiSkPaint::fromValue(runtime, arguments[4]);
62
+ void drawLine(double x1, double y1, double x2, double y2,
63
+ std::shared_ptr<SkPaint> paint) {
68
64
  _canvas->drawLine(x1, y1, x2, y2, *paint);
69
- return jsi::Value::undefined();
70
65
  }
71
66
 
72
- JSI_HOST_FUNCTION(drawRect) {
73
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
74
- auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
67
+ void drawRect(std::shared_ptr<SkRect> rect, std::shared_ptr<SkPaint> paint) {
75
68
  _canvas->drawRect(*rect, *paint);
76
- return jsi::Value::undefined();
77
69
  }
78
70
 
71
+ // The drawImage* variants stay raw: they dispatch on exact argument counts
72
+ // (count == 4 / count == 6) with null-tolerant trailing paints.
79
73
  JSI_HOST_FUNCTION(drawImage) {
80
74
  auto image = JsiSkImage::fromValue(runtime, arguments[0]);
81
75
  auto x = arguments[1].asNumber();
@@ -185,106 +179,55 @@ public:
185
179
  return jsi::Value::undefined();
186
180
  }
187
181
 
188
- JSI_HOST_FUNCTION(drawCircle) {
189
- SkScalar cx = arguments[0].asNumber();
190
- SkScalar cy = arguments[1].asNumber();
191
- SkScalar radius = arguments[2].asNumber();
192
-
193
- auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
182
+ void drawCircle(double cx, double cy, double radius,
183
+ std::shared_ptr<SkPaint> paint) {
194
184
  _canvas->drawCircle(cx, cy, radius, *paint);
195
-
196
- return jsi::Value::undefined();
197
185
  }
198
186
 
199
- JSI_HOST_FUNCTION(drawArc) {
200
- auto oval = JsiSkRect::fromValue(runtime, arguments[0]);
201
-
202
- SkScalar startAngle = arguments[1].asNumber();
203
- SkScalar sweepAngle = arguments[2].asNumber();
204
- bool useCenter = arguments[3].getBool();
205
-
206
- auto paint = JsiSkPaint::fromValue(runtime, arguments[4]);
187
+ void drawArc(std::shared_ptr<SkRect> oval, double startAngle,
188
+ double sweepAngle, bool useCenter,
189
+ std::shared_ptr<SkPaint> paint) {
207
190
  _canvas->drawArc(*oval, startAngle, sweepAngle, useCenter, *paint);
208
-
209
- return jsi::Value::undefined();
210
191
  }
211
192
 
212
- JSI_HOST_FUNCTION(drawRRect) {
213
- auto rect = JsiSkRRect::fromValue(runtime, arguments[0]);
214
- auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
215
-
193
+ void drawRRect(std::shared_ptr<SkRRect> rect,
194
+ std::shared_ptr<SkPaint> paint) {
216
195
  _canvas->drawRRect(*rect, *paint);
217
-
218
- return jsi::Value::undefined();
219
196
  }
220
197
 
221
- JSI_HOST_FUNCTION(drawDRRect) {
222
- auto outer = JsiSkRRect::fromValue(runtime, arguments[0]);
223
- auto inner = JsiSkRRect::fromValue(runtime, arguments[1]);
224
- auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
225
-
198
+ void drawDRRect(std::shared_ptr<SkRRect> outer,
199
+ std::shared_ptr<SkRRect> inner,
200
+ std::shared_ptr<SkPaint> paint) {
226
201
  _canvas->drawDRRect(*outer, *inner, *paint);
227
-
228
- return jsi::Value::undefined();
229
202
  }
230
203
 
231
- JSI_HOST_FUNCTION(drawOval) {
232
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
233
- auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
234
-
204
+ void drawOval(std::shared_ptr<SkRect> rect, std::shared_ptr<SkPaint> paint) {
235
205
  _canvas->drawOval(*rect, *paint);
236
-
237
- return jsi::Value::undefined();
238
206
  }
239
207
 
240
- JSI_HOST_FUNCTION(restoreToCount) {
241
- auto c = arguments[0].asNumber();
242
- _canvas->restoreToCount(c);
243
- return jsi::Value::undefined();
244
- }
208
+ void restoreToCount(double c) { _canvas->restoreToCount(c); }
245
209
 
246
- JSI_HOST_FUNCTION(getSaveCount) {
247
- return static_cast<int>(_canvas->getSaveCount());
248
- }
210
+ int getSaveCount() { return static_cast<int>(_canvas->getSaveCount()); }
249
211
 
250
- JSI_HOST_FUNCTION(getTotalMatrix) {
251
- return makeJsiObject(runtime, std::make_shared<JsiSkMatrix>(
252
- getContext(), _canvas->getTotalMatrix()));
212
+ std::shared_ptr<JsiSkMatrix> getTotalMatrix() {
213
+ return std::make_shared<JsiSkMatrix>(getContext(),
214
+ _canvas->getTotalMatrix());
253
215
  }
254
216
 
255
- JSI_HOST_FUNCTION(drawPoints) {
256
- auto pointMode = arguments[0].asNumber();
257
- std::vector<SkPoint> points;
258
-
259
- auto jsiPoints = arguments[1].asObject(runtime).asArray(runtime);
260
- auto pointsSize = jsiPoints.size(runtime);
261
-
217
+ void drawPoints(double pointMode, std::vector<SkPoint> points,
218
+ std::shared_ptr<SkPaint> paint) {
262
219
  // Check if we have at least one point
263
- if (pointsSize == 0) {
220
+ if (points.empty()) {
264
221
  throw std::invalid_argument("Points array must not be empty");
265
222
  }
266
-
267
- points.reserve(pointsSize);
268
-
269
- for (int i = 0; i < pointsSize; i++) {
270
- std::shared_ptr<SkPoint> point = JsiSkPoint::fromValue(
271
- runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime));
272
- points.push_back(*point.get());
273
- }
274
-
275
- auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
276
223
  auto p = SkSpan(points.data(), points.size());
277
- _canvas->drawPoints((SkCanvas::PointMode)pointMode, p, *paint);
278
-
279
- return jsi::Value::undefined();
224
+ _canvas->drawPoints(static_cast<SkCanvas::PointMode>(pointMode), p, *paint);
280
225
  }
281
226
 
282
- JSI_HOST_FUNCTION(drawVertices) {
283
- auto vertices = JsiSkVertices::fromValue(runtime, arguments[0]);
284
- auto blendMode = (SkBlendMode)arguments[1].getNumber();
285
- auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
286
- _canvas->drawVertices(vertices, blendMode, *paint);
287
- return jsi::Value::undefined();
227
+ void drawVertices(sk_sp<SkVertices> vertices, double blendMode,
228
+ std::shared_ptr<SkPaint> paint) {
229
+ _canvas->drawVertices(vertices, static_cast<SkBlendMode>(blendMode),
230
+ *paint);
288
231
  }
289
232
 
290
233
  JSI_HOST_FUNCTION(drawPatch) {
@@ -352,118 +295,71 @@ public:
352
295
  return jsi::Value::undefined();
353
296
  }
354
297
 
355
- JSI_HOST_FUNCTION(drawPath) {
356
- auto path = JsiSkPath::fromValue(runtime, arguments[0]);
357
- auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
358
-
298
+ void drawPath(std::shared_ptr<SkPathBuilder> path,
299
+ std::shared_ptr<SkPaint> paint) {
359
300
  _canvas->drawPath(path->snapshot(), *paint);
360
-
361
- return jsi::Value::undefined();
362
301
  }
363
302
 
364
- JSI_HOST_FUNCTION(drawText) {
365
- auto textVal = arguments[0].asString(runtime).utf8(runtime);
303
+ void drawText(std::string textVal, double x, double y,
304
+ std::shared_ptr<SkPaint> paint, std::shared_ptr<SkFont> font) {
366
305
  auto text = textVal.c_str();
367
- SkScalar x = arguments[1].asNumber();
368
- SkScalar y = arguments[2].asNumber();
369
-
370
- auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
371
- auto font = JsiSkFont::fromValue(runtime, arguments[4]);
372
-
373
306
  _canvas->drawSimpleText(text, strlen(text), SkTextEncoding::kUTF8, x, y,
374
307
  *font, *paint);
375
-
376
- return jsi::Value::undefined();
377
308
  }
378
309
 
379
- JSI_HOST_FUNCTION(drawTextBlob) {
380
- auto blob = JsiSkTextBlob::fromValue(runtime, arguments[0]);
381
- SkScalar x = arguments[1].asNumber();
382
- SkScalar y = arguments[2].asNumber();
383
- auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
310
+ void drawTextBlob(sk_sp<SkTextBlob> blob, double x, double y,
311
+ std::shared_ptr<SkPaint> paint) {
384
312
  _canvas->drawTextBlob(blob, x, y, *paint);
385
- return jsi::Value::undefined();
386
313
  }
387
314
 
388
- JSI_HOST_FUNCTION(drawGlyphs) {
389
- auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime);
390
- auto jsiPositions = arguments[1].asObject(runtime).asArray(runtime);
391
- auto x = arguments[2].asNumber();
392
- auto y = arguments[3].asNumber();
393
- auto font = JsiSkFont::fromValue(runtime, arguments[4]);
394
- auto paint = JsiSkPaint::fromValue(runtime, arguments[5]);
315
+ void drawGlyphs(std::vector<int> glyphIds, std::vector<SkPoint> positions,
316
+ double x, double y, std::shared_ptr<SkFont> font,
317
+ std::shared_ptr<SkPaint> paint) {
395
318
  SkPoint origin = SkPoint::Make(x, y);
396
319
 
397
- std::vector<SkPoint> positions;
398
- int pointsSize = static_cast<int>(jsiPositions.size(runtime));
399
- positions.reserve(pointsSize);
400
- for (int i = 0; i < pointsSize; i++) {
401
- std::shared_ptr<SkPoint> point = JsiSkPoint::fromValue(
402
- runtime, jsiPositions.getValueAtIndex(runtime, i).asObject(runtime));
403
- positions.push_back(*point.get());
404
- }
405
-
406
- std::vector<SkGlyphID> glyphs;
407
- int glyphsSize = static_cast<int>(jsiGlyphs.size(runtime));
408
-
409
320
  // Validate that glyphs and positions arrays have the same size
410
- if (glyphsSize != pointsSize) {
321
+ if (glyphIds.size() != positions.size()) {
411
322
  throw std::invalid_argument(
412
323
  "Glyphs and positions arrays must have the same length");
413
324
  }
414
325
 
415
- glyphs.reserve(glyphsSize);
416
- for (int i = 0; i < glyphsSize; i++) {
417
- glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber());
326
+ std::vector<SkGlyphID> glyphs;
327
+ glyphs.reserve(glyphIds.size());
328
+ for (auto glyph : glyphIds) {
329
+ glyphs.push_back(static_cast<SkGlyphID>(glyph));
418
330
  }
419
331
 
420
332
  auto g = SkSpan(glyphs.data(), glyphs.size());
421
333
  auto p = SkSpan(positions.data(), positions.size());
422
334
  _canvas->drawGlyphs(g, p, origin, *font, *paint);
423
-
424
- return jsi::Value::undefined();
425
335
  }
426
336
 
427
- JSI_HOST_FUNCTION(drawSvg) {
428
- auto svgdom = JsiSkSVG::fromValue(runtime, arguments[0]);
429
- if (count == 3 && arguments[1].isNumber() && arguments[2].isNumber()) {
430
- // read size
431
- auto w = arguments[1].asNumber();
432
- auto h = arguments[2].asNumber();
433
- svgdom->setContainerSize(SkSize::Make(w, h));
337
+ void drawSvg(sk_sp<SkSVGDOM> svgdom, JsiOptional<double> w,
338
+ JsiOptional<double> h) {
339
+ if (w.has_value() && h.has_value()) {
340
+ svgdom->setContainerSize(SkSize::Make(*w, *h));
434
341
  } else {
435
342
  auto canvasSize = _canvas->getBaseLayerSize();
436
343
  svgdom->setContainerSize(SkSize::Make(canvasSize));
437
344
  }
438
345
  svgdom->render(_canvas);
439
- return jsi::Value::undefined();
440
346
  }
441
347
 
442
- JSI_HOST_FUNCTION(clipPath) {
443
- auto path = JsiSkPath::fromValue(runtime, arguments[0]);
444
- auto op = (SkClipOp)arguments[1].asNumber();
445
- auto doAntiAlias = arguments[2].getBool();
446
- _canvas->clipPath(path->snapshot(), op, doAntiAlias);
447
- return jsi::Value::undefined();
348
+ void clipPath(std::shared_ptr<SkPathBuilder> path, double op,
349
+ bool doAntiAlias) {
350
+ _canvas->clipPath(path->snapshot(), static_cast<SkClipOp>(op),
351
+ doAntiAlias);
448
352
  }
449
353
 
450
- JSI_HOST_FUNCTION(clipRect) {
451
- auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
452
- auto op = (SkClipOp)arguments[1].asNumber();
453
- auto doAntiAlias = arguments[2].getBool();
454
- _canvas->clipRect(*rect, op, doAntiAlias);
455
- return jsi::Value::undefined();
354
+ void clipRect(std::shared_ptr<SkRect> rect, double op, bool doAntiAlias) {
355
+ _canvas->clipRect(*rect, static_cast<SkClipOp>(op), doAntiAlias);
456
356
  }
457
357
 
458
- JSI_HOST_FUNCTION(clipRRect) {
459
- auto rrect = JsiSkRRect::fromValue(runtime, arguments[0]);
460
- auto op = (SkClipOp)arguments[1].asNumber();
461
- auto doAntiAlias = arguments[2].getBool();
462
- _canvas->clipRRect(*rrect, op, doAntiAlias);
463
- return jsi::Value::undefined();
358
+ void clipRRect(std::shared_ptr<SkRRect> rrect, double op, bool doAntiAlias) {
359
+ _canvas->clipRRect(*rrect, static_cast<SkClipOp>(op), doAntiAlias);
464
360
  }
465
361
 
466
- JSI_HOST_FUNCTION(save) { return jsi::Value(_canvas->save()); }
362
+ int save() { return _canvas->save(); }
467
363
 
468
364
  JSI_HOST_FUNCTION(saveLayer) {
469
365
  SkPaint *paint = (count >= 1 && !arguments[0].isUndefined())
@@ -482,67 +378,32 @@ public:
482
378
  SkCanvas::SaveLayerRec(bounds, paint, backdrop, flags)));
483
379
  }
484
380
 
485
- JSI_HOST_FUNCTION(restore) {
486
- _canvas->restore();
487
- return jsi::Value::undefined();
488
- }
381
+ void restore() { _canvas->restore(); }
489
382
 
490
- JSI_HOST_FUNCTION(rotate) {
491
- SkScalar degrees = arguments[0].asNumber();
492
- SkScalar rx = arguments[1].asNumber();
493
- SkScalar ry = arguments[2].asNumber();
383
+ void rotate(double degrees, double rx, double ry) {
494
384
  _canvas->rotate(degrees, rx, ry);
495
- return jsi::Value::undefined();
496
385
  }
497
386
 
498
- JSI_HOST_FUNCTION(translate) {
499
- SkScalar dx = arguments[0].asNumber();
500
- SkScalar dy = arguments[1].asNumber();
501
- _canvas->translate(dx, dy);
502
- return jsi::Value::undefined();
503
- }
387
+ void translate(double dx, double dy) { _canvas->translate(dx, dy); }
504
388
 
505
- JSI_HOST_FUNCTION(scale) {
506
- SkScalar sx = arguments[0].asNumber();
507
- SkScalar sy = arguments[1].asNumber();
508
- _canvas->scale(sx, sy);
509
- return jsi::Value::undefined();
510
- }
389
+ void scale(double sx, double sy) { _canvas->scale(sx, sy); }
511
390
 
512
- JSI_HOST_FUNCTION(skew) {
513
- SkScalar sx = arguments[0].asNumber();
514
- SkScalar sy = arguments[1].asNumber();
515
- _canvas->skew(sx, sy);
516
- return jsi::Value::undefined();
517
- }
391
+ void skew(double sx, double sy) { _canvas->skew(sx, sy); }
518
392
 
519
- JSI_HOST_FUNCTION(drawColor) {
520
- SkColor cl = JsiSkColor::fromValue(runtime, arguments[0]);
521
- if (count == 1) {
522
- _canvas->drawColor(cl);
393
+ void drawColor(JsiColor cl, JsiOptional<double> mode) {
394
+ if (mode.has_value()) {
395
+ _canvas->drawColor(cl, static_cast<SkBlendMode>(*mode));
523
396
  } else {
524
- auto mode = static_cast<SkBlendMode>(arguments[1].asNumber());
525
- _canvas->drawColor(cl, mode);
397
+ _canvas->drawColor(cl);
526
398
  }
527
- return jsi::Value::undefined();
528
399
  }
529
400
 
530
- JSI_HOST_FUNCTION(clear) {
531
- SkColor cl = JsiSkColor::fromValue(runtime, arguments[0]);
532
- _canvas->clear(cl);
533
- return jsi::Value::undefined();
534
- }
401
+ void clear(JsiColor cl) { _canvas->clear(cl); }
535
402
 
536
- JSI_HOST_FUNCTION(concat) {
537
- auto matrix = JsiSkMatrix::fromValue(runtime, arguments[0]);
538
- _canvas->concat(*matrix.get());
539
- return jsi::Value::undefined();
540
- }
403
+ void concat(std::shared_ptr<SkMatrix> matrix) { _canvas->concat(*matrix); }
541
404
 
542
- JSI_HOST_FUNCTION(drawPicture) {
543
- auto picture = JsiSkPicture::fromValue(runtime, arguments[0]);
405
+ void drawPicture(sk_sp<SkPicture> picture) {
544
406
  _canvas->drawPicture(picture);
545
- return jsi::Value::undefined();
546
407
  }
547
408
 
548
409
  JSI_HOST_FUNCTION(drawAtlas) {
@@ -679,9 +540,9 @@ public:
679
540
  }
680
541
 
681
542
  static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
682
- installHostMethod(runtime, prototype, "drawPaint", &JsiSkCanvas::drawPaint);
683
- installHostMethod(runtime, prototype, "drawLine", &JsiSkCanvas::drawLine);
684
- installHostMethod(runtime, prototype, "drawRect", &JsiSkCanvas::drawRect);
543
+ installMethod(runtime, prototype, "drawPaint", &JsiSkCanvas::drawPaint);
544
+ installMethod(runtime, prototype, "drawLine", &JsiSkCanvas::drawLine);
545
+ installMethod(runtime, prototype, "drawRect", &JsiSkCanvas::drawRect);
685
546
  installHostMethod(runtime, prototype, "drawImage", &JsiSkCanvas::drawImage);
686
547
  installHostMethod(runtime, prototype, "drawImageRect",
687
548
  &JsiSkCanvas::drawImageRect);
@@ -695,46 +556,42 @@ public:
695
556
  &JsiSkCanvas::drawImageRectCubic);
696
557
  installHostMethod(runtime, prototype, "drawImageRectOptions",
697
558
  &JsiSkCanvas::drawImageRectOptions);
698
- installHostMethod(runtime, prototype, "drawCircle",
699
- &JsiSkCanvas::drawCircle);
700
- installHostMethod(runtime, prototype, "drawArc", &JsiSkCanvas::drawArc);
701
- installHostMethod(runtime, prototype, "drawRRect", &JsiSkCanvas::drawRRect);
702
- installHostMethod(runtime, prototype, "drawDRRect",
703
- &JsiSkCanvas::drawDRRect);
704
- installHostMethod(runtime, prototype, "drawOval", &JsiSkCanvas::drawOval);
705
- installHostMethod(runtime, prototype, "restoreToCount",
706
- &JsiSkCanvas::restoreToCount);
707
- installHostMethod(runtime, prototype, "getSaveCount",
708
- &JsiSkCanvas::getSaveCount);
709
- installHostMethod(runtime, prototype, "getTotalMatrix",
710
- &JsiSkCanvas::getTotalMatrix);
711
- installHostMethod(runtime, prototype, "drawPoints",
712
- &JsiSkCanvas::drawPoints);
559
+ installMethod(runtime, prototype, "drawCircle", &JsiSkCanvas::drawCircle);
560
+ installMethod(runtime, prototype, "drawArc", &JsiSkCanvas::drawArc);
561
+ installMethod(runtime, prototype, "drawRRect", &JsiSkCanvas::drawRRect);
562
+ installMethod(runtime, prototype, "drawDRRect", &JsiSkCanvas::drawDRRect);
563
+ installMethod(runtime, prototype, "drawOval", &JsiSkCanvas::drawOval);
564
+ installMethod(runtime, prototype, "restoreToCount",
565
+ &JsiSkCanvas::restoreToCount);
566
+ installMethod(runtime, prototype, "getSaveCount",
567
+ &JsiSkCanvas::getSaveCount);
568
+ installMethod(runtime, prototype, "getTotalMatrix",
569
+ &JsiSkCanvas::getTotalMatrix);
570
+ installMethod(runtime, prototype, "drawPoints", &JsiSkCanvas::drawPoints);
713
571
  installHostMethod(runtime, prototype, "drawPatch", &JsiSkCanvas::drawPatch);
714
- installHostMethod(runtime, prototype, "drawPath", &JsiSkCanvas::drawPath);
715
- installHostMethod(runtime, prototype, "drawVertices",
716
- &JsiSkCanvas::drawVertices);
717
- installHostMethod(runtime, prototype, "drawText", &JsiSkCanvas::drawText);
718
- installHostMethod(runtime, prototype, "drawTextBlob",
719
- &JsiSkCanvas::drawTextBlob);
720
- installHostMethod(runtime, prototype, "drawGlyphs",
721
- &JsiSkCanvas::drawGlyphs);
722
- installHostMethod(runtime, prototype, "drawSvg", &JsiSkCanvas::drawSvg);
723
- installHostMethod(runtime, prototype, "clipPath", &JsiSkCanvas::clipPath);
724
- installHostMethod(runtime, prototype, "clipRect", &JsiSkCanvas::clipRect);
725
- installHostMethod(runtime, prototype, "clipRRect", &JsiSkCanvas::clipRRect);
726
- installHostMethod(runtime, prototype, "save", &JsiSkCanvas::save);
572
+ installMethod(runtime, prototype, "drawPath", &JsiSkCanvas::drawPath);
573
+ installMethod(runtime, prototype, "drawVertices",
574
+ &JsiSkCanvas::drawVertices);
575
+ installMethod(runtime, prototype, "drawText", &JsiSkCanvas::drawText);
576
+ installMethod(runtime, prototype, "drawTextBlob",
577
+ &JsiSkCanvas::drawTextBlob);
578
+ installMethod(runtime, prototype, "drawGlyphs", &JsiSkCanvas::drawGlyphs);
579
+ installMethod(runtime, prototype, "drawSvg", &JsiSkCanvas::drawSvg);
580
+ installMethod(runtime, prototype, "clipPath", &JsiSkCanvas::clipPath);
581
+ installMethod(runtime, prototype, "clipRect", &JsiSkCanvas::clipRect);
582
+ installMethod(runtime, prototype, "clipRRect", &JsiSkCanvas::clipRRect);
583
+ installMethod(runtime, prototype, "save", &JsiSkCanvas::save);
727
584
  installHostMethod(runtime, prototype, "saveLayer", &JsiSkCanvas::saveLayer);
728
- installHostMethod(runtime, prototype, "restore", &JsiSkCanvas::restore);
729
- installHostMethod(runtime, prototype, "rotate", &JsiSkCanvas::rotate);
730
- installHostMethod(runtime, prototype, "translate", &JsiSkCanvas::translate);
731
- installHostMethod(runtime, prototype, "scale", &JsiSkCanvas::scale);
732
- installHostMethod(runtime, prototype, "skew", &JsiSkCanvas::skew);
733
- installHostMethod(runtime, prototype, "drawColor", &JsiSkCanvas::drawColor);
734
- installHostMethod(runtime, prototype, "clear", &JsiSkCanvas::clear);
735
- installHostMethod(runtime, prototype, "concat", &JsiSkCanvas::concat);
736
- installHostMethod(runtime, prototype, "drawPicture",
737
- &JsiSkCanvas::drawPicture);
585
+ installMethod(runtime, prototype, "restore", &JsiSkCanvas::restore);
586
+ installMethod(runtime, prototype, "rotate", &JsiSkCanvas::rotate);
587
+ installMethod(runtime, prototype, "translate", &JsiSkCanvas::translate);
588
+ installMethod(runtime, prototype, "scale", &JsiSkCanvas::scale);
589
+ installMethod(runtime, prototype, "skew", &JsiSkCanvas::skew);
590
+ installMethod(runtime, prototype, "drawColor", &JsiSkCanvas::drawColor);
591
+ installMethod(runtime, prototype, "clear", &JsiSkCanvas::clear);
592
+ installMethod(runtime, prototype, "concat", &JsiSkCanvas::concat);
593
+ installMethod(runtime, prototype, "drawPicture",
594
+ &JsiSkCanvas::drawPicture);
738
595
  installHostMethod(runtime, prototype, "drawAtlas", &JsiSkCanvas::drawAtlas);
739
596
  installHostMethod(runtime, prototype, "readPixels",
740
597
  &JsiSkCanvas::readPixels);
@@ -2,10 +2,12 @@
2
2
 
3
3
  #include "JsiSkColor.h"
4
4
  #include "JsiSkColorFilter.h"
5
+ #include "JsiSkConverters.h"
5
6
  #include "JsiSkNativeObjects.h"
6
7
  #include <jsi/jsi.h>
7
8
  #include <memory>
8
9
  #include <utility>
10
+ #include <vector>
9
11
 
10
12
  #pragma clang diagnostic push
11
13
  #pragma clang diagnostic ignored "-Wdocumentation"
@@ -24,87 +26,67 @@ class JsiSkColorFilterFactory
24
26
  public:
25
27
  static constexpr const char *CLASS_NAME = "ColorFilterFactory";
26
28
 
27
- JSI_HOST_FUNCTION(MakeMatrix) {
28
- auto jsiMatrix = arguments[0].asObject(runtime).asArray(runtime);
29
- float matrix[20];
30
- for (int i = 0; i < 20; i++) {
31
- if (jsiMatrix.size(runtime) > i) {
32
- matrix[i] = jsiMatrix.getValueAtIndex(runtime, i).asNumber();
33
- }
29
+ std::shared_ptr<JsiSkColorFilter> MakeMatrix(std::vector<float> values) {
30
+ float matrix[20] = {0};
31
+ for (size_t i = 0; i < 20 && i < values.size(); i++) {
32
+ matrix[i] = values[i];
34
33
  }
35
- // Return the newly constructed object
36
- return makeJsiObject(
37
- runtime, std::make_shared<JsiSkColorFilter>(
38
- getContext(), SkColorFilters::Matrix(std::move(matrix))));
34
+ return std::make_shared<JsiSkColorFilter>(getContext(),
35
+ SkColorFilters::Matrix(matrix));
39
36
  }
40
37
 
41
- JSI_HOST_FUNCTION(MakeBlend) {
42
- auto color = JsiSkColor::fromValue(runtime, arguments[0]);
43
- SkBlendMode blend = (SkBlendMode)arguments[1].asNumber();
44
- // Return the newly constructed object
45
- return makeJsiObject(
46
- runtime, std::make_shared<JsiSkColorFilter>(
47
- getContext(), SkColorFilters::Blend(color, blend)));
38
+ std::shared_ptr<JsiSkColorFilter> MakeBlend(JsiColor color, double blend) {
39
+ return std::make_shared<JsiSkColorFilter>(
40
+ getContext(),
41
+ SkColorFilters::Blend(color, static_cast<SkBlendMode>(blend)));
48
42
  }
49
43
 
50
- JSI_HOST_FUNCTION(MakeCompose) {
51
- auto outer = JsiSkColorFilter::fromValue(runtime, arguments[0]);
52
- auto inner = JsiSkColorFilter::fromValue(runtime, arguments[1]);
53
- // Return the newly constructed object
54
- return makeJsiObject(
55
- runtime, std::make_shared<JsiSkColorFilter>(
56
- getContext(), SkColorFilters::Compose(std::move(outer),
57
- std::move(inner))));
44
+ std::shared_ptr<JsiSkColorFilter> MakeCompose(sk_sp<SkColorFilter> outer,
45
+ sk_sp<SkColorFilter> inner) {
46
+ return std::make_shared<JsiSkColorFilter>(
47
+ getContext(),
48
+ SkColorFilters::Compose(std::move(outer), std::move(inner)));
58
49
  }
59
50
 
60
- JSI_HOST_FUNCTION(MakeLerp) {
61
- auto t = arguments[0].asNumber();
62
- auto dst = JsiSkColorFilter::fromValue(runtime, arguments[1]);
63
- auto src = JsiSkColorFilter::fromValue(runtime, arguments[2]);
64
- // Return the newly constructed object
65
- return makeJsiObject(
66
- runtime, std::make_shared<JsiSkColorFilter>(
67
- getContext(),
68
- SkColorFilters::Lerp(t, std::move(dst), std::move(src))));
51
+ std::shared_ptr<JsiSkColorFilter> MakeLerp(double t,
52
+ sk_sp<SkColorFilter> dst,
53
+ sk_sp<SkColorFilter> src) {
54
+ return std::make_shared<JsiSkColorFilter>(
55
+ getContext(), SkColorFilters::Lerp(t, std::move(dst), std::move(src)));
69
56
  }
70
57
 
71
- JSI_HOST_FUNCTION(MakeSRGBToLinearGamma) {
72
- // Return the newly constructed object
73
- return makeJsiObject(
74
- runtime, std::make_shared<JsiSkColorFilter>(
75
- getContext(), SkColorFilters::SRGBToLinearGamma()));
58
+ std::shared_ptr<JsiSkColorFilter> MakeSRGBToLinearGamma() {
59
+ return std::make_shared<JsiSkColorFilter>(
60
+ getContext(), SkColorFilters::SRGBToLinearGamma());
76
61
  }
77
62
 
78
- JSI_HOST_FUNCTION(MakeLinearToSRGBGamma) {
79
- // Return the newly constructed object
80
- return makeJsiObject(
81
- runtime, std::make_shared<JsiSkColorFilter>(
82
- getContext(), SkColorFilters::LinearToSRGBGamma()));
63
+ std::shared_ptr<JsiSkColorFilter> MakeLinearToSRGBGamma() {
64
+ return std::make_shared<JsiSkColorFilter>(
65
+ getContext(), SkColorFilters::LinearToSRGBGamma());
83
66
  }
84
67
 
85
- JSI_HOST_FUNCTION(MakeLumaColorFilter) {
86
- // Return the newly constructed object
87
- return makeJsiObject(runtime, std::make_shared<JsiSkColorFilter>(
88
- getContext(), SkLumaColorFilter::Make()));
68
+ std::shared_ptr<JsiSkColorFilter> MakeLumaColorFilter() {
69
+ return std::make_shared<JsiSkColorFilter>(getContext(),
70
+ SkLumaColorFilter::Make());
89
71
  }
90
72
 
91
73
  size_t getMemoryPressure() override { return 1024; }
92
74
 
93
75
  static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
94
- installHostMethod(runtime, prototype, "MakeMatrix",
95
- &JsiSkColorFilterFactory::MakeMatrix);
96
- installHostMethod(runtime, prototype, "MakeBlend",
97
- &JsiSkColorFilterFactory::MakeBlend);
98
- installHostMethod(runtime, prototype, "MakeCompose",
99
- &JsiSkColorFilterFactory::MakeCompose);
100
- installHostMethod(runtime, prototype, "MakeLerp",
101
- &JsiSkColorFilterFactory::MakeLerp);
102
- installHostMethod(runtime, prototype, "MakeSRGBToLinearGamma",
103
- &JsiSkColorFilterFactory::MakeSRGBToLinearGamma);
104
- installHostMethod(runtime, prototype, "MakeLinearToSRGBGamma",
105
- &JsiSkColorFilterFactory::MakeLinearToSRGBGamma);
106
- installHostMethod(runtime, prototype, "MakeLumaColorFilter",
107
- &JsiSkColorFilterFactory::MakeLumaColorFilter);
76
+ installMethod(runtime, prototype, "MakeMatrix",
77
+ &JsiSkColorFilterFactory::MakeMatrix);
78
+ installMethod(runtime, prototype, "MakeBlend",
79
+ &JsiSkColorFilterFactory::MakeBlend);
80
+ installMethod(runtime, prototype, "MakeCompose",
81
+ &JsiSkColorFilterFactory::MakeCompose);
82
+ installMethod(runtime, prototype, "MakeLerp",
83
+ &JsiSkColorFilterFactory::MakeLerp);
84
+ installMethod(runtime, prototype, "MakeSRGBToLinearGamma",
85
+ &JsiSkColorFilterFactory::MakeSRGBToLinearGamma);
86
+ installMethod(runtime, prototype, "MakeLinearToSRGBGamma",
87
+ &JsiSkColorFilterFactory::MakeLinearToSRGBGamma);
88
+ installMethod(runtime, prototype, "MakeLumaColorFilter",
89
+ &JsiSkColorFilterFactory::MakeLumaColorFilter);
108
90
  }
109
91
 
110
92
  explicit JsiSkColorFilterFactory(std::shared_ptr<RNSkPlatformContext> context)