@shopify/react-native-skia 2.0.0-next.1 → 2.0.0-next.2

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 (306) hide show
  1. package/android/build.gradle +11 -1
  2. package/android/cpp/jni/JniPlatformContext.cpp +1 -0
  3. package/{ios/RNSkia-iOS → apple}/MetalContext.h +0 -5
  4. package/{ios/RNSkia-iOS → apple}/MetalWindowContext.mm +4 -0
  5. package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.h → apple/RNSkApplePlatformContext.h} +7 -3
  6. package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.mm → apple/RNSkApplePlatformContext.mm} +19 -19
  7. package/{ios/RNSkia-iOS/RNSkiOSVideo.h → apple/RNSkAppleVideo.h} +3 -3
  8. package/{ios/RNSkia-iOS/RNSkiOSVideo.mm → apple/RNSkAppleVideo.mm} +14 -14
  9. package/{ios/RNSkia-iOS/RNSkiOSView.h → apple/RNSkAppleView.h} +4 -4
  10. package/{ios/RNSkia-iOS/RNSkiOSView.mm → apple/RNSkAppleView.mm} +4 -4
  11. package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.mm +6 -1
  12. package/{ios/RNSkia-iOS → apple}/SkiaManager.mm +2 -2
  13. package/{ios/RNSkia-iOS → apple}/SkiaPictureView.mm +2 -2
  14. package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.mm +6 -2
  15. package/{ios/RNSkia-iOS → apple}/SkiaUIView.h +12 -4
  16. package/{ios/RNSkia-iOS → apple}/SkiaUIView.mm +11 -7
  17. package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.h +4 -0
  18. package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.mm +4 -0
  19. package/cpp/api/JsiSkContourMeasure.h +1 -1
  20. package/cpp/api/JsiSkHostObjects.h +21 -10
  21. package/cpp/api/JsiSkParagraph.h +17 -27
  22. package/cpp/api/JsiSkPathEffect.h +1 -1
  23. package/cpp/api/JsiSkPictureFactory.h +1 -1
  24. package/cpp/api/JsiSkShaderFactory.h +43 -8
  25. package/cpp/api/JsiSkVertices.h +14 -3
  26. package/cpp/api/recorder/Drawings.h +4 -3
  27. package/cpp/rnskia/DawnContext.h +1 -1
  28. package/cpp/skia/include/codec/SkCodec.h +7 -2
  29. package/cpp/skia/include/config/SkUserConfig.h +11 -0
  30. package/cpp/skia/include/core/SkCanvas.h +11 -7
  31. package/cpp/skia/include/core/SkColor.h +10 -0
  32. package/cpp/skia/include/core/SkColorSpace.h +184 -2
  33. package/cpp/skia/include/core/SkColorType.h +114 -32
  34. package/cpp/skia/include/core/SkFontScanner.h +5 -8
  35. package/cpp/skia/include/core/SkFontStyle.h +1 -1
  36. package/cpp/skia/include/core/SkMaskFilter.h +0 -8
  37. package/cpp/skia/include/core/SkMilestone.h +1 -1
  38. package/cpp/skia/include/core/SkPath.h +1 -1
  39. package/cpp/skia/include/core/SkRRect.h +3 -1
  40. package/cpp/skia/include/core/SkShader.h +3 -3
  41. package/cpp/skia/include/core/SkString.h +8 -8
  42. package/cpp/skia/include/core/SkSurface.h +14 -0
  43. package/cpp/skia/include/core/SkTypeface.h +24 -7
  44. package/cpp/skia/include/effects/SkGradientShader.h +6 -1
  45. package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
  46. package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
  47. package/cpp/skia/include/gpu/GpuTypes.h +9 -0
  48. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
  49. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
  50. package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
  51. package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
  52. package/cpp/skia/include/gpu/graphite/Context.h +25 -2
  53. package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
  54. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
  55. package/cpp/skia/include/gpu/graphite/Image.h +1 -0
  56. package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
  57. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
  58. package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
  59. package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
  60. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
  61. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
  62. package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
  63. package/cpp/skia/include/pathops/SkPathOps.h +9 -1
  64. package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
  65. package/cpp/skia/include/private/SkPathRef.h +15 -21
  66. package/cpp/skia/include/private/base/SkAttributes.h +16 -10
  67. package/cpp/skia/include/private/base/SkMutex.h +8 -0
  68. package/cpp/skia/include/private/base/SkTArray.h +1 -1
  69. package/cpp/skia/include/private/base/SkTDArray.h +1 -1
  70. package/cpp/skia/include/private/base/SkTemplates.h +24 -11
  71. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  72. package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
  73. package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
  74. package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
  75. package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
  76. package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
  77. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  78. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  79. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  80. package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
  81. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  82. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  83. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  84. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +2 -0
  85. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
  86. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  87. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
  88. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  89. package/cpp/skia/src/core/SkLRUCache.h +19 -13
  90. package/cpp/skia/src/core/SkTHash.h +50 -4
  91. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
  92. package/lib/commonjs/__tests__/setup.d.ts +18 -0
  93. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +4 -3
  94. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  95. package/lib/commonjs/headless/index.d.ts +1 -0
  96. package/lib/commonjs/headless/index.js +12 -0
  97. package/lib/commonjs/headless/index.js.map +1 -1
  98. package/lib/commonjs/mock/index.js +1 -2
  99. package/lib/commonjs/mock/index.js.map +1 -1
  100. package/lib/commonjs/renderer/Canvas.js +3 -1
  101. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  102. package/lib/commonjs/skia/web/Host.d.ts +4 -6
  103. package/lib/commonjs/skia/web/Host.js +23 -10
  104. package/lib/commonjs/skia/web/Host.js.map +1 -1
  105. package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -15
  106. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  107. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
  108. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  109. package/lib/commonjs/skia/web/JsiSkFont.js +3 -3
  110. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  111. package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
  112. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
  113. package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
  114. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  115. package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -3
  116. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  117. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +9 -9
  118. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  119. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
  120. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  121. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
  122. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  123. package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
  124. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  125. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +3 -3
  126. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  127. package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
  128. package/lib/commonjs/skia/web/JsiSkPathFactory.js +2 -2
  129. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  130. package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
  131. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  132. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
  133. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  134. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +1 -1
  135. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  136. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +1 -1
  137. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
  138. package/lib/commonjs/skia/web/JsiSkia.js +4 -3
  139. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  140. package/lib/commonjs/skia/web/JsiVideo.js +2 -1
  141. package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
  142. package/lib/commonjs/sksg/HostConfig.js +3 -1
  143. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  144. package/lib/commonjs/sksg/Recorder/Core.d.ts +1 -5
  145. package/lib/commonjs/sksg/Recorder/Core.js +12 -4
  146. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  147. package/lib/commonjs/sksg/Recorder/Player.js +4 -5
  148. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  149. package/lib/commonjs/sksg/Recorder/commands/Box.js +2 -4
  150. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
  151. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
  152. package/lib/commonjs/specs/NativeSkiaModule.web.js +10 -1
  153. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  154. package/lib/module/__tests__/setup.d.ts +18 -0
  155. package/lib/module/external/reanimated/useAnimatedImageValue.js +4 -3
  156. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  157. package/lib/module/headless/index.d.ts +1 -0
  158. package/lib/module/headless/index.js +1 -0
  159. package/lib/module/headless/index.js.map +1 -1
  160. package/lib/module/mock/index.js +1 -2
  161. package/lib/module/mock/index.js.map +1 -1
  162. package/lib/module/renderer/Canvas.js +3 -1
  163. package/lib/module/renderer/Canvas.js.map +1 -1
  164. package/lib/module/skia/web/Host.d.ts +4 -6
  165. package/lib/module/skia/web/Host.js +21 -8
  166. package/lib/module/skia/web/Host.js.map +1 -1
  167. package/lib/module/skia/web/JsiSkCanvas.js +15 -15
  168. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  169. package/lib/module/skia/web/JsiSkColorFilterFactory.js +1 -1
  170. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  171. package/lib/module/skia/web/JsiSkFont.js +4 -4
  172. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  173. package/lib/module/skia/web/JsiSkFontMgr.js +2 -2
  174. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
  175. package/lib/module/skia/web/JsiSkImage.js +6 -6
  176. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  177. package/lib/module/skia/web/JsiSkImageFactory.js +4 -4
  178. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  179. package/lib/module/skia/web/JsiSkImageFilterFactory.js +10 -10
  180. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  181. package/lib/module/skia/web/JsiSkMaskFilterFactory.js +1 -1
  182. package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  183. package/lib/module/skia/web/JsiSkPaint.js +3 -3
  184. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  185. package/lib/module/skia/web/JsiSkPath.js +4 -4
  186. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  187. package/lib/module/skia/web/JsiSkPathEffectFactory.js +4 -4
  188. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  189. package/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
  190. package/lib/module/skia/web/JsiSkPathFactory.js +3 -3
  191. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  192. package/lib/module/skia/web/JsiSkPicture.js +1 -1
  193. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  194. package/lib/module/skia/web/JsiSkShaderFactory.js +5 -5
  195. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  196. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +2 -2
  197. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  198. package/lib/module/skia/web/JsiSkVerticesFactory.js +1 -1
  199. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
  200. package/lib/module/skia/web/JsiSkia.js +4 -3
  201. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  202. package/lib/module/skia/web/JsiVideo.js +2 -1
  203. package/lib/module/skia/web/JsiVideo.js.map +1 -1
  204. package/lib/module/sksg/HostConfig.js +3 -1
  205. package/lib/module/sksg/HostConfig.js.map +1 -1
  206. package/lib/module/sksg/Recorder/Core.d.ts +1 -5
  207. package/lib/module/sksg/Recorder/Core.js +10 -2
  208. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  209. package/lib/module/sksg/Recorder/Player.js +5 -6
  210. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  211. package/lib/module/sksg/Recorder/commands/Box.js +3 -5
  212. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
  213. package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
  214. package/lib/module/specs/NativeSkiaModule.web.js +10 -1
  215. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  216. package/lib/typescript/lib/commonjs/mock/index.d.ts +2 -2
  217. package/lib/typescript/lib/commonjs/skia/index.d.ts +1 -1
  218. package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +3 -5
  219. package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
  220. package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +1 -1
  221. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -1
  222. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
  223. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
  224. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
  225. package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
  226. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +3 -3
  227. package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -1
  228. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -1
  229. package/lib/typescript/lib/module/headless/index.d.ts +1 -0
  230. package/lib/typescript/lib/module/mock/index.d.ts +5 -5
  231. package/lib/typescript/lib/module/skia/Skia.d.ts +1 -1
  232. package/lib/typescript/lib/module/skia/Skia.web.d.ts +3 -3
  233. package/lib/typescript/lib/module/skia/web/Host.d.ts +3 -5
  234. package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
  235. package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +1 -1
  236. package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -1
  237. package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
  238. package/lib/typescript/lib/module/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
  239. package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
  240. package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
  241. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +3 -3
  242. package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -1
  243. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -1
  244. package/lib/typescript/src/__tests__/setup.d.ts +18 -0
  245. package/lib/typescript/src/headless/index.d.ts +1 -0
  246. package/lib/typescript/src/skia/web/Host.d.ts +4 -6
  247. package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +1 -1
  248. package/lib/typescript/src/sksg/Recorder/Core.d.ts +1 -5
  249. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
  250. package/package.json +6 -5
  251. package/react-native-skia.podspec +3 -3
  252. package/src/__tests__/setup.ts +67 -1
  253. package/src/external/reanimated/useAnimatedImageValue.ts +4 -3
  254. package/src/headless/index.ts +2 -1
  255. package/src/mock/index.ts +1 -2
  256. package/src/renderer/Canvas.tsx +2 -1
  257. package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +1 -2
  258. package/src/renderer/__tests__/e2e/Paths.spec.tsx +13 -11
  259. package/src/skia/__tests__/Enums.spec.ts +24 -2
  260. package/src/skia/__tests__/Path.spec.ts +2 -2
  261. package/src/skia/web/Host.ts +29 -11
  262. package/src/skia/web/JsiSkCanvas.ts +17 -17
  263. package/src/skia/web/JsiSkColorFilterFactory.ts +1 -1
  264. package/src/skia/web/JsiSkFont.ts +5 -5
  265. package/src/skia/web/JsiSkFontMgr.ts +3 -3
  266. package/src/skia/web/JsiSkImage.ts +14 -10
  267. package/src/skia/web/JsiSkImageFactory.ts +5 -5
  268. package/src/skia/web/JsiSkImageFilterFactory.ts +12 -22
  269. package/src/skia/web/JsiSkMaskFilterFactory.ts +1 -1
  270. package/src/skia/web/JsiSkPaint.ts +3 -3
  271. package/src/skia/web/JsiSkPath.ts +4 -4
  272. package/src/skia/web/JsiSkPathEffectFactory.ts +6 -6
  273. package/src/skia/web/JsiSkPathFactory.ts +4 -9
  274. package/src/skia/web/JsiSkPicture.ts +3 -3
  275. package/src/skia/web/JsiSkShaderFactory.ts +5 -5
  276. package/src/skia/web/JsiSkTypefaceFontProvider.ts +3 -3
  277. package/src/skia/web/JsiSkVerticesFactory.ts +1 -1
  278. package/src/skia/web/JsiSkia.ts +7 -4
  279. package/src/skia/web/JsiVideo.ts +2 -1
  280. package/src/sksg/HostConfig.ts +1 -1
  281. package/src/sksg/Recorder/Core.ts +5 -7
  282. package/src/sksg/Recorder/Player.ts +5 -6
  283. package/src/sksg/Recorder/commands/Box.ts +3 -5
  284. package/src/specs/NativeSkiaModule.web.ts +12 -2
  285. package/ios/Rnskia.xcodeproj/project.pbxproj +0 -281
  286. package/ios/Rnskia.xcworkspace/contents.xcworkspacedata +0 -7
  287. package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -19
  288. package/lib/commonjs/skia/types/Image/ColorType.web.js +0 -43
  289. package/lib/commonjs/skia/types/Image/ColorType.web.js.map +0 -1
  290. package/lib/module/skia/types/Image/ColorType.web.d.ts +0 -19
  291. package/lib/module/skia/types/Image/ColorType.web.js +0 -37
  292. package/lib/module/skia/types/Image/ColorType.web.js.map +0 -1
  293. package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -2
  294. package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +0 -1
  295. package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +0 -19
  296. package/src/skia/types/Image/ColorType.web.ts +0 -19
  297. /package/{ios/RNSkia-iOS → apple}/MetalContext.mm +0 -0
  298. /package/{ios/RNSkia-iOS → apple}/MetalWindowContext.h +0 -0
  299. /package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.h +0 -0
  300. /package/{ios → apple}/RNSkiaModule.h +0 -0
  301. /package/{ios → apple}/RNSkiaModule.mm +0 -0
  302. /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.h +0 -0
  303. /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.mm +0 -0
  304. /package/{ios/RNSkia-iOS → apple}/SkiaManager.h +0 -0
  305. /package/{ios/RNSkia-iOS → apple}/SkiaPictureView.h +0 -0
  306. /package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.h +0 -0
@@ -54,20 +54,21 @@ public:
54
54
 
55
55
  /**
56
56
  * Returns the underlying object exposed by this host object. This object
57
- * should be wrapped in a shared pointer of some kind
57
+ * should be wrapped in a shared pointer of some kind.
58
+ * Throws if the object has been disposed.
58
59
  * @return Underlying object
59
60
  */
60
- T getObject() { return _object; }
61
- const T getObject() const { return _object; }
61
+ T getObject() { return validateObject(); }
62
+ const T getObject() const { return validateObject(); }
62
63
 
63
64
  /**
64
- Updates the inner object with a new version of the object.
65
+ * Updates the inner object with a new version of the object.
65
66
  */
66
67
  void setObject(T object) { _object = object; }
67
68
 
68
69
  /**
69
- Dispose function that can be exposed to JS by using the JSI_API_TYPENAME
70
- macro
70
+ * Dispose function that can be exposed to JS by using the JSI_API_TYPENAME
71
+ * macro.
71
72
  */
72
73
  JSI_HOST_FUNCTION(dispose) {
73
74
  safeDispose();
@@ -76,12 +77,22 @@ public:
76
77
 
77
78
  protected:
78
79
  /**
79
- Override to implement disposale of allocated resources like smart pointers
80
- etc. This method will only be called once for each instance of this class.
80
+ * Override to implement disposal of allocated resources like smart pointers.
81
+ * This method will only be called once for each instance of this class.
81
82
  */
82
83
  virtual void releaseResources() = 0;
83
84
 
84
85
  private:
86
+ /**
87
+ * Validates that _object was not disposed and returns it.
88
+ */
89
+ T validateObject() const {
90
+ if (_isDisposed) {
91
+ throw std::runtime_error("Attempted to access a disposed object.");
92
+ }
93
+ return _object;
94
+ }
95
+
85
96
  void safeDispose() {
86
97
  if (!_isDisposed) {
87
98
  _isDisposed = true;
@@ -90,12 +101,12 @@ private:
90
101
  }
91
102
 
92
103
  /**
93
- * Wrapped object
104
+ * Wrapped object.
94
105
  */
95
106
  T _object;
96
107
 
97
108
  /**
98
- Resource disposed flag
109
+ * Resource disposed flag.
99
110
  */
100
111
  std::atomic<bool> _isDisposed = {false};
101
112
  };
@@ -24,19 +24,19 @@
24
24
  namespace RNSkia {
25
25
 
26
26
  namespace jsi = facebook::jsi;
27
-
28
27
  namespace para = skia::textlayout;
29
28
 
30
29
  /**
31
- Implementation of the Paragraph object in JSI
30
+ * Implementation of the Paragraph object in JSI
32
31
  */
33
- class JsiSkParagraph : public JsiSkHostObject {
32
+ class JsiSkParagraph
33
+ : public JsiSkWrappingSharedPtrHostObject<para::Paragraph> {
34
34
  public:
35
35
  EXPORT_JSI_API_TYPENAME(JsiSkParagraph, Paragraph)
36
36
 
37
37
  JSI_HOST_FUNCTION(layout) {
38
38
  auto width = getArgumentAsNumber(runtime, arguments, count, 0);
39
- _paragraph->layout(width);
39
+ getObject()->layout(width);
40
40
  return jsi::Value::undefined();
41
41
  }
42
42
 
@@ -45,34 +45,34 @@ public:
45
45
  getArgumentAsHostObject<JsiSkCanvas>(runtime, arguments, count, 0);
46
46
  auto x = getArgumentAsNumber(runtime, arguments, count, 1);
47
47
  auto y = getArgumentAsNumber(runtime, arguments, count, 2);
48
- _paragraph->paint(jsiCanvas->getCanvas(), x, y);
48
+ getObject()->paint(jsiCanvas->getCanvas(), x, y);
49
49
  return jsi::Value::undefined();
50
50
  }
51
51
 
52
52
  JSI_HOST_FUNCTION(getHeight) {
53
- return static_cast<double>(_paragraph->getHeight());
53
+ return static_cast<double>(getObject()->getHeight());
54
54
  }
55
55
 
56
56
  JSI_HOST_FUNCTION(getMaxWidth) {
57
- return static_cast<double>(_paragraph->getMaxWidth());
57
+ return static_cast<double>(getObject()->getMaxWidth());
58
58
  }
59
59
 
60
60
  JSI_HOST_FUNCTION(getMaxIntrinsicWidth) {
61
- return static_cast<double>(_paragraph->getMaxIntrinsicWidth());
61
+ return static_cast<double>(getObject()->getMaxIntrinsicWidth());
62
62
  }
63
63
 
64
64
  JSI_HOST_FUNCTION(getMinIntrinsicWidth) {
65
- return static_cast<double>(_paragraph->getMinIntrinsicWidth());
65
+ return static_cast<double>(getObject()->getMinIntrinsicWidth());
66
66
  }
67
67
 
68
68
  JSI_HOST_FUNCTION(getLongestLine) {
69
- return static_cast<double>(_paragraph->getLongestLine());
69
+ return static_cast<double>(getObject()->getLongestLine());
70
70
  }
71
71
 
72
72
  JSI_HOST_FUNCTION(getGlyphPositionAtCoordinate) {
73
73
  auto dx = getArgumentAsNumber(runtime, arguments, count, 0);
74
74
  auto dy = getArgumentAsNumber(runtime, arguments, count, 1);
75
- auto result = _paragraph->getGlyphPositionAtCoordinate(dx, dy);
75
+ auto result = getObject()->getGlyphPositionAtCoordinate(dx, dy);
76
76
  return result.position;
77
77
  }
78
78
 
@@ -80,8 +80,8 @@ public:
80
80
  auto start = getArgumentAsNumber(runtime, arguments, count, 0);
81
81
  auto end = getArgumentAsNumber(runtime, arguments, count, 1);
82
82
  auto result =
83
- _paragraph->getRectsForRange(start, end, para::RectHeightStyle::kTight,
84
- para::RectWidthStyle::kTight);
83
+ getObject()->getRectsForRange(start, end, para::RectHeightStyle::kTight,
84
+ para::RectWidthStyle::kTight);
85
85
  auto returnValue = jsi::Array(runtime, result.size());
86
86
  for (size_t i = 0; i < result.size(); ++i) {
87
87
  returnValue.setValueAtIndex(
@@ -93,7 +93,7 @@ public:
93
93
 
94
94
  JSI_HOST_FUNCTION(getLineMetrics) {
95
95
  std::vector<para::LineMetrics> metrics;
96
- _paragraph->getLineMetrics(metrics);
96
+ getObject()->getLineMetrics(metrics);
97
97
  auto returnValue = jsi::Array(runtime, metrics.size());
98
98
  auto height = 0;
99
99
  for (size_t i = 0; i < metrics.size(); ++i) {
@@ -110,7 +110,7 @@ public:
110
110
 
111
111
  JSI_HOST_FUNCTION(getRectsForPlaceholders) {
112
112
  std::vector<para::TextBox> placeholderInfos =
113
- _paragraph->getRectsForPlaceholders();
113
+ getObject()->getRectsForPlaceholders();
114
114
  auto returnValue = jsi::Array(runtime, placeholderInfos.size());
115
115
  for (size_t i = 0; i < placeholderInfos.size(); ++i) {
116
116
  auto obj = jsi::Object(runtime);
@@ -124,12 +124,6 @@ public:
124
124
  return returnValue;
125
125
  }
126
126
 
127
- JSI_HOST_FUNCTION(dispose) {
128
- _paragraph = nullptr;
129
-
130
- return jsi::Value::undefined();
131
- }
132
-
133
127
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkParagraph, layout),
134
128
  JSI_EXPORT_FUNC(JsiSkParagraph, paint),
135
129
  JSI_EXPORT_FUNC(JsiSkParagraph, getMaxWidth),
@@ -146,12 +140,8 @@ public:
146
140
 
147
141
  explicit JsiSkParagraph(std::shared_ptr<RNSkPlatformContext> context,
148
142
  para::ParagraphBuilder *paragraphBuilder)
149
- : JsiSkHostObject(std::move(context)) {
150
- _paragraph = paragraphBuilder->Build();
151
- }
152
-
153
- public:
154
- std::unique_ptr<para::Paragraph> _paragraph;
143
+ : JsiSkWrappingSharedPtrHostObject<para::Paragraph>(
144
+ std::move(context), std::move(paragraphBuilder->Build())) {}
155
145
  };
156
146
 
157
147
  } // namespace RNSkia
@@ -26,7 +26,7 @@ public:
26
26
  std::move(pathEffect)) {}
27
27
 
28
28
  EXPORT_JSI_API_TYPENAME(JsiSkPathEffect, PathEffect)
29
- JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkColorFilter, dispose))
29
+ JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPathEffect, dispose))
30
30
  };
31
31
 
32
32
  } // namespace RNSkia
@@ -45,7 +45,7 @@ public:
45
45
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureFactory, MakePicture))
46
46
 
47
47
  explicit JsiSkPictureFactory(std::shared_ptr<RNSkPlatformContext> context)
48
- : JsiSkHostObject(context) {}
48
+ : JsiSkHostObject(std::move(context)) {}
49
49
  };
50
50
 
51
51
  } // namespace RNSkia
@@ -84,14 +84,22 @@ public:
84
84
  SkPoint pts[] = {p1, p2};
85
85
 
86
86
  std::vector<SkColor> colors = getColors(runtime, arguments[2]);
87
+ auto colorsSize = colors.size();
88
+ if (colorsSize < 2) {
89
+ throw std::invalid_argument("colors must have at least 2 colors");
90
+ }
87
91
  std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
92
+ if (!positions.empty() && positions.size() != colorsSize) {
93
+ throw std::invalid_argument(
94
+ "positions must be empty or have the same size as colors");
95
+ }
88
96
  auto tileMode = getTileMode(arguments, 4, count);
89
97
  auto flag = getFlag(arguments, 6, count);
90
98
  auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
91
99
 
92
100
  sk_sp<SkShader> gradient = SkGradientShader::MakeLinear(
93
- pts, colors.data(), positions.data(), static_cast<int>(colors.size()),
94
- tileMode, flag, localMatrix);
101
+ pts, colors.data(), !positions.empty() ? positions.data() : nullptr,
102
+ static_cast<int>(colorsSize), tileMode, flag, localMatrix);
95
103
  return jsi::Object::createFromHostObject(
96
104
  runtime,
97
105
  std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
@@ -103,14 +111,23 @@ public:
103
111
  auto r = arguments[1].asNumber();
104
112
 
105
113
  std::vector<SkColor> colors = getColors(runtime, arguments[2]);
114
+ auto colorsSize = colors.size();
115
+ if (colorsSize < 2) {
116
+ throw std::invalid_argument("colors must have at least 2 colors");
117
+ }
106
118
  std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
119
+ if (!positions.empty() && positions.size() != colorsSize) {
120
+ throw std::invalid_argument(
121
+ "positions must be empty or the same size as colors");
122
+ }
107
123
  auto tileMode = getTileMode(arguments, 4, count);
108
124
  auto flag = getFlag(arguments, 6, count);
109
125
  auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
110
126
 
111
127
  sk_sp<SkShader> gradient = SkGradientShader::MakeRadial(
112
- center, r, colors.data(), positions.data(),
113
- static_cast<int>(colors.size()), tileMode, flag, localMatrix);
128
+ center, r, colors.data(),
129
+ !positions.empty() ? positions.data() : nullptr,
130
+ static_cast<int>(colorsSize), tileMode, flag, localMatrix);
114
131
  return jsi::Object::createFromHostObject(
115
132
  runtime,
116
133
  std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
@@ -120,7 +137,15 @@ public:
120
137
  auto x = arguments[0].asNumber();
121
138
  auto y = arguments[1].asNumber();
122
139
  std::vector<SkColor> colors = getColors(runtime, arguments[2]);
140
+ auto colorsSize = colors.size();
141
+ if (colorsSize < 2) {
142
+ throw std::invalid_argument("colors must have at least 2 colors");
143
+ }
123
144
  std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
145
+ if (!positions.empty() && positions.size() != colorsSize) {
146
+ throw std::invalid_argument(
147
+ "positions must be empty or the same size as colors");
148
+ }
124
149
  auto tileMode = getTileMode(arguments, 4, count);
125
150
  auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
126
151
  auto flag = getFlag(arguments, 6, count);
@@ -130,8 +155,9 @@ public:
130
155
  ? 360
131
156
  : arguments[8].asNumber();
132
157
  sk_sp<SkShader> gradient = SkGradientShader::MakeSweep(
133
- x, y, colors.data(), positions.data(), static_cast<int>(colors.size()),
134
- tileMode, startAngle, endAngle, flag, localMatrix);
158
+ x, y, colors.data(), !positions.empty() ? positions.data() : nullptr,
159
+ static_cast<int>(colorsSize), tileMode, startAngle, endAngle, flag,
160
+ localMatrix);
135
161
  return jsi::Object::createFromHostObject(
136
162
  runtime,
137
163
  std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
@@ -147,14 +173,23 @@ public:
147
173
  auto endRadius = arguments[3].asNumber();
148
174
 
149
175
  std::vector<SkColor> colors = getColors(runtime, arguments[4]);
176
+ auto colorsSize = colors.size();
177
+ if (colorsSize < 2) {
178
+ throw std::invalid_argument("colors must have at least 2 colors");
179
+ }
150
180
  std::vector<SkScalar> positions = getPositions(runtime, arguments[5]);
181
+ if (!positions.empty() && positions.size() != colorsSize) {
182
+ throw std::invalid_argument(
183
+ "positions must be empty or the same size as colors");
184
+ }
151
185
  auto tileMode = getTileMode(arguments, 6, count);
152
186
  auto localMatrix = getLocalMatrix(runtime, arguments, 7, count);
153
187
  auto flag = getFlag(arguments, 8, count);
154
188
 
155
189
  sk_sp<SkShader> gradient = SkGradientShader::MakeTwoPointConical(
156
- start, startRadius, end, endRadius, colors.data(), positions.data(),
157
- static_cast<int>(colors.size()), tileMode, flag, localMatrix);
190
+ start, startRadius, end, endRadius, colors.data(),
191
+ !positions.empty() ? positions.data() : nullptr,
192
+ static_cast<int>(colorsSize), tileMode, flag, localMatrix);
158
193
 
159
194
  return jsi::Object::createFromHostObject(
160
195
  runtime,
@@ -70,6 +70,10 @@ public:
70
70
  if (count >= 3 && !arguments[2].isNull() && !arguments[2].isUndefined()) {
71
71
  auto jsiTexs = arguments[2].asObject(runtime).asArray(runtime);
72
72
  auto texsSize = jsiTexs.size(runtime);
73
+ if (texsSize != positionsSize) {
74
+ throw jsi::JSError(runtime, "The number of texture coordinates must "
75
+ "match the number of positions");
76
+ }
73
77
  texs.reserve(texsSize);
74
78
  for (int i = 0; i < texsSize; i++) {
75
79
  auto point = JsiSkPoint::fromValue(
@@ -81,6 +85,11 @@ public:
81
85
  if (count >= 4 && !arguments[3].isNull() && !arguments[3].isUndefined()) {
82
86
  auto jsiColors = arguments[3].asObject(runtime).asArray(runtime);
83
87
  auto colorsSize = jsiColors.size(runtime);
88
+ if (colorsSize != positionsSize) {
89
+ throw jsi::JSError(
90
+ runtime,
91
+ "The number of colors must match the number of positions");
92
+ }
84
93
  colors.reserve(colorsSize);
85
94
  for (int i = 0; i < colorsSize; i++) {
86
95
  SkColor color = JsiSkColor::fromValue(
@@ -132,9 +141,11 @@ public:
132
141
  // builder.indices());
133
142
  // }
134
143
  // auto vertices = builder.detach();
135
- auto vertices = SkVertices::MakeCopy(
136
- mode, positionsSize, positions.data(), texs.data(), colors.data(),
137
- indicesSize, indices.data());
144
+ auto vertices =
145
+ SkVertices::MakeCopy(mode, positionsSize, positions.data(),
146
+ texs.size() > 0 ? texs.data() : nullptr,
147
+ colors.size() > 0 ? colors.data() : nullptr,
148
+ indicesSize, indices.data());
138
149
  return jsi::Object::createFromHostObject(
139
150
  runtime,
140
151
  std::make_shared<JsiSkVertices>(context, std::move(vertices)));
@@ -874,9 +874,10 @@ public:
874
874
  }
875
875
 
876
876
  void draw(DrawingCtx *ctx) {
877
- if (props.paragraph && props.paragraph->_paragraph) {
878
- props.paragraph->_paragraph->layout(props.width);
879
- props.paragraph->_paragraph->paint(ctx->canvas, props.x, props.y);
877
+ if (props.paragraph) {
878
+ auto paragraph = props.paragraph->getObject();
879
+ paragraph->layout(props.width);
880
+ paragraph->paint(ctx->canvas, props.x, props.y);
880
881
  }
881
882
  }
882
883
  };
@@ -51,7 +51,7 @@ async_callback(void *c,
51
51
  class DawnContext {
52
52
  public:
53
53
  // TODO: remove
54
- friend class RNSkiOSPlatformContext;
54
+ friend class RNSkApplePlatformContext;
55
55
 
56
56
  DawnContext(const DawnContext &) = delete;
57
57
  DawnContext &operator=(const DawnContext &) = delete;
@@ -412,6 +412,9 @@ public:
412
412
  * If a scanline decode is in progress, scanline mode will end, requiring the client to call
413
413
  * startScanlineDecode() in order to return to decoding scanlines.
414
414
  *
415
+ * For certain codecs, reading into a smaller bitmap than the original dimensions may not
416
+ * produce correct results (e.g. animated webp).
417
+ *
415
418
  * @return Result kSuccess, or another value explaining the type of failure.
416
419
  */
417
420
  Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*);
@@ -812,6 +815,7 @@ protected:
812
815
  }
813
816
 
814
817
  virtual bool onGetGainmapCodec(SkGainmapInfo*, std::unique_ptr<SkCodec>*) { return false; }
818
+ virtual bool onGetGainmapInfo(SkGainmapInfo*) { return false; }
815
819
 
816
820
  // TODO(issues.skia.org/363544350): This API only works for JPEG images. Remove this API once
817
821
  // it is no longer used.
@@ -1053,8 +1057,9 @@ private:
1053
1057
  friend class PNGCodecGM; // for fillIncompleteImage
1054
1058
  friend class SkSampledCodec;
1055
1059
  friend class SkIcoCodec;
1056
- friend class SkAndroidCodec; // for fEncodedInfo
1057
- friend class SkPDFBitmap; // for fEncodedInfo
1060
+ friend class SkPngCodec; // for onGetGainmapCodec
1061
+ friend class SkAndroidCodec; // for handleFrameIndex
1062
+ friend class SkCodecPriv; // for fEncodedInfo
1058
1063
  };
1059
1064
 
1060
1065
  namespace SkCodecs {
@@ -74,6 +74,12 @@
74
74
  */
75
75
  //#define SK_R32_SHIFT 16
76
76
 
77
+ /* This controls how much space should be pre-allocated in an SkCanvas object
78
+ to store the SkMatrix and clip via calls to SkCanvas::save() (and balanced with
79
+ SkCanvas::restore()).
80
+ */
81
+ //#define SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT 32
82
+
77
83
  /* Determines whether to build code that supports the Ganesh GPU backend. Some classes
78
84
  that are not GPU-specific, such as SkShader subclasses, have optional code
79
85
  that is used allows them to interact with this GPU backend. If you'd like to
@@ -95,6 +101,11 @@
95
101
  //#define SK_HISTOGRAM_MEMORY_KB(name, sample)
96
102
  //#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
97
103
 
104
+ /*
105
+ * Skia can provide extensive logging of Graphite Pipeline lifetimes.
106
+ */
107
+ //#define SK_PIPELINE_LIFETIME_LOGGING
108
+
98
109
  // To use smaller but slower mipmap builder
99
110
  //#define SK_USE_DRAWING_MIPMAP_DOWNSAMPLER
100
111
 
@@ -34,6 +34,7 @@
34
34
  #include "include/private/base/SkDeque.h"
35
35
  #include "include/private/base/SkTArray.h"
36
36
 
37
+ #include <cstddef>
37
38
  #include <cstdint>
38
39
  #include <cstring>
39
40
  #include <memory>
@@ -2502,15 +2503,18 @@ private:
2502
2503
  void reset(SkDevice* device);
2503
2504
  };
2504
2505
 
2505
- // the first N recs that can fit here mean we won't call malloc
2506
- static constexpr int kMCRecSize = 96; // most recent measurement
2507
- static constexpr int kMCRecCount = 32; // common depth for save/restores
2506
+ #if defined(SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT)
2507
+ static constexpr int kMCRecCount = SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT;
2508
+ #else
2509
+ static constexpr int kMCRecCount = 32; // common depth for save/restores
2510
+ #endif
2508
2511
 
2509
- intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
2512
+ // This stack allocation of memory will be used to house the first kMCRecCount
2513
+ // layers without need to call malloc.
2514
+ alignas(MCRec) std::byte fMCRecStorage[sizeof(MCRec) * kMCRecCount];
2510
2515
 
2511
- SkDeque fMCStack;
2512
- // points to top of stack
2513
- MCRec* fMCRec;
2516
+ SkDeque fMCStack; // uses the stack memory
2517
+ MCRec* fMCRec; // points to top of stack for convenience
2514
2518
 
2515
2519
  // Installed via init()
2516
2520
  sk_sp<SkDevice> fRootDevice;
@@ -12,6 +12,7 @@
12
12
  #include "include/core/SkScalar.h"
13
13
  #include "include/core/SkTypes.h"
14
14
  #include "include/private/base/SkCPUTypes.h"
15
+ #include "include/private/base/SkTPin.h"
15
16
 
16
17
  #include <array>
17
18
  #include <cstdint>
@@ -415,6 +416,15 @@ struct SkRGBA4f {
415
416
  SkRGBA4f makeOpaque() const {
416
417
  return { fR, fG, fB, 1.0f };
417
418
  }
419
+
420
+ /**
421
+ Returns a copy of the SkRGBA4f but with the alpha component pinned to [0, 1].
422
+
423
+ @return color with pinned alpha
424
+ */
425
+ SkRGBA4f pinAlpha() const {
426
+ return { fR, fG, fB, SkTPin(fA, 0.f, 1.f) };
427
+ }
418
428
  };
419
429
 
420
430
  /** \struct SkColor4f