@shopify/react-native-skia 0.1.158 → 0.1.159

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 (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
@@ -12,6 +12,7 @@
12
12
  #include "include/core/SkColor.h"
13
13
  #include "include/core/SkImage.h"
14
14
  #include "include/core/SkImageInfo.h"
15
+ #include "include/core/SkSurfaceProps.h"
15
16
  #include "include/core/SkYUVAPixmaps.h"
16
17
 
17
18
  #include <optional>
@@ -27,6 +28,13 @@ class SkPicture;
27
28
 
28
29
  enum class GrImageTexGenPolicy : int;
29
30
 
31
+ #if SK_GRAPHITE_ENABLED
32
+ namespace skgpu::graphite {
33
+ enum class Mipmapped : bool;
34
+ class Recorder;
35
+ }
36
+ #endif
37
+
30
38
  class SK_API SkImageGenerator {
31
39
  public:
32
40
  /**
@@ -118,25 +126,13 @@ public:
118
126
  * If the generator can natively/efficiently return its pixels as a GPU image (backed by a
119
127
  * texture) this will return that image. If not, this will return NULL.
120
128
  *
121
- * This routine also supports retrieving only a subset of the pixels. That subset is specified
122
- * by the following rectangle:
123
- *
124
- * subset = SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height())
125
- *
126
- * If subset is not contained inside the generator's bounds, this returns false.
127
- *
128
- * whole = SkIRect::MakeWH(getInfo().width(), getInfo().height())
129
- * if (!whole.contains(subset)) {
130
- * return false;
131
- * }
132
- *
133
129
  * Regarding the GrRecordingContext parameter:
134
130
  *
135
131
  * It must be non-NULL. The generator should only succeed if:
136
132
  * - its internal context is the same
137
133
  * - it can somehow convert its texture into one that is valid for the provided context.
138
134
  *
139
- * If the willNeedMipMaps flag is true, the generator should try to create a TextureProxy that
135
+ * If the mipmapped parameter is kYes, the generator should try to create a TextureProxy that
140
136
  * at least has the mip levels allocated and the base layer filled in. If this is not possible,
141
137
  * the generator is allowed to return a non mipped proxy, but this will have some additional
142
138
  * overhead in later allocating mips and copying of the base layer.
@@ -145,9 +141,16 @@ public:
145
141
  * status) or whether this may (but is not required to) return a pre-existing texture that is
146
142
  * retained by the generator (kDraw).
147
143
  */
148
- GrSurfaceProxyView generateTexture(GrRecordingContext*, const SkImageInfo& info,
149
- const SkIPoint& origin, GrMipmapped, GrImageTexGenPolicy);
144
+ GrSurfaceProxyView generateTexture(GrRecordingContext*,
145
+ const SkImageInfo& info,
146
+ GrMipmapped mipmapped,
147
+ GrImageTexGenPolicy);
148
+ #endif
150
149
 
150
+ #if SK_GRAPHITE_ENABLED
151
+ sk_sp<SkImage> makeTextureImage(skgpu::graphite::Recorder*,
152
+ const SkImageInfo&,
153
+ skgpu::graphite::Mipmapped);
151
154
  #endif
152
155
 
153
156
  /**
@@ -169,7 +172,8 @@ public:
169
172
  static std::unique_ptr<SkImageGenerator> MakeFromPicture(const SkISize&, sk_sp<SkPicture>,
170
173
  const SkMatrix*, const SkPaint*,
171
174
  SkImage::BitDepth,
172
- sk_sp<SkColorSpace>);
175
+ sk_sp<SkColorSpace>,
176
+ SkSurfaceProps props = {});
173
177
 
174
178
  protected:
175
179
  static constexpr int kNeedNewImageUniqueID = 0;
@@ -186,7 +190,7 @@ protected:
186
190
  #if SK_SUPPORT_GPU
187
191
  // returns nullptr
188
192
  virtual GrSurfaceProxyView onGenerateTexture(GrRecordingContext*, const SkImageInfo&,
189
- const SkIPoint&, GrMipmapped, GrImageTexGenPolicy);
193
+ GrMipmapped, GrImageTexGenPolicy);
190
194
 
191
195
  // Most internal SkImageGenerators produce textures and views that use kTopLeft_GrSurfaceOrigin.
192
196
  // If the generator may produce textures with different origins (e.g.
@@ -195,6 +199,12 @@ protected:
195
199
  virtual GrSurfaceOrigin origin() const { return kTopLeft_GrSurfaceOrigin; }
196
200
  #endif
197
201
 
202
+ #if SK_GRAPHITE_ENABLED
203
+ virtual sk_sp<SkImage> onMakeTextureImage(skgpu::graphite::Recorder*,
204
+ const SkImageInfo&,
205
+ skgpu::graphite::Mipmapped);
206
+ #endif
207
+
198
208
  private:
199
209
  const SkImageInfo fInfo;
200
210
  const uint32_t fUniqueID;
@@ -30,6 +30,7 @@ struct SK_API SkV2 {
30
30
  friend SkV2 operator*(SkV2 v, SkScalar s) { return {v.x*s, v.y*s}; }
31
31
  friend SkV2 operator*(SkScalar s, SkV2 v) { return {v.x*s, v.y*s}; }
32
32
  friend SkV2 operator/(SkV2 v, SkScalar s) { return {v.x/s, v.y/s}; }
33
+ friend SkV2 operator/(SkScalar s, SkV2 v) { return {s/v.x, s/v.y}; }
33
34
 
34
35
  void operator+=(SkV2 v) { *this = *this + v; }
35
36
  void operator-=(SkV2 v) { *this = *this - v; }
@@ -16,6 +16,7 @@
16
16
  #include "include/core/SkRefCnt.h"
17
17
  #include "include/core/SkSpan.h"
18
18
  #include "include/core/SkString.h"
19
+ #include "include/effects/SkRuntimeEffect.h"
19
20
 
20
21
  #include <memory>
21
22
  #include <vector>
@@ -44,6 +45,10 @@ namespace SkSL { struct Program; }
44
45
  * return type is void then the interpolated position from vertex shader return is used as the local
45
46
  * coordinate. If the color variant is used it will be blended with SkShader (or SkPaint color in
46
47
  * absence of a shader) using the SkBlender provided to the SkCanvas draw call.
48
+ *
49
+ * The vertex and fragment programs may both contain uniforms. Uniforms with the same name are
50
+ * assumed to be shared between stages. It is an error to specify uniforms in the vertex and
51
+ * fragment program with the same name but different types, dimensionality, or layouts.
47
52
  */
48
53
  class SkMeshSpecification : public SkNVRefCnt<SkMeshSpecification> {
49
54
  public:
@@ -86,6 +91,8 @@ public:
86
91
  SkString name;
87
92
  };
88
93
 
94
+ using Uniform = SkRuntimeEffect::Uniform;
95
+
89
96
  ~SkMeshSpecification();
90
97
 
91
98
  struct Result {
@@ -134,7 +141,29 @@ public:
134
141
  sk_sp<SkColorSpace> cs,
135
142
  SkAlphaType at);
136
143
 
137
- SkSpan<const Attribute> attributes() const { return SkMakeSpan(fAttributes); }
144
+ SkSpan<const Attribute> attributes() const { return SkSpan(fAttributes); }
145
+
146
+ /**
147
+ * Combined size of all 'uniform' variables. When creating a SkMesh with this specification
148
+ * provide an SkData of this size, containing values for all of those variables. Use uniforms()
149
+ * to get the offset of each uniform within the SkData.
150
+ */
151
+ size_t uniformSize() const;
152
+
153
+ /**
154
+ * Provides info about individual uniforms including the offset into an SkData where each
155
+ * uniform value should be placed.
156
+ */
157
+ SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
158
+
159
+ /** Returns pointer to the named uniform variable's description, or nullptr if not found. */
160
+ const Uniform* findUniform(std::string_view name) const;
161
+
162
+ /** Returns pointer to the named attribute, or nullptr if not found. */
163
+ const Attribute* findAttribute(std::string_view name) const;
164
+
165
+ /** Returns pointer to the named varying, or nullptr if not found. */
166
+ const Varying* findVarying(std::string_view name) const;
138
167
 
139
168
  size_t stride() const { return fStride; }
140
169
 
@@ -158,8 +187,9 @@ private:
158
187
  SkMeshSpecification(SkSpan<const Attribute>,
159
188
  size_t,
160
189
  SkSpan<const Varying>,
161
- std::unique_ptr<SkSL::Program>,
162
- std::unique_ptr<SkSL::Program>,
190
+ std::vector<Uniform> uniforms,
191
+ std::unique_ptr<const SkSL::Program>,
192
+ std::unique_ptr<const SkSL::Program>,
163
193
  ColorType,
164
194
  bool hasLocalCoords,
165
195
  sk_sp<SkColorSpace>,
@@ -171,16 +201,17 @@ private:
171
201
  SkMeshSpecification& operator=(const SkMeshSpecification&) = delete;
172
202
  SkMeshSpecification& operator=(SkMeshSpecification&&) = delete;
173
203
 
174
- const std::vector<Attribute> fAttributes;
175
- const std::vector<Varying> fVaryings;
176
- std::unique_ptr<SkSL::Program> fVS;
177
- std::unique_ptr<SkSL::Program> fFS;
178
- size_t fStride;
179
- uint32_t fHash;
180
- ColorType fColorType;
181
- bool fHasLocalCoords;
182
- sk_sp<SkColorSpace> fColorSpace;
183
- SkAlphaType fAlphaType;
204
+ const std::vector<Attribute> fAttributes;
205
+ const std::vector<Varying> fVaryings;
206
+ const std::vector<Uniform> fUniforms;
207
+ const std::unique_ptr<const SkSL::Program> fVS;
208
+ const std::unique_ptr<const SkSL::Program> fFS;
209
+ const size_t fStride;
210
+ uint32_t fHash;
211
+ const ColorType fColorType;
212
+ const bool fHasLocalCoords;
213
+ const sk_sp<SkColorSpace> fColorSpace;
214
+ const SkAlphaType fAlphaType;
184
215
  };
185
216
 
186
217
  /**
@@ -199,11 +230,46 @@ private:
199
230
  *
200
231
  * If Make() is used the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at least
201
232
  * 3.
233
+ *
234
+ * Both Make() and MakeIndexed() take a SkData with the uniform values. See
235
+ * SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing
236
+ * uniforms into the SkData.
202
237
  */
203
238
  class SkMesh {
204
239
  public:
205
- class IndexBuffer : public SkRefCnt {};
206
- class VertexBuffer : public SkRefCnt {};
240
+ class IndexBuffer : public SkRefCnt {
241
+ public:
242
+ virtual size_t size() const = 0;
243
+
244
+ /**
245
+ * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
246
+ * at offset. Fails if offset + size > this->size() or if either offset or size is not
247
+ * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
248
+ * take it as a parameter to emphasize that the context must be used to update the data and
249
+ * thus the context must be valid for the current thread.
250
+ */
251
+ bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
252
+
253
+ private:
254
+ virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
255
+ };
256
+
257
+ class VertexBuffer : public SkRefCnt {
258
+ public:
259
+ virtual size_t size() const = 0;
260
+
261
+ /**
262
+ * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer
263
+ * at offset. Fails if offset + size > this->size() or if either offset or size is not
264
+ * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We
265
+ * take it as a parameter to emphasize that the context must be used to update the data and
266
+ * thus the context must be valid for the current thread.
267
+ */
268
+ bool update(GrDirectContext*, const void* data, size_t offset, size_t size);
269
+
270
+ private:
271
+ virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0;
272
+ };
207
273
 
208
274
  SkMesh();
209
275
  ~SkMesh();
@@ -215,29 +281,39 @@ public:
215
281
  SkMesh& operator=(SkMesh&&);
216
282
 
217
283
  /**
218
- * Makes an index buffer to be used with SkMeshes. The SkData is used to determine the
219
- * size and contents of the buffer. The buffer may be CPU- or GPU-backed depending on whether
220
- * GrDirectContext* is nullptr.
284
+ * Makes an index buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
285
+ * depending on whether GrDirectContext* is nullptr.
221
286
  *
222
- * @param GrDirectContext* If nullptr a CPU-backed object is returned that owns the SkData.
223
- * Otherwise, the data is uploaded to the GPU and a GPU-backed buffer
224
- * is returned. It may only be used to draw into SkSurfaces that
225
- * are backed by the passed GrDirectContext.
226
- * @param sk_sp<SkData> required. The data used to populate the buffer.
287
+ * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
288
+ * uploaded to the GPU and a GPU-backed buffer is returned. It may
289
+ * only be used to draw into SkSurfaces that are backed by the passed
290
+ * GrDirectContext.
291
+ * @param data The data used to populate the buffer, or nullptr to create a zero-
292
+ * initialized buffer.
293
+ * @param size Both the size of the data in 'data' and the size of the resulting
294
+ * buffer.
227
295
  */
296
+ static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, const void* data, size_t size);
297
+
298
+ /** Deprecated in favor of const void* and size_t version above. */
228
299
  static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, sk_sp<const SkData>);
229
300
 
230
301
  /**
231
- * Makes a vertex buffer to be used with SkMeshes. The SkData is used to determine the
232
- * size and contents of the buffer.The buffer may be CPU- or GPU-backed depending on whether
233
- * GrDirectContext* is nullptr.
302
+ * Makes a vertex buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
303
+ * depending on whether GrDirectContext* is nullptr.
234
304
  *
235
- * @param GrDirectContext* If nullptr a CPU-backed object is returned that owns the SkData.
236
- * Otherwise, the data is uploaded to the GPU and a GPU-backed buffer
237
- * is returned. It may only be used to draw into SkSurfaces that
238
- * are backed by the passed GrDirectContext.
239
- * @param sk_sp<SkData> required. The data used to populate the buffer.
305
+ * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
306
+ * uploaded to the GPU and a GPU-backed buffer is returned. It may
307
+ * only be used to draw into SkSurfaces that are backed by the passed
308
+ * GrDirectContext.
309
+ * @param data The data used to populate the buffer, or nullptr to create a zero-
310
+ * initialized buffer.
311
+ * @param size Both the size of the data in 'data' and the size of the resulting
312
+ * buffer.
240
313
  */
314
+ static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, const void*, size_t size);
315
+
316
+ /** Deprecated in favor of const void* and size_t version above. */
241
317
  static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, sk_sp<const SkData>);
