@shopify/react-native-skia 0.1.158 → 0.1.159

Sign up to get free protection for your applications and to get access to all the features.
Files changed (403) hide show
  1. package/android/CMakeLists.txt +35 -11
  2. package/android/build.gradle +21 -25
  3. package/android/cpp/jni/JniLoad.cpp +2 -0
  4. package/android/cpp/jni/include/JniSkiaDomView.h +89 -0
  5. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -3
  6. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +4 -3
  7. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +2 -1
  8. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +45 -0
  9. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +64 -0
  10. package/cpp/api/JsiSkHostObjects.h +6 -0
  11. package/cpp/api/JsiSkImageFilterFactory.h +1 -1
  12. package/cpp/api/JsiSkPaint.h +9 -2
  13. package/cpp/api/JsiSkPath.h +1 -0
  14. package/cpp/api/JsiSkRuntimeEffect.h +36 -36
  15. package/cpp/jsi/JsiHostObject.cpp +16 -28
  16. package/cpp/jsi/JsiHostObject.h +127 -7
  17. package/cpp/jsi/JsiValue.cpp +346 -0
  18. package/cpp/jsi/JsiValue.h +222 -0
  19. package/cpp/jsi/JsiValueWrapper.h +33 -5
  20. package/cpp/rnskia/RNSkDomView.cpp +220 -0
  21. package/cpp/rnskia/RNSkDomView.h +140 -0
  22. package/cpp/rnskia/RNSkJsView.cpp +0 -4
  23. package/cpp/rnskia/RNSkJsView.h +6 -4
  24. package/cpp/rnskia/RNSkManager.cpp +7 -0
  25. package/cpp/rnskia/RNSkPictureView.h +5 -8
  26. package/cpp/rnskia/RNSkView.h +113 -5
  27. package/cpp/rnskia/dom/JsiDomApi.h +167 -0
  28. package/cpp/rnskia/dom/base/BaseNodeProp.h +72 -0
  29. package/cpp/rnskia/dom/base/DerivedNodeProp.h +187 -0
  30. package/cpp/rnskia/dom/base/DrawingContext.cpp +227 -0
  31. package/cpp/rnskia/dom/base/DrawingContext.h +136 -0
  32. package/cpp/rnskia/dom/base/JsiDependencyManager.h +294 -0
  33. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +176 -0
  34. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +50 -0
  35. package/cpp/rnskia/dom/base/JsiDomNode.h +361 -0
  36. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +267 -0
  37. package/cpp/rnskia/dom/base/NodeProp.h +130 -0
  38. package/cpp/rnskia/dom/base/NodePropsContainer.h +119 -0
  39. package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +38 -0
  40. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +112 -0
  41. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +78 -0
  42. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +104 -0
  43. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +33 -0
  44. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +38 -0
  45. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +192 -0
  46. package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +123 -0
  47. package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +42 -0
  48. package/cpp/rnskia/dom/nodes/JsiFillNode.h +22 -0
  49. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +56 -0
  50. package/cpp/rnskia/dom/nodes/JsiGroupNode.h +26 -0
  51. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +415 -0
  52. package/cpp/rnskia/dom/nodes/JsiImageNode.h +34 -0
  53. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +44 -0
  54. package/cpp/rnskia/dom/nodes/JsiLayerNode.h +64 -0
  55. package/cpp/rnskia/dom/nodes/JsiLineNode.h +43 -0
  56. package/cpp/rnskia/dom/nodes/JsiOvalNode.h +34 -0
  57. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +77 -0
  58. package/cpp/rnskia/dom/nodes/JsiPatchNode.h +54 -0
  59. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +315 -0
  60. package/cpp/rnskia/dom/nodes/JsiPathNode.h +181 -0
  61. package/cpp/rnskia/dom/nodes/JsiPictureNode.h +32 -0
  62. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +51 -0
  63. package/cpp/rnskia/dom/nodes/JsiRRectNode.h +34 -0
  64. package/cpp/rnskia/dom/nodes/JsiRectNode.h +34 -0
  65. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +517 -0
  66. package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +47 -0
  67. package/cpp/rnskia/dom/nodes/JsiTextNode.h +54 -0
  68. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +32 -0
  69. package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +43 -0
  70. package/cpp/rnskia/dom/props/BezierProps.h +63 -0
  71. package/cpp/rnskia/dom/props/BlendModeProp.h +101 -0
  72. package/cpp/rnskia/dom/props/BoxShadowProps.h +61 -0
  73. package/cpp/rnskia/dom/props/CircleProp.h +46 -0
  74. package/cpp/rnskia/dom/props/ClipProp.h +62 -0
  75. package/cpp/rnskia/dom/props/ColorProp.h +80 -0
  76. package/cpp/rnskia/dom/props/DrawingProp.h +33 -0
  77. package/cpp/rnskia/dom/props/FontProp.h +34 -0
  78. package/cpp/rnskia/dom/props/GlyphsProp.h +53 -0
  79. package/cpp/rnskia/dom/props/ImageProps.h +173 -0
  80. package/cpp/rnskia/dom/props/LayerProp.h +50 -0
  81. package/cpp/rnskia/dom/props/MatrixProp.h +33 -0
  82. package/cpp/rnskia/dom/props/NumbersProp.h +63 -0
  83. package/cpp/rnskia/dom/props/PaintProps.h +172 -0
  84. package/cpp/rnskia/dom/props/PathProp.h +55 -0
  85. package/cpp/rnskia/dom/props/PictureProp.h +38 -0
  86. package/cpp/rnskia/dom/props/PointProp.h +72 -0
  87. package/cpp/rnskia/dom/props/PointsProp.h +83 -0
  88. package/cpp/rnskia/dom/props/RRectProp.h +134 -0
  89. package/cpp/rnskia/dom/props/RadiusProp.h +43 -0
  90. package/cpp/rnskia/dom/props/RectProp.h +118 -0
  91. package/cpp/rnskia/dom/props/StrokeProps.h +75 -0
  92. package/cpp/rnskia/dom/props/SvgProp.h +37 -0
  93. package/cpp/rnskia/dom/props/TextBlobProp.h +128 -0
  94. package/cpp/rnskia/dom/props/TileModeProp.h +50 -0
  95. package/cpp/rnskia/dom/props/TransformProp.h +80 -0
  96. package/cpp/rnskia/dom/props/TransformsProps.h +68 -0
  97. package/cpp/rnskia/dom/props/UniformsProp.h +194 -0
  98. package/cpp/rnskia/dom/props/VertexModeProp.h +47 -0
  99. package/cpp/rnskia/dom/props/VerticesProps.h +67 -0
  100. package/cpp/rnskia/values/RNSkReadonlyValue.h +13 -4
  101. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +35 -1
  102. package/cpp/skia/include/codec/SkAndroidCodec.h +17 -1
  103. package/cpp/skia/include/codec/SkCodec.h +8 -5
  104. package/cpp/skia/include/core/SkAnnotation.h +2 -0
  105. package/cpp/skia/include/core/SkBitmap.h +52 -1
  106. package/cpp/skia/include/core/SkBlendMode.h +2 -0
  107. package/cpp/skia/include/core/SkCanvas.h +52 -31
  108. package/cpp/skia/include/core/SkCapabilities.h +44 -0
  109. package/cpp/skia/include/core/SkColor.h +7 -0
  110. package/cpp/skia/include/core/SkColorFilter.h +37 -0
  111. package/cpp/skia/include/core/SkColorSpace.h +1 -1
  112. package/cpp/skia/include/core/SkFont.h +4 -0
  113. package/cpp/skia/include/core/SkFontMgr.h +3 -0
  114. package/cpp/skia/include/core/SkGraphics.h +9 -0
  115. package/cpp/skia/include/core/SkImage.h +77 -17
  116. package/cpp/skia/include/core/SkImageEncoder.h +5 -3
  117. package/cpp/skia/include/core/SkImageGenerator.h +27 -17
  118. package/cpp/skia/include/core/SkM44.h +1 -0
  119. package/cpp/skia/include/core/SkMesh.h +120 -34
  120. package/cpp/skia/include/core/SkMilestone.h +1 -1
  121. package/cpp/skia/include/core/SkOverdrawCanvas.h +2 -1
  122. package/cpp/skia/include/core/SkPaint.h +15 -2
  123. package/cpp/skia/include/core/SkPath.h +4 -0
  124. package/cpp/skia/include/core/SkPathBuilder.h +1 -1
  125. package/cpp/skia/include/core/SkPicture.h +0 -3
  126. package/cpp/skia/include/core/SkPictureRecorder.h +0 -2
  127. package/cpp/skia/include/core/SkPixmap.h +19 -0
  128. package/cpp/skia/include/core/SkRasterHandleAllocator.h +3 -1
  129. package/cpp/skia/include/core/SkRect.h +11 -4
  130. package/cpp/skia/include/core/SkRefCnt.h +13 -1
  131. package/cpp/skia/include/core/SkRegion.h +6 -0
  132. package/cpp/skia/include/core/SkSamplingOptions.h +8 -6
  133. package/cpp/skia/include/core/SkScalar.h +6 -25
  134. package/cpp/skia/include/core/SkShader.h +20 -12
  135. package/cpp/skia/include/core/SkSpan.h +51 -19
  136. package/cpp/skia/include/core/SkStream.h +2 -2
  137. package/cpp/skia/include/core/SkString.h +11 -3
  138. package/cpp/skia/include/core/SkSurface.h +85 -8
  139. package/cpp/skia/include/core/SkTextBlob.h +5 -2
  140. package/cpp/skia/include/core/SkTypes.h +11 -10
  141. package/cpp/skia/include/docs/SkPDFDocument.h +0 -5
  142. package/cpp/skia/include/effects/Sk1DPathEffect.h +6 -1
  143. package/cpp/skia/include/effects/Sk2DPathEffect.h +4 -1
  144. package/cpp/skia/include/effects/SkColorMatrix.h +1 -0
  145. package/cpp/skia/include/effects/SkColorMatrixFilter.h +5 -8
  146. package/cpp/skia/include/effects/SkCornerPathEffect.h +5 -1
  147. package/cpp/skia/include/effects/SkDashPathEffect.h +5 -1
  148. package/cpp/skia/include/effects/SkGradientShader.h +68 -38
  149. package/cpp/skia/include/effects/SkHighContrastFilter.h +5 -1
  150. package/cpp/skia/include/effects/SkImageFilters.h +5 -4
  151. package/cpp/skia/include/effects/SkLumaColorFilter.h +4 -1
  152. package/cpp/skia/include/effects/SkOpPathEffect.h +6 -2
  153. package/cpp/skia/include/effects/SkOverdrawColorFilter.h +5 -2
  154. package/cpp/skia/include/effects/SkRuntimeEffect.h +54 -62
  155. package/cpp/skia/include/effects/SkShaderMaskFilter.h +3 -1
  156. package/cpp/skia/include/effects/SkTableColorFilter.h +8 -21
  157. package/cpp/skia/include/effects/SkTableMaskFilter.h +5 -1
  158. package/cpp/skia/include/effects/SkTrimPathEffect.h +5 -1
  159. package/cpp/skia/include/encode/SkEncoder.h +17 -0
  160. package/cpp/skia/include/encode/SkWebpEncoder.h +17 -0
  161. package/cpp/skia/include/gpu/GpuTypes.h +18 -0
  162. package/cpp/skia/include/gpu/GrBackendSurface.h +38 -17
  163. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -71
  164. package/cpp/skia/include/gpu/GrContextOptions.h +1 -1
  165. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +10 -9
  166. package/cpp/skia/include/gpu/GrDirectContext.h +42 -22
  167. package/cpp/skia/include/gpu/GrRecordingContext.h +6 -3
  168. package/cpp/skia/include/gpu/GrTypes.h +11 -11
  169. package/cpp/skia/include/gpu/MutableTextureState.h +122 -0
  170. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -0
  171. package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -0
  172. package/cpp/skia/include/gpu/graphite/BackendTexture.h +7 -0
  173. package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +195 -0
  174. package/cpp/skia/include/gpu/graphite/Context.h +47 -55
  175. package/cpp/skia/include/gpu/graphite/ContextOptions.h +85 -0
  176. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -17
  177. package/cpp/skia/include/gpu/graphite/ImageProvider.h +61 -0
  178. package/cpp/skia/include/gpu/graphite/Recorder.h +87 -8
  179. package/cpp/skia/include/gpu/graphite/Recording.h +19 -9
  180. package/cpp/skia/include/gpu/graphite/TextureInfo.h +40 -8
  181. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +25 -0
  182. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +3 -2
  183. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +69 -0
  184. package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +39 -0
  185. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +21 -19
  186. package/cpp/skia/include/gpu/vk/GrVkExtensions.h +2 -50
  187. package/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +2 -127
  188. package/cpp/skia/include/gpu/vk/GrVkTypes.h +5 -43
  189. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +46 -0
  190. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +67 -0
  191. package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +116 -0
  192. package/cpp/skia/include/gpu/vk/VulkanTypes.h +59 -0
  193. package/cpp/skia/include/pathops/SkPathOps.h +1 -1
  194. package/cpp/skia/include/private/SkColorData.h +10 -40
  195. package/cpp/skia/include/private/SkEncodedInfo.h +9 -3
  196. package/cpp/skia/include/private/SkFloatingPoint.h +9 -6
  197. package/cpp/skia/include/private/SkHalf.h +5 -52
  198. package/cpp/skia/include/private/SkMacros.h +1 -1
  199. package/cpp/skia/include/private/SkMalloc.h +4 -0
  200. package/cpp/skia/include/private/SkPathRef.h +10 -10
  201. package/cpp/skia/include/private/SkSLModifiers.h +59 -23
  202. package/cpp/skia/include/private/SkSLProgramKind.h +1 -0
  203. package/cpp/skia/include/private/SkSLSymbol.h +7 -3
  204. package/cpp/skia/include/private/SkStringView.h +4 -0
  205. package/cpp/skia/include/private/SkTArray.h +21 -7
  206. package/cpp/skia/include/private/SkTDArray.h +173 -285
  207. package/cpp/skia/include/private/SkTHash.h +33 -32
  208. package/cpp/skia/include/private/SkTemplates.h +24 -26
  209. package/cpp/skia/include/private/SkVx.h +218 -135
  210. package/cpp/skia/include/private/chromium/GrSlug.h +3 -65
  211. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +6 -3
  212. package/cpp/skia/include/private/chromium/Slug.h +76 -0
  213. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -1
  214. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +5 -39
  215. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +63 -0
  216. package/cpp/skia/include/{gpu/vk/GrVkVulkan.h → private/gpu/vk/SkiaVulkan.h} +2 -2
  217. package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +57 -0
  218. package/cpp/skia/include/sksl/DSL.h +0 -1
  219. package/cpp/skia/include/sksl/DSLBlock.h +4 -18
  220. package/cpp/skia/include/sksl/DSLCase.h +2 -8
  221. package/cpp/skia/include/sksl/DSLCore.h +8 -15
  222. package/cpp/skia/include/sksl/DSLExpression.h +51 -142
  223. package/cpp/skia/include/sksl/DSLFunction.h +7 -15
  224. package/cpp/skia/include/sksl/DSLModifiers.h +5 -2
  225. package/cpp/skia/include/sksl/DSLStatement.h +4 -39
  226. package/cpp/skia/include/sksl/DSLSymbols.h +1 -11
  227. package/cpp/skia/include/sksl/DSLType.h +20 -12
  228. package/cpp/skia/include/sksl/DSLVar.h +56 -146
  229. package/cpp/skia/include/sksl/SkSLErrorReporter.h +2 -15
  230. package/cpp/skia/include/sksl/SkSLOperator.h +62 -59
  231. package/cpp/skia/include/sksl/SkSLPosition.h +2 -0
  232. package/cpp/skia/include/sksl/SkSLVersion.h +27 -0
  233. package/cpp/skia/include/svg/SkSVGCanvas.h +1 -0
  234. package/cpp/skia/include/utils/SkAnimCodecPlayer.h +1 -1
  235. package/cpp/skia/include/utils/SkBase64.h +2 -0
  236. package/cpp/skia/include/utils/SkCustomTypeface.h +24 -11
  237. package/cpp/skia/include/utils/SkEventTracer.h +12 -1
  238. package/cpp/skia/include/utils/SkNWayCanvas.h +11 -4
  239. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +9 -4
  240. package/cpp/skia/include/utils/SkParse.h +3 -0
  241. package/cpp/skia/include/utils/SkShadowUtils.h +2 -0
  242. package/cpp/skia/include/utils/SkTextUtils.h +2 -1
  243. package/cpp/skia/{include/third_party → modules}/skcms/skcms.h +10 -0
  244. package/cpp/skia/modules/skcms/skcms_internal.h +56 -0
  245. package/cpp/skia/modules/skcms/src/Transform_inl.h +1609 -0
  246. package/cpp/skia/modules/skparagraph/include/DartTypes.h +153 -0
  247. package/cpp/skia/modules/skparagraph/include/FontArguments.h +46 -0
  248. package/cpp/skia/modules/skparagraph/include/FontCollection.h +84 -0
  249. package/cpp/skia/modules/skparagraph/include/Metrics.h +98 -0
  250. package/cpp/skia/modules/skparagraph/include/Paragraph.h +111 -0
  251. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +69 -0
  252. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +77 -0
  253. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +143 -0
  254. package/cpp/skia/modules/skparagraph/include/TextShadow.h +30 -0
  255. package/cpp/skia/modules/skparagraph/include/TextStyle.h +352 -0
  256. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +81 -0
  257. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
  258. package/cpp/skia/modules/svg/include/SkSVGTypes.h +3 -3
  259. package/cpp/skia/src/core/SkLRUCache.h +126 -0
  260. package/cpp/skia/src/core/SkTInternalLList.h +302 -0
  261. package/cpp/utils/RNSkTimingInfo.h +1 -0
  262. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +15 -4
  263. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +40 -54
  264. package/ios/RNSkia-iOS/SkiaDomViewManager.h +8 -0
  265. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +51 -0
  266. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -56
  267. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  268. package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
  269. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  270. package/lib/commonjs/renderer/Canvas.js +19 -63
  271. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  272. package/lib/commonjs/renderer/DependencyManager.js +0 -5
  273. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  274. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  275. package/lib/commonjs/renderer/useCanvas.js +4 -18
  276. package/lib/commonjs/renderer/useCanvas.js.map +1 -1
  277. package/lib/commonjs/views/SkiaBaseWebView.js +7 -0
  278. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  279. package/lib/commonjs/views/SkiaDomView.js +152 -0
  280. package/lib/commonjs/views/SkiaDomView.js.map +1 -0
  281. package/lib/commonjs/views/SkiaDomView.web.js +55 -0
  282. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -0
  283. package/lib/commonjs/views/SkiaPictureView.js +16 -2
  284. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  285. package/lib/commonjs/views/SkiaView.js +17 -2
  286. package/lib/commonjs/views/SkiaView.js.map +1 -1
  287. package/lib/commonjs/views/index.js +13 -0
  288. package/lib/commonjs/views/index.js.map +1 -1
  289. package/lib/commonjs/views/types.js.map +1 -1
  290. package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
  291. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  292. package/lib/module/dom/nodes/RenderNode.js +1 -1
  293. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  294. package/lib/module/renderer/Canvas.js +20 -64
  295. package/lib/module/renderer/Canvas.js.map +1 -1
  296. package/lib/module/renderer/DependencyManager.js +0 -5
  297. package/lib/module/renderer/DependencyManager.js.map +1 -1
  298. package/lib/module/renderer/HostComponents.js.map +1 -1
  299. package/lib/module/renderer/useCanvas.js +2 -13
  300. package/lib/module/renderer/useCanvas.js.map +1 -1
  301. package/lib/module/views/SkiaBaseWebView.js +7 -0
  302. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  303. package/lib/module/views/SkiaDomView.js +128 -0
  304. package/lib/module/views/SkiaDomView.js.map +1 -0
  305. package/lib/module/views/SkiaDomView.web.js +41 -0
  306. package/lib/module/views/SkiaDomView.web.js.map +1 -0
  307. package/lib/module/views/SkiaPictureView.js +14 -2
  308. package/lib/module/views/SkiaPictureView.js.map +1 -1
  309. package/lib/module/views/SkiaView.js +15 -2
  310. package/lib/module/views/SkiaView.js.map +1 -1
  311. package/lib/module/views/index.js +1 -0
  312. package/lib/module/views/index.js.map +1 -1
  313. package/lib/module/views/types.js.map +1 -1
  314. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +57 -64
  315. package/lib/typescript/src/renderer/Canvas.d.ts +5 -8
  316. package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -2
  317. package/lib/typescript/src/renderer/HostComponents.d.ts +66 -3
  318. package/lib/typescript/src/renderer/useCanvas.d.ts +0 -6
  319. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +4 -0
  320. package/lib/typescript/src/views/SkiaDomView.d.ts +31 -0
  321. package/lib/typescript/src/views/SkiaDomView.web.d.ts +7 -0
  322. package/lib/typescript/src/views/index.d.ts +1 -0
  323. package/lib/typescript/src/views/types.d.ts +12 -2
  324. package/libs/android/arm64-v8a/libskia.a +0 -0
  325. package/libs/android/arm64-v8a/libskottie.a +0 -0
  326. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  327. package/libs/android/arm64-v8a/libsksg.a +0 -0
  328. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  329. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  330. package/libs/android/arm64-v8a/libsvg.a +0 -0
  331. package/libs/android/armeabi-v7a/libskia.a +0 -0
  332. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  333. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  334. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  335. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  336. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  337. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  338. package/libs/android/x86/libskia.a +0 -0
  339. package/libs/android/x86/libskottie.a +0 -0
  340. package/libs/android/x86/libskparagraph.a +0 -0
  341. package/libs/android/x86/libsksg.a +0 -0
  342. package/libs/android/x86/libskshaper.a +0 -0
  343. package/libs/android/x86/libskunicode.a +0 -0
  344. package/libs/android/x86/libsvg.a +0 -0
  345. package/libs/android/x86_64/libskia.a +0 -0
  346. package/libs/android/x86_64/libskottie.a +0 -0
  347. package/libs/android/x86_64/libskparagraph.a +0 -0
  348. package/libs/android/x86_64/libsksg.a +0 -0
  349. package/libs/android/x86_64/libskshaper.a +0 -0
  350. package/libs/android/x86_64/libskunicode.a +0 -0
  351. package/libs/android/x86_64/libsvg.a +0 -0
  352. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  353. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  354. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  355. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  356. package/libs/ios/libskparagraph.xcframework/Info.plist +42 -0
  357. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  358. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  359. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  360. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  361. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  362. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  363. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  364. package/libs/ios/libskunicode.xcframework/Info.plist +42 -0
  365. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  366. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  367. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  368. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  369. package/package.json +5 -3
  370. package/react-native-skia.podspec +3 -1
  371. package/src/dom/nodes/JsiSkDOM.ts +170 -56
  372. package/src/dom/nodes/RenderNode.ts +1 -1
  373. package/src/renderer/Canvas.tsx +32 -56
  374. package/src/renderer/DependencyManager.tsx +0 -5
  375. package/src/renderer/HostComponents.ts +152 -1
  376. package/src/renderer/useCanvas.ts +1 -15
  377. package/src/views/SkiaBaseWebView.tsx +4 -0
  378. package/src/views/SkiaDomView.tsx +120 -0
  379. package/src/views/SkiaDomView.web.tsx +37 -0
  380. package/src/views/SkiaPictureView.tsx +10 -2
  381. package/src/views/SkiaView.tsx +11 -3
  382. package/src/views/index.ts +1 -0
  383. package/src/views/types.ts +19 -2
  384. package/cpp/jsi/JsiSimpleValueWrapper.h +0 -99
  385. package/cpp/skia/include/c/sk_canvas.h +0 -159
  386. package/cpp/skia/include/c/sk_colorspace.h +0 -25
  387. package/cpp/skia/include/c/sk_data.h +0 -65
  388. package/cpp/skia/include/c/sk_image.h +0 -71
  389. package/cpp/skia/include/c/sk_imageinfo.h +0 -62
  390. package/cpp/skia/include/c/sk_maskfilter.h +0 -47
  391. package/cpp/skia/include/c/sk_matrix.h +0 -49
  392. package/cpp/skia/include/c/sk_paint.h +0 -145
  393. package/cpp/skia/include/c/sk_path.h +0 -102
  394. package/cpp/skia/include/c/sk_picture.h +0 -70
  395. package/cpp/skia/include/c/sk_shader.h +0 -143
  396. package/cpp/skia/include/c/sk_surface.h +0 -73
  397. package/cpp/skia/include/c/sk_types.h +0 -278
  398. package/cpp/skia/include/gpu/graphite/SkStuff.h +0 -47
  399. package/cpp/skia/include/private/SkNx.h +0 -430
  400. package/cpp/skia/include/private/SkNx_neon.h +0 -713
  401. package/cpp/skia/include/private/SkNx_sse.h +0 -823
  402. package/cpp/skia/include/sksl/DSLRuntimeEffects.h +0 -32
  403. package/cpp/skia/include/sksl/DSLWrapper.h +0 -77
@@ -765,7 +765,22 @@ public:
765
765
  kGray_8_SkColorType or kRGB_565_SkColorType, then alpha is ignored; RGB is
766
766
  treated as opaque. If colorType() is kAlpha_8_SkColorType, then RGB is ignored.
767
767
 
768
- @param c unpremultiplied color
768
+ @param c unpremultiplied color
769
+ @param colorSpace SkColorSpace of c
770
+
771
+ example: https://fiddle.skia.org/c/@Bitmap_eraseColor
772
+ */
773
+ void eraseColor(SkColor4f c, SkColorSpace* colorSpace = nullptr) const;
774
+
775
+ /** Replaces pixel values with c, interpreted as being in the sRGB SkColorSpace.
776
+ All pixels contained by bounds() are affected. If the colorType() is
777
+ kGray_8_SkColorType or kRGB_565_SkColorType, then alpha is ignored; RGB is
778
+ treated as opaque. If colorType() is kAlpha_8_SkColorType, then RGB is ignored.
779
+
780
+ Input color is ultimately converted to an SkColor4f, so eraseColor(SkColor4f c)
781
+ will have higher color resolution.
782
+
783
+ @param c unpremultiplied color.
769
784
 
770
785
  example: https://fiddle.skia.org/c/@Bitmap_eraseColor
771
786
  */
@@ -793,6 +808,25 @@ public:
793
808
  is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,
794
809
  then RGB is ignored.
795
810
 
811
+ @param c unpremultiplied color
812
+ @param area rectangle to fill
813
+ @param colorSpace SkColorSpace of c
814
+
815
+ example: https://fiddle.skia.org/c/@Bitmap_erase
816
+ */
817
+ void erase(SkColor4f c, SkColorSpace* colorSpace, const SkIRect& area) const;
818
+ void erase(SkColor4f c, const SkIRect& area) const;
819
+
820
+ /** Replaces pixel values inside area with c. interpreted as being in the sRGB
821
+ SkColorSpace. If area does not intersect bounds(), call has no effect.
822
+
823
+ If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then alpha
824
+ is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,
825
+ then RGB is ignored.
826
+
827
+ Input color is ultimately converted to an SkColor4f, so erase(SkColor4f c)
828
+ will have higher color resolution.
829
+
796
830
  @param c unpremultiplied color
797
831
  @param area rectangle to fill
798
832
 
@@ -826,6 +860,23 @@ public:
826
860
  return this->pixmap().getColor(x, y);
827
861
  }
828
862
 
863
+ /** Returns pixel at (x, y) as unpremultiplied float color.
864
+ Returns black with alpha if SkColorType is kAlpha_8_SkColorType.
865
+
866
+ Input is not validated: out of bounds values of x or y trigger an assert() if
867
+ built with SK_DEBUG defined; and returns undefined values or may crash if
868
+ SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or
869
+ pixel address is nullptr.
870
+
871
+ SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the
872
+ conversion to unpremultiplied color.
873
+
874
+ @param x column index, zero or greater, and less than width()
875
+ @param y row index, zero or greater, and less than height()
876
+ @return pixel converted to unpremultiplied color
877
+ */
878
+ SkColor4f getColor4f(int x, int y) const { return this->pixmap().getColor4f(x, y); }
879
+
829
880
  /** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
830
881
  This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
831
882
  (and more precise if the pixels store more than 8 bits per component).
@@ -73,6 +73,8 @@ enum class SkBlendMode {
73
73
  kLastMode = kLuminosity, //!< last valid value
74
74
  };
75
75
 
76
+ static constexpr int kSkBlendModeCount = static_cast<int>(SkBlendMode::kLastMode) + 1;
77
+
76
78
  /**
77
79
  * For Porter-Duff SkBlendModes (those <= kLastCoeffMode), these coefficients describe the blend
78
80
  * equation used. Coefficient-based blend modes specify an equation:
@@ -38,18 +38,20 @@
38
38
  #define SK_SUPPORT_LEGACY_GETTOTALMATRIX
39
39
  #endif
40
40
 
41
+ namespace sktext {
42
+ class GlyphRunBuilder;
43
+ class GlyphRunList;
44
+ }
45
+
41
46
  class AutoLayerForImageFilter;
42
47
  class GrBackendRenderTarget;
43
48
  class GrRecordingContext;
44
- class GrSlug;
45
49
  class SkBaseDevice;
46
50
  class SkBitmap;
47
51
  class SkData;
48
52
  class SkDrawable;
49
53
  struct SkDrawShadowRec;
50
54
  class SkFont;
51
- class SkGlyphRunBuilder;
52
- class SkGlyphRunList;
53
55
  class SkImage;
54
56
  class SkImageFilter;
55
57
  class SkPaintFilterCanvas;
@@ -67,8 +69,14 @@ class SkTextBlob;
67
69
  class SkVertices;
68
70
 
69
71
  namespace skgpu::graphite { class Recorder; }
72
+ namespace sktext::gpu { class Slug; }
70
73
  namespace SkRecords { class Draw; }
71
74
 
75
+ // TODO:
76
+ // This is not ideal but Chrome is depending on a forward decl of GrSlug here.
77
+ // It should be removed once Chrome has migrated to sktext::gpu::Slug.
78
+ using GrSlug = sktext::gpu::Slug;
79
+
72
80
  /** \class SkCanvas
73
81
  SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
74
82
  SkCanvas contains a stack of SkMatrix and clip values.
@@ -255,10 +263,27 @@ public:
255
263
  @param props storage for writable SkSurfaceProps
256
264
  @return true if SkSurfaceProps was copied
257
265
 
266
+ DEPRECATED: Replace usage with getBaseProps() or getTopProps()
267
+
258
268
  example: https://fiddle.skia.org/c/@Canvas_getProps
259
269
  */
260
270
  bool getProps(SkSurfaceProps* props) const;
261
271
 
272
+ /** Returns the SkSurfaceProps associated with the canvas (i.e., at the base of the layer
273
+ stack).
274
+
275
+ @return base SkSurfaceProps
276
+ */
277
+ SkSurfaceProps getBaseProps() const;
278
+
279
+ /** Returns the SkSurfaceProps associated with the canvas that are currently active (i.e., at
280
+ the top of the layer stack). This can differ from getBaseProps depending on the flags
281
+ passed to saveLayer (see SaveLayerFlagsSet).
282
+
283
+ @return SkSurfaceProps active in the current/top layer
284
+ */
285
+ SkSurfaceProps getTopProps() const;
286
+
262
287
  /** Triggers the immediate execution of all pending draw operations.
263
288
  If SkCanvas is associated with GPU surface, resolves all pending GPU operations.
264
289
  If SkCanvas is associated with raster surface, has no effect; raster draw
@@ -566,14 +591,14 @@ public:
566
591
  */
567
592
  int save();
568
593
 
569
- /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
570
- Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
594
+ /** Saves SkMatrix and clip, and allocates a SkSurface for subsequent drawing.
595
+ Calling restore() discards changes to SkMatrix and clip, and draws the SkSurface.
571
596
 
572
597
  SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
573
598
  setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
574
599
  clipPath(), clipRegion().
575
600
 
576
- SkRect bounds suggests but does not define the SkBitmap size. To clip drawing to
601
+ SkRect bounds suggests but does not define the SkSurface size. To clip drawing to
577
602
  a specific rectangle, use clipRect().
578
603
 
579
604
  Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and
@@ -590,8 +615,8 @@ public:
590
615
  */
591
616
  int saveLayer(const SkRect* bounds, const SkPaint* paint);
592
617
 
593
- /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
594
- Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
618
+ /** Saves SkMatrix and clip, and allocates a SkSurface for subsequent drawing.
619
+ Calling restore() discards changes to SkMatrix and clip, and draws the SkSurface.
595
620
 
596
621
  SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
597
622
  setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -613,7 +638,7 @@ public:
613
638
  return this->saveLayer(&bounds, paint);
614
639
  }
615
640
 
616
- /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
641
+ /** Saves SkMatrix and clip, and allocates SkSurface for subsequent drawing.
617
642
 
618
643
  Calling restore() discards changes to SkMatrix and clip,
619
644
  and blends layer with alpha opacity onto prior layer.
@@ -721,10 +746,10 @@ public:
721
746
  SkScalar fExperimentalBackdropScale = 1.f;
722
747
  };
723
748
 
724
- /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
749
+ /** Saves SkMatrix and clip, and allocates SkSurface for subsequent drawing.
725
750
 
726
751
  Calling restore() discards changes to SkMatrix and clip,
727
- and blends SkBitmap with alpha opacity onto the prior layer.
752
+ and blends SkSurface with alpha opacity onto the prior layer.
728
753
 
729
754
  SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
730
755
  setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -1956,7 +1981,7 @@ public:
1956
1981
  */
1957
1982
  void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint);
1958
1983
 
1959
- #if defined(SK_ENABLE_EXPERIMENTAL_CUSTOM_MESH) && defined(SK_ENABLE_SKSL)
1984
+ #if defined(SK_ENABLE_SKSL)
1960
1985
  /**
1961
1986
  Experimental, under active development, and subject to change without notice.
1962
1987
 
@@ -2171,7 +2196,7 @@ protected:
2171
2196
  virtual bool onPeekPixels(SkPixmap* pixmap);
2172
2197
  virtual bool onAccessTopLayerPixels(SkPixmap* pixmap);
2173
2198
  virtual SkImageInfo onImageInfo() const;
2174
- virtual bool onGetProps(SkSurfaceProps* props) const;
2199
+ virtual bool onGetProps(SkSurfaceProps* props, bool top) const;
2175
2200
  virtual void onFlush();
2176
2201
 
2177
2202
  // Subclass save/restore notifiers.
@@ -2198,11 +2223,6 @@ protected:
2198
2223
  virtual void didTranslate(SkScalar, SkScalar) {}
2199
2224
  virtual void didScale(SkScalar, SkScalar) {}
2200
2225
 
2201
- #ifndef SK_ENABLE_EXPERIMENTAL_CUSTOM_MESH
2202
- // Define this in protected so we can still access internally for testing.
2203
- void drawMesh(const SkMesh& mesh, sk_sp<SkBlender> blender, const SkPaint& paint);
2204
- #endif
2205
-
2206
2226
  // NOTE: If you are adding a new onDraw virtual to SkCanvas, PLEASE add an override to
2207
2227
  // SkCanvasVirtualEnforcer (in SkCanvasVirtualEnforcer.h). This ensures that subclasses using
2208
2228
  // that mechanism will be required to implement the new function.
@@ -2220,7 +2240,7 @@ protected:
2220
2240
  virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
2221
2241
  const SkPaint& paint);
2222
2242
 
2223
- virtual void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint);
2243
+ virtual void onDrawGlyphRunList(const sktext::GlyphRunList& glyphRunList, const SkPaint& paint);
2224
2244
 
2225
2245
  virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
2226
2246
  const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint);
@@ -2270,15 +2290,15 @@ protected:
2270
2290
 
2271
2291
  virtual void onDiscard();
2272
2292
 
2273
- #if SK_SUPPORT_GPU
2293
+ #if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED))
2274
2294
  /** Experimental
2275
2295
  */
2276
- virtual sk_sp<GrSlug> onConvertGlyphRunListToSlug(
2277
- const SkGlyphRunList& glyphRunList, const SkPaint& paint);
2296
+ virtual sk_sp<sktext::gpu::Slug> onConvertGlyphRunListToSlug(
2297
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint);
2278
2298
 
2279
2299
  /** Experimental
2280
2300
  */
2281
- virtual void onDrawSlug(const GrSlug* slug);
2301
+ virtual void onDrawSlug(const sktext::gpu::Slug* slug);
2282
2302
  #endif
2283
2303
 
2284
2304
  private:
@@ -2413,24 +2433,25 @@ protected:
2413
2433
  SkCanvas(const SkIRect& bounds);
2414
2434
  private:
2415
2435
  SkCanvas(const SkBitmap&, std::unique_ptr<SkRasterHandleAllocator>,
2416
- SkRasterHandleAllocator::Handle);
2436
+ SkRasterHandleAllocator::Handle, const SkSurfaceProps* props);
2417
2437
 
2418
2438
  SkCanvas(SkCanvas&&) = delete;
2419
2439
  SkCanvas(const SkCanvas&) = delete;
2420
2440
  SkCanvas& operator=(SkCanvas&&) = delete;
2421
2441
  SkCanvas& operator=(const SkCanvas&) = delete;
2422
2442
 
2423
- #if SK_SUPPORT_GPU
2424
- friend class GrSlug;
2443
+ #if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED))
2444
+ friend class sktext::gpu::Slug;
2425
2445
  /** Experimental
2426
- * Convert a SkTextBlob to a GrSlug using the current canvas state.
2446
+ * Convert a SkTextBlob to a sktext::gpu::Slug using the current canvas state.
2427
2447
  */
2428
- sk_sp<GrSlug> convertBlobToSlug(const SkTextBlob& blob, SkPoint origin, const SkPaint& paint);
2448
+ sk_sp<sktext::gpu::Slug> convertBlobToSlug(const SkTextBlob& blob, SkPoint origin,
2449
+ const SkPaint& paint);
2429
2450
 
2430
2451
  /** Experimental
2431
- * Draw an GrSlug given the current canvas state.
2452
+ * Draw an sktext::gpu::Slug given the current canvas state.
2432
2453
  */
2433
- void drawSlug(const GrSlug* slug);
2454
+ void drawSlug(const sktext::gpu::Slug* slug);
2434
2455
  #endif
2435
2456
 
2436
2457
  /** Experimental
@@ -2534,7 +2555,7 @@ private:
2534
2555
  class AutoUpdateQRBounds;
2535
2556
  void validateClip() const;
2536
2557
 
2537
- std::unique_ptr<SkGlyphRunBuilder> fScratchGlyphRunBuilder;
2558
+ std::unique_ptr<sktext::GlyphRunBuilder> fScratchGlyphRunBuilder;
2538
2559
 
2539
2560
  using INHERITED = SkRefCnt;
2540
2561
  };
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright 2022 Google LLC
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SkCapabilities_DEFINED
9
+ #define SkCapabilities_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ #ifdef SK_ENABLE_SKSL
14
+ #include "include/sksl/SkSLVersion.h"
15
+ namespace SkSL { struct ShaderCaps; }
16
+ #endif
17
+
18
+ #if defined(SK_GRAPHITE_ENABLED)
19
+ namespace skgpu::graphite { class Caps; }
20
+ #endif
21
+
22
+ class SK_API SkCapabilities : public SkRefCnt {
23
+ public:
24
+ static sk_sp<const SkCapabilities> RasterBackend();
25
+
26
+ #ifdef SK_ENABLE_SKSL
27
+ SkSL::Version skslVersion() const { return fSkSLVersion; }
28
+ #endif
29
+
30
+ protected:
31
+ #if defined(SK_GRAPHITE_ENABLED)
32
+ friend class skgpu::graphite::Caps; // for ctor
33
+ #endif
34
+
35
+ SkCapabilities() = default;
36
+
37
+ #ifdef SK_ENABLE_SKSL
38
+ void initSkCaps(const SkSL::ShaderCaps*);
39
+
40
+ SkSL::Version fSkSLVersion = SkSL::Version::k100;
41
+ #endif
42
+ };
43
+
44
+ #endif
@@ -405,6 +405,11 @@ struct SkRGBA4f {
405
405
  uint32_t toBytes_RGBA() const;
406
406
  static SkRGBA4f FromBytes_RGBA(uint32_t color);
407
407
 
408
+ /**
409
+ Returns a copy of the SkRGBA4f but with alpha component set to 1.0f.
410
+
411
+ @return opaque color
412
+ */
408
413
  SkRGBA4f makeOpaque() const {
409
414
  return { fR, fG, fB, 1.0f };
410
415
  }
@@ -420,6 +425,8 @@ using SkColor4f = SkRGBA4f<kUnpremul_SkAlphaType>;
420
425
 
421
426
  template <> SK_API SkColor4f SkColor4f::FromColor(SkColor);
422
427
  template <> SK_API SkColor SkColor4f::toSkColor() const;
428
+ template <> SK_API uint32_t SkColor4f::toBytes_RGBA() const;
429
+ template <> SK_API SkColor4f SkColor4f::FromBytes_RGBA(uint32_t color);
423
430
 
424
431
  namespace SkColors {
425
432
  constexpr SkColor4f kTransparent = {0, 0, 0, 0};
@@ -71,7 +71,12 @@ public:
71
71
  static sk_sp<SkColorFilter> Compose(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner) {
72
72
  return outer ? outer->makeComposed(inner) : inner;
73
73
  }
74
+
75
+ // Blends between the constant color (src) and input color (dst) based on the SkBlendMode.
76
+ // If the color space is null, the constant color is assumed to be defined in sRGB.
77
+ static sk_sp<SkColorFilter> Blend(const SkColor4f& c, sk_sp<SkColorSpace>, SkBlendMode mode);
74
78
  static sk_sp<SkColorFilter> Blend(SkColor c, SkBlendMode mode);
79
+
75
80
  static sk_sp<SkColorFilter> Matrix(const SkColorMatrix&);
76
81
  static sk_sp<SkColorFilter> Matrix(const float rowMajor[20]);
77
82
 
@@ -84,6 +89,38 @@ public:
84
89
  static sk_sp<SkColorFilter> SRGBToLinearGamma();
85
90
  static sk_sp<SkColorFilter> Lerp(float t, sk_sp<SkColorFilter> dst, sk_sp<SkColorFilter> src);
86
91
 
92
+ /**
93
+ * Create a table colorfilter, copying the table into the filter, and
94
+ * applying it to all 4 components.
95
+ * a' = table[a];
96
+ * r' = table[r];
97
+ * g' = table[g];
98
+ * b' = table[b];
99
+ * Components are operated on in unpremultiplied space. If the incomming
100
+ * colors are premultiplied, they are temporarily unpremultiplied, then
101
+ * the table is applied, and then the result is remultiplied.
102
+ */
103
+ static sk_sp<SkColorFilter> Table(const uint8_t table[256]);
104
+
105
+ /**
106
+ * Create a table colorfilter, with a different table for each
107
+ * component [A, R, G, B]. If a given table is NULL, then it is
108
+ * treated as identity, with the component left unchanged. If a table
109
+ * is not null, then its contents are copied into the filter.
110
+ */
111
+ static sk_sp<SkColorFilter> TableARGB(const uint8_t tableA[256],
112
+ const uint8_t tableR[256],
113
+ const uint8_t tableG[256],
114
+ const uint8_t tableB[256]);
115
+
116
+ /**
117
+ * Create a colorfilter that multiplies the RGB channels by one color, and
118
+ * then adds a second color, pinning the result for each component to
119
+ * [0..255]. The alpha components of the mul and add arguments
120
+ * are ignored.
121
+ */
122
+ static sk_sp<SkColorFilter> Lighting(SkColor mul, SkColor add);
123
+
87
124
  private:
88
125
  SkColorFilters() = delete;
89
126
  };
@@ -11,7 +11,7 @@
11
11
  #include "include/core/SkRefCnt.h"
12
12
  #include "include/private/SkFixed.h"
13
13
  #include "include/private/SkOnce.h"
14
- #include "include/third_party/skcms/skcms.h"
14
+ #include "modules/skcms/skcms.h"
15
15
  #include <memory>
16
16
 
17
17
  class SkData;
@@ -498,6 +498,8 @@ public:
498
498
  */
499
499
  void dump() const;
500
500
 
501
+ using sk_is_trivially_relocatable = std::true_type;
502
+
501
503
  private:
502
504
  enum PrivFlags {
503
505
  kForceAutoHinting_PrivFlag = 1 << 0,
@@ -523,6 +525,8 @@ private:
523
525
  uint8_t fEdging;
524
526
  uint8_t fHinting;
525
527
 
528
+ static_assert(::sk_is_trivially_relocatable<decltype(fTypeface)>::value);
529
+
526
530
  SkScalar setupForAsPaths(SkPaint*);
527
531
  bool hasSomeAntiAliasing() const;
528
532
 
@@ -117,6 +117,9 @@ public:
117
117
  /** Return the default fontmgr. */
118
118
  static sk_sp<SkFontMgr> RefDefault();
119
119
 
120
+ /* Returns an empty font manager without any typeface dependencies */
121
+ static sk_sp<SkFontMgr> RefEmpty();
122
+
120
123
  protected:
121
124
  virtual int onCountFamilies() const = 0;
122
125
  virtual void onGetFamilyName(int index, SkString* familyName) const = 0;
@@ -150,6 +150,15 @@ public:
150
150
  static OpenTypeSVGDecoderFactory SetOpenTypeSVGDecoderFactory(OpenTypeSVGDecoderFactory);
151
151
  static OpenTypeSVGDecoderFactory GetOpenTypeSVGDecoderFactory();
152
152
 
153
+ /**
154
+ * Temporarily (until variable COLRv1 is released) pass a feature switch function for whether
155
+ * variable COLRv1 is enabled. Needed for initializing FreeType with a property setting so that
156
+ * variable COLRv1 can be enabled in Chrome Canaries during development.
157
+ */
158
+ using VariableColrV1EnabledFunc = bool (*)();
159
+ static VariableColrV1EnabledFunc SetVariableColrV1EnabledFunc(VariableColrV1EnabledFunc);
160
+ static bool GetVariableColrV1Enabled();
161
+
153
162
  /**
154
163
  * Call early in main() to allow Skia to use a JIT to accelerate CPU-bound operations.
155
164
  */
@@ -13,11 +13,12 @@
13
13
  #include "include/core/SkSamplingOptions.h"
14
14
  #include "include/core/SkScalar.h"
15
15
  #include "include/core/SkShader.h"
16
+ #include "include/core/SkSurfaceProps.h"
16
17
  #include "include/core/SkTileMode.h"
17
18
  #if SK_SUPPORT_GPU
18
19
  #include "include/gpu/GrTypes.h"
19
20
  #endif
20
- #if SK_GRAPHITE_ENABLED
21
+ #if defined(SK_GRAPHITE_ENABLED)
21
22
  #include "include/gpu/graphite/GraphiteTypes.h"
22
23
  #endif
23
24
  #include <functional> // std::function
@@ -49,8 +50,9 @@ class SkYUVAPixmaps;
49
50
 
50
51
  enum class SkEncodedImageFormat;
51
52
 
52
- #if SK_GRAPHITE_ENABLED
53
+ #if defined(SK_GRAPHITE_ENABLED)
53
54
  namespace skgpu::graphite {
55
+ class BackendTexture;
54
56
  class Recorder;
55
57
  };
56
58
  #endif
@@ -253,12 +255,13 @@ public:
253
255
  @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr
254
256
  @param bitDepth 8-bit integer or 16-bit float: per component
255
257
  @param colorSpace range of colors; may be nullptr
258
+ @param props props to use when rasterizing the picture
256
259
  @return created SkImage, or nullptr
257
260
  */
258
261
  static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
259
262
  const SkMatrix* matrix, const SkPaint* paint,
260
- BitDepth bitDepth,
261
- sk_sp<SkColorSpace> colorSpace);
263
+ BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace,
264
+ SkSurfaceProps props = {});
262
265
 
263
266
  #if SK_SUPPORT_GPU
264
267
  /** Creates a GPU-backed SkImage from compressed data.
@@ -942,6 +945,36 @@ public:
942
945
  kRepeatedCubic,
943
946
  };
944
947
 
948
+ /** Makes image pixel data available to caller, possibly asynchronously.
949
+
950
+ Currently asynchronous reads are only supported on the GPU backend and only when the
951
+ underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all
952
+ other cases this operates synchronously.
953
+
954
+ Data is read from the source sub-rectangle, then converted to the color space, color type,
955
+ and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the image
956
+ causes failure.
957
+
958
+ When the pixel data is ready the caller's ReadPixelsCallback is called with a
959
+ AsyncReadResult containing pixel data in the requested color type, alpha type, and color
960
+ space. The AsyncReadResult will have count() == 1. Upon failure the callback is called with
961
+ nullptr for AsyncReadResult. For a GPU image this flushes work but a submit must occur to
962
+ guarantee a finite time before the callback is called.
963
+
964
+ The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage
965
+ is GPU-backed the data is immediately invalidated if the context is abandoned or
966
+ destroyed.
967
+
968
+ @param info info of the requested pixels
969
+ @param srcRect subrectangle of image to read
970
+ @param callback function to call with result of the read
971
+ @param context passed to callback
972
+ */
973
+ void asyncReadPixels(const SkImageInfo& info,
974
+ const SkIRect& srcRect,
975
+ ReadPixelsCallback callback,
976
+ ReadPixelsContext context) const;
977
+
945
978
  /** Makes image pixel data available to caller, possibly asynchronously. It can also rescale
946
979
  the image pixels.
947
980
 
@@ -1143,30 +1176,57 @@ public:
1143
1176
  GrMipmapped = GrMipmapped::kNo,
1144
1177
  SkBudgeted = SkBudgeted::kYes) const;
1145
1178
  #endif
1179
+
1146
1180
  #ifdef SK_GRAPHITE_ENABLED
1181
+ /** Creates an SkImage from a GPU texture associated with the recorder.
1182
+
1183
+ SkImage is returned if the format of backendTexture is recognized and supported.
1184
+ Recognized formats vary by GPU back-end.
1185
+
1186
+ @param recorder The recorder
1187
+ @param backendTexture texture residing on GPU
1188
+ @param colorSpace This describes the color space of this image's contents, as
1189
+ seen after sampling. In general, if the format of the backend
1190
+ texture is SRGB, some linear colorSpace should be supplied
1191
+ (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the
1192
+ backend texture is linear, then the colorSpace should include
1193
+ a description of the transfer function as
1194
+ well (e.g., SkColorSpace::MakeSRGB()).
1195
+ @return created SkImage, or nullptr
1196
+ */
1197
+ static sk_sp<SkImage> MakeGraphiteFromBackendTexture(skgpu::graphite::Recorder*,
1198
+ const skgpu::graphite::BackendTexture&,
1199
+ SkColorType colorType,
1200
+ SkAlphaType alphaType,
1201
+ sk_sp<SkColorSpace> colorSpace);
1202
+
1203
+ struct RequiredImageProperties {
1204
+ skgpu::graphite::Mipmapped fMipmapped;
1205
+ };
1206
+
1147
1207
  /** Graphite version of makeTextureImage.
1148
1208
 
1149
- Returns SkImage backed by GPU texture, using Recorder for creation and uploads if necessary.
1150
- The returned SkImage respects mipmapped setting for non-GPU SkImages; if mipmapped
1151
- equals GrMipmapped::kYes, the backing texture allocates mip map levels.
1209
+ Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation
1210
+ and uploads if necessary. The returned SkImage respects the required image properties'
1211
+ mipmap setting for non-Graphite SkImages; i.e., if mipmapping is required, the backing
1212
+ Graphite texture will have allocated mip map levels.
1152
1213
 
1153
1214
  It is assumed that MIP maps are always supported by the GPU.
1154
1215
 
1155
- Returns original SkImage if the image is already texture-backed, the recorder matches, and
1156
- mipmapped is compatible with the backing GPU texture. If mipmapped is not compatible,
1157
- it will return nullptr.
1216
+ Returns original SkImage if the image is already Graphite-backed and the required mipmapping
1217
+ is compatible with the backing Graphite texture. If the required mipmapping is not
1218
+ compatible, nullptr will be returned.
1158
1219
 
1159
- Returns nullptr if recorder is nullptr, or if SkImage was created with another
1220
+ Returns nullptr if no Recorder is provided, or if SkImage was created with another
1160
1221
  Recorder and work on that Recorder has not been submitted.
1161
1222
 
1162
- @param Recorder the Recorder to use for storing commands
1163
- @param Mipmapped whether created SkImage texture must allocate mip map levels
1164
- @return created SkImage, or nullptr
1223
+ @param Recorder the Recorder to use for storing commands
1224
+ @param RequiredImageProperties properties the returned SkImage must possess (e.g.,
1225
+ mipmaps)
1226
+ @return created SkImage, or nullptr
1165
1227
  */
1166
1228
  sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
1167
- skgpu::graphite::Mipmapped = skgpu::graphite::Mipmapped::kNo,
1168
- SkBudgeted = SkBudgeted::kYes) const;
1169
-
1229
+ RequiredImageProperties = {}) const;
1170
1230
  #endif
1171
1231
 
1172
1232
  /** Returns raster image or lazy image. Copies SkImage backed by GPU texture into
@@ -8,12 +8,14 @@
8
8
  #ifndef SkImageEncoder_DEFINED
9
9
  #define SkImageEncoder_DEFINED
10
10
 
11
- #include "include/core/SkData.h"
12
11
  #include "include/core/SkEncodedImageFormat.h"
13
- #include "include/core/SkPixmap.h"
14
- #include "include/core/SkStream.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkTypes.h"
15
14
 
16
15
  class SkBitmap;
16
+ class SkData;
17
+ class SkPixmap;
18
+ class SkWStream;
17
19
 
18
20
  /**
19
21
  * Encode SkPixmap in the given binary image format.