242
318
 
243
319
  enum class Mode { kTriangles, kTriangleStrip };
@@ -247,6 +323,7 @@ public:
247
323
  sk_sp<VertexBuffer>,
248
324
  size_t vertexCount,
249
325
  size_t vertexOffset,
326
+ sk_sp<const SkData> uniforms,
250
327
  const SkRect& bounds);
251
328
 
252
329
  static SkMesh MakeIndexed(sk_sp<SkMeshSpecification>,
@@ -257,22 +334,29 @@ public:
257
334
  sk_sp<IndexBuffer>,
258
335
  size_t indexCount,
259
336
  size_t indexOffset,
337
+ sk_sp<const SkData> uniforms,
260
338
  const SkRect& bounds);
261
339
 
262
- sk_sp<SkMeshSpecification> spec() const { return fSpec; }
340
+ sk_sp<SkMeshSpecification> refSpec() const { return fSpec; }
341
+ SkMeshSpecification* spec() const { return fSpec.get(); }
263
342
 
264
343
  Mode mode() const { return fMode; }
265
344
 
266
- sk_sp<VertexBuffer> vertexBuffer() const { return fVB; }
345
+ sk_sp<VertexBuffer> refVertexBuffer() const { return fVB; }
346
+ VertexBuffer* vertexBuffer() const { return fVB.get(); }
267
347
 
268
348
  size_t vertexOffset() const { return fVOffset; }
269
349
  size_t vertexCount() const { return fVCount; }
270
350
 
271
- sk_sp<IndexBuffer> indexBuffer() const { return fIB; }
351
+ sk_sp<IndexBuffer> refIndexBuffer() const { return fIB; }
352
+ IndexBuffer* indexBuffer() const { return fIB.get(); }
272
353
 
273
354
  size_t indexOffset() const { return fIOffset; }
274
355
  size_t indexCount() const { return fICount; }
275
356
 
357
+ sk_sp<const SkData> refUniforms() const { return fUniforms; }
358
+ const SkData* uniforms() const { return fUniforms.get(); }
359
+
276
360
  SkRect bounds() const { return fBounds; }
277
361
 
278
362
  bool isValid() const;
@@ -287,6 +371,8 @@ private:
287
371
  sk_sp<VertexBuffer> fVB;
288
372
  sk_sp<IndexBuffer> fIB;
289
373
 
374
+ sk_sp<const SkData> fUniforms;
375
+
290
376
  size_t fVOffset = 0; // Must be a multiple of spec->stride()
291
377
  size_t fVCount = 0;
292
378
 
@@ -5,5 +5,5 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
  #ifndef SK_MILESTONE
8
- #define SK_MILESTONE 103
8
+ #define SK_MILESTONE 108
9
9
  #endif
@@ -22,7 +22,8 @@ public:
22
22
  SkOverdrawCanvas(SkCanvas*);
23
23
 
24
24
  void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
25
- void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override;
25
+ void onDrawGlyphRunList(
26
+ const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
26
27
  void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
27
28
  const SkPaint&) override;
28
29
  void onDrawPaint(const SkPaint&) override;
@@ -251,12 +251,14 @@ public:
251
251
 
252
252
  /** Retrieves alpha from the color used when stroking and filling.
253
253
 
254
- @return alpha ranging from zero, fully transparent, to 255, fully opaque
254
+ @return alpha ranging from zero, fully transparent, to one, fully opaque
255
255
  */
256
256
  float getAlphaf() const { return fColor4f.fA; }
257
257
 
258
258
  // Helper that scales the alpha by 255.
259
- uint8_t getAlpha() const { return sk_float_round2int(this->getAlphaf() * 255); }
259
+ uint8_t getAlpha() const {
260
+ return static_cast<uint8_t>(sk_float_round2int(this->getAlphaf() * 255));
261
+ }
260
262
 
261
263
  /** Replaces alpha, leaving RGB
262
264
  unchanged. An out of range value triggers an assert in the debug
@@ -676,6 +678,8 @@ public:
676
678
  const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
677
679
  Style style) const;
678
680
 
681
+ using sk_is_trivially_relocatable = std::true_type;
682
+
679
683
  private:
680
684
  sk_sp<SkPathEffect> fPathEffect;
681
685
  sk_sp<SkShader> fShader;
@@ -699,6 +703,15 @@ private:
699
703
  uint32_t fBitfieldsUInt;
700
704
  };
701
705
 
706
+ static_assert(::sk_is_trivially_relocatable<decltype(fPathEffect)>::value);
707
+ static_assert(::sk_is_trivially_relocatable<decltype(fShader)>::value);
708
+ static_assert(::sk_is_trivially_relocatable<decltype(fMaskFilter)>::value);
709
+ static_assert(::sk_is_trivially_relocatable<decltype(fColorFilter)>::value);
710
+ static_assert(::sk_is_trivially_relocatable<decltype(fImageFilter)>::value);
711
+ static_assert(::sk_is_trivially_relocatable<decltype(fBlender)>::value);
712
+ static_assert(::sk_is_trivially_relocatable<decltype(fColor4f)>::value);
713
+ static_assert(::sk_is_trivially_relocatable<decltype(fBitfields)>::value);
714
+
702
715
  friend class SkPaintPriv;
703
716
  };
704
717
 
@@ -1756,6 +1756,8 @@ public:
1756
1756
  */
1757
1757
  bool isValid() const;
1758
1758
 
1759
+ using sk_is_trivially_relocatable = std::true_type;
1760
+
1759
1761
  private:
1760
1762
  SkPath(sk_sp<SkPathRef>, SkPathFillType, bool isVolatile, SkPathConvexity,
1761
1763
  SkPathFirstDirection firstDirection);
@@ -1767,6 +1769,8 @@ private:
1767
1769
  uint8_t fFillType : 2;
1768
1770
  uint8_t fIsVolatile : 1;
1769
1771
 
1772
+ static_assert(::sk_is_trivially_relocatable<decltype(fPathRef)>::value);
1773
+
1770
1774
  /** Resets all fields other than fPathRef to their initial 'empty' values.
1771
1775
  * Assumes the caller has already emptied fPathRef.
1772
1776
  * On Android increments fGenerationID without reseting it.
@@ -242,7 +242,7 @@ private:
242
242
  int fIsAStart = -1; // tracks direction iff fIsA is not unknown
243
243
  bool fIsACCW = false; // tracks direction iff fIsA is not unknown
244
244
 
245
- int countVerbs() const { return fVerbs.count(); }
245
+ int countVerbs() const { return fVerbs.size(); }
246
246
 
247
247
  // called right before we add a (non-move) verb
248
248
  void ensureMove() {
@@ -240,7 +240,6 @@ private:
240
240
  friend class SkBigPicture;
241
241
  friend class SkEmptyPicture;
242
242
  friend class SkPicturePriv;
243
- template <typename> friend class SkMiniPicture;
244
243
 
245
244
  void serialize(SkWStream*, const SkSerialProcs*, class SkRefCntSet* typefaces,
246
245
  bool textBlobsOnly=false) const;
@@ -263,8 +262,6 @@ private:
263
262
  // Returns NULL if this is not an SkBigPicture.
264
263
  virtual const class SkBigPicture* asSkBigPicture() const { return nullptr; }
265
264
 
266
- friend struct SkPathCounter;
267
-
268
265
  static bool IsValidPictInfo(const struct SkPictInfo& info);
269
266
  static sk_sp<SkPicture> Forwardport(const struct SkPictInfo&,
270
267
  const class SkPictureData*,
@@ -20,7 +20,6 @@ namespace android {
20
20
 
21
21
  class SkCanvas;
22
22
  class SkDrawable;
23
- class SkMiniRecorder;
24
23
  class SkPictureRecord;
25
24
  class SkRecord;
26
25
  class SkRecorder;
@@ -106,7 +105,6 @@ private:
106
105
  sk_sp<SkBBoxHierarchy> fBBH;
107
106
  std::unique_ptr<SkRecorder> fRecorder;
108
107
  sk_sp<SkRecord> fRecord;
109
- std::unique_ptr<SkMiniRecorder> fMiniRecorder;
110
108
 
111
109
  SkPictureRecorder(SkPictureRecorder&&) = delete;
112
110
  SkPictureRecorder& operator=(SkPictureRecorder&&) = delete;
@@ -261,6 +261,25 @@ public:
261
261
  */
262
262
  SkColor getColor(int x, int y) const;
263
263
 
264
+ /** Returns pixel at (x, y) as unpremultiplied color as an SkColor4f.
265
+ Returns black with alpha if SkColorType is kAlpha_8_SkColorType.
266
+
267
+ Input is not validated: out of bounds values of x or y trigger an assert() if
268
+ built with SK_DEBUG defined; and returns undefined values or may crash if
269
+ SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or
270
+ pixel address is nullptr.
271
+
272
+ SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the
273
+ conversion to unpremultiplied color; original pixel data may have additional
274
+ precision, though this is less likely than for getColor(). Rounding errors may
275
+ occur if the underlying type has lower precision.
276
+
277
+ @param x column index, zero or greater, and less than width()
278
+ @param y row index, zero or greater, and less than height()
279
+ @return pixel converted to unpremultiplied float color
280
+ */
281
+ SkColor4f getColor4f(int x, int y) const;
282
+
264
283
  /** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
265
284
  This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
266
285
  (and more precise if the pixels store more than 8 bits per component).
@@ -13,6 +13,7 @@
13
13
  class SkBitmap;
14
14
  class SkCanvas;
15
15
  class SkMatrix;
16
+ class SkSurfaceProps;
16
17
 
17
18
  /**
18
19
  * If a client wants to control the allocation of raster layers in a canvas, it should subclass
@@ -76,7 +77,8 @@ public:
76
77
  * If rec is null, then the allocator will be called for the base-layer as well.
77
78
  */
78
79
  static std::unique_ptr<SkCanvas> MakeCanvas(std::unique_ptr<SkRasterHandleAllocator>,
79
- const SkImageInfo&, const Rec* rec = nullptr);
80
+ const SkImageInfo&, const Rec* rec = nullptr,
81
+ const SkSurfaceProps* props = nullptr);
80
82
 
81
83
  protected:
82
84
  SkRasterHandleAllocator() = default;
@@ -215,7 +215,8 @@ struct SK_API SkIRect {
215
215
  @return true if members are equal
216
216
  */
217
217
  friend bool operator==(const SkIRect& a, const SkIRect& b) {
218
- return !memcmp(&a, &b, sizeof(a));
218
+ return a.fLeft == b.fLeft && a.fTop == b.fTop &&
219
+ a.fRight == b.fRight && a.fBottom == b.fBottom;
219
220
  }
220
221
 
221
222
  /** Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not
@@ -226,7 +227,8 @@ struct SK_API SkIRect {
226
227
  @return true if members are not equal
227
228
  */
228
229
  friend bool operator!=(const SkIRect& a, const SkIRect& b) {
229
- return !(a == b);
230
+ return a.fLeft != b.fLeft || a.fTop != b.fTop ||
231
+ a.fRight != b.fRight || a.fBottom != b.fBottom;
230
232
  }
231
233
 
232
234
  /** Sets SkIRect to (0, 0, 0, 0).
@@ -783,7 +785,7 @@ struct SK_API SkRect {
783
785
 
784
786
  @return midpoint on x-axis
785
787
  */
786
- SkScalar centerX() const {
788
+ constexpr SkScalar centerX() const {
787
789
  // don't use SkScalarHalf(fLeft + fBottom) as that might overflow before the 0.5
788
790
  return SkScalarHalf(fLeft) + SkScalarHalf(fRight);
789
791
  }
@@ -793,11 +795,16 @@ struct SK_API SkRect {
793
795
 
794
796
  @return midpoint on y-axis
795
797
  */
796
- SkScalar centerY() const {
798
+ constexpr SkScalar centerY() const {
797
799
  // don't use SkScalarHalf(fTop + fBottom) as that might overflow before the 0.5
798
800
  return SkScalarHalf(fTop) + SkScalarHalf(fBottom);
799
801
  }
800
802
 
803
+ /** Returns the point this->centerX(), this->centerY().
804
+ @return rectangle center
805
+ */
806
+ constexpr SkPoint center() const { return {this->centerX(), this->centerY()}; }
807
+
801
808
  /** Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are
802
809
  equal to the corresponding members in b.
803
810
 
@@ -9,6 +9,7 @@
9
9
  #define SkRefCnt_DEFINED
10
10
 
11
11
  #include "include/core/SkTypes.h"
12
+ #include "include/private/SkTemplates.h"
12
13
 
13
14
  #include <atomic> // std::atomic, std::memory_order_*
14
15
  #include <cstddef> // std::nullptr_t
@@ -211,8 +212,17 @@ private:
211
212
  * This can be used for classes inheriting from SkRefCnt, but it also works for other
212
213
  * classes that match the interface, but have different internal choices: e.g. the hosted class
213
214
  * may have its ref/unref be thread-safe, but that is not assumed/imposed by sk_sp.
215
+ *
216
+ * Declared with the trivial_abi attribute where supported so that sk_sp and types containing it
217
+ * may be considered as trivially relocatable by the compiler so that destroying-move operations
218
+ * i.e. move constructor followed by destructor can be optimized to memcpy.
214
219
  */
215
- template <typename T> class sk_sp {
220
+ #if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::trivial_abi)
221
+ #define SK_SP_TRIVIAL_ABI [[clang::trivial_abi]]
222
+ #else
223
+ #define SK_SP_TRIVIAL_ABI
224
+ #endif
225
+ template <typename T> class SK_SP_TRIVIAL_ABI sk_sp {
216
226
  public:
217
227
  using element_type = T;
218
228
 
@@ -327,6 +337,8 @@ public:
327
337
  swap(fPtr, that.fPtr);
328
338
  }
329
339
 
340
+ using sk_is_trivially_relocatable = std::true_type;
341
+
330
342
  private:
331
343
  T* fPtr;
332
344
  };
@@ -9,6 +9,7 @@
9
9
  #define SkRegion_DEFINED
10
10
 
11
11
  #include "include/core/SkRect.h"
12
+ #include "include/private/SkTemplates.h"
12
13
 
13
14
  class SkPath;
14
15
  class SkRgnBuilder;
@@ -606,6 +607,8 @@ public:
606
607
  */
607
608
  size_t readFromMemory(const void* buffer, size_t length);
608
609
 
610
+ using sk_is_trivially_relocatable = std::true_type;
611
+
609
612
  private:
610
613
  static constexpr int kOpCount = kReplace_Op + 1;
611
614
 
@@ -629,6 +632,9 @@ private:
629
632
  SkIRect fBounds;
630
633
  RunHead* fRunHead;
631
634
 
635
+ static_assert(::sk_is_trivially_relocatable<decltype(fBounds)>::value);
636
+ static_assert(::sk_is_trivially_relocatable<decltype(fRunHead)>::value);
637
+
632
638
  void freeRuns();
633
639
 
634
640
  /**