@shopify/react-native-skia 2.5.5 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/android/CMakeLists.txt +0 -1
  2. package/android/cpp/jni/JniWebGPUView.cpp +3 -3
  3. package/android/cpp/rnskia-android/OpenGLContext.h +4 -5
  4. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
  5. package/apple/MetalContext.h +5 -6
  6. package/apple/MetalWindowContext.mm +3 -4
  7. package/apple/RNSkApplePlatformContext.h +1 -1
  8. package/apple/RNSkApplePlatformContext.mm +4 -3
  9. package/apple/SkiaCVPixelBufferUtils.h +1 -1
  10. package/apple/SkiaCVPixelBufferUtils.mm +31 -30
  11. package/apple/SkiaPlatformContext.mm +2 -2
  12. package/apple/SkiaUIView.mm +1 -1
  13. package/apple/SkiaWebGPUView.mm +8 -4
  14. package/apple/WebGPUMetalView.h +1 -1
  15. package/apple/WebGPUMetalView.mm +1 -1
  16. package/cpp/api/CustomBlendModes.h +1 -0
  17. package/cpp/api/JsiSkApi.h +4 -0
  18. package/cpp/api/JsiSkCanvas.h +2 -2
  19. package/cpp/api/JsiSkColor.h +8 -4
  20. package/cpp/api/JsiSkContourMeasure.h +4 -3
  21. package/cpp/api/JsiSkContourMeasureIter.h +1 -1
  22. package/cpp/api/JsiSkImage.h +17 -9
  23. package/cpp/api/JsiSkParagraphBuilder.h +14 -1
  24. package/cpp/api/JsiSkPath.h +475 -357
  25. package/cpp/api/JsiSkPathBuilder.h +415 -0
  26. package/cpp/api/JsiSkPathBuilderFactory.h +53 -0
  27. package/cpp/api/JsiSkPathEffectFactory.h +3 -2
  28. package/cpp/api/JsiSkPathFactory.h +287 -20
  29. package/cpp/api/JsiSkShader.h +1 -1
  30. package/cpp/api/JsiSkShaderFactory.h +50 -26
  31. package/cpp/api/JsiSkSurfaceFactory.h +2 -1
  32. package/cpp/api/recorder/DataTypes.h +1 -1
  33. package/cpp/api/recorder/Drawings.h +11 -9
  34. package/cpp/api/recorder/Shaders.h +77 -22
  35. package/cpp/jsi2/JSIConverter.h +1 -1
  36. package/cpp/rnskia/RNDawnContext.h +29 -9
  37. package/cpp/rnskia/RNDawnUtils.h +112 -113
  38. package/cpp/rnskia/RNDawnWindowContext.h +1 -1
  39. package/cpp/rnskia/RNSkManager.cpp +5 -4
  40. package/cpp/rnskia/RNSkPlatformContext.h +2 -2
  41. package/cpp/rnwgpu/api/GPU.cpp +21 -0
  42. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -1
  43. package/cpp/rnwgpu/api/GPUCanvasContext.h +2 -2
  44. package/cpp/rnwgpu/api/GPUFeatures.h +0 -9
  45. package/cpp/rnwgpu/api/GPUTexture.h +14 -2
  46. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +3 -4
  47. package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
  48. package/cpp/rnwgpu/api/descriptors/Unions.h +0 -15
  49. package/cpp/skia/include/android/SkImageAndroid.h +7 -2
  50. package/cpp/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
  51. package/cpp/skia/include/codec/SkCodec.h +42 -15
  52. package/cpp/skia/include/config/SkUserConfig.h +8 -0
  53. package/cpp/skia/include/core/SkBitmap.h +0 -5
  54. package/cpp/skia/include/core/SkCanvas.h +2 -39
  55. package/cpp/skia/include/core/SkColor.h +12 -0
  56. package/cpp/skia/include/core/SkColorSpace.h +9 -0
  57. package/cpp/skia/include/core/SkContourMeasure.h +1 -5
  58. package/cpp/skia/include/core/SkData.h +8 -0
  59. package/cpp/skia/include/core/SkFont.h +1 -55
  60. package/cpp/skia/include/core/SkFontArguments.h +15 -0
  61. package/cpp/skia/include/core/SkGraphics.h +0 -5
  62. package/cpp/skia/include/core/SkImage.h +0 -4
  63. package/cpp/skia/include/core/SkImageGenerator.h +1 -4
  64. package/cpp/skia/include/core/SkMatrix.h +0 -37
  65. package/cpp/skia/include/core/SkMilestone.h +1 -1
  66. package/cpp/skia/include/core/SkPath.h +11 -911
  67. package/cpp/skia/include/core/SkPathBuilder.h +42 -32
  68. package/cpp/skia/include/core/SkPathEffect.h +0 -9
  69. package/cpp/skia/include/core/SkPathMeasure.h +1 -4
  70. package/cpp/skia/include/core/SkPathUtils.h +0 -10
  71. package/cpp/skia/include/core/SkRect.h +0 -12
  72. package/cpp/skia/include/core/SkRegion.h +1 -6
  73. package/cpp/skia/include/core/SkSerialProcs.h +4 -5
  74. package/cpp/skia/include/core/SkSurfaceProps.h +6 -0
  75. package/cpp/skia/include/core/SkTextBlob.h +0 -22
  76. package/cpp/skia/include/core/SkTypeface.h +14 -32
  77. package/cpp/skia/include/core/SkTypes.h +0 -8
  78. package/cpp/skia/include/docs/SkPDFDocument.h +19 -17
  79. package/cpp/skia/include/effects/SkDashPathEffect.h +0 -6
  80. package/cpp/skia/include/effects/SkGradient.h +206 -0
  81. package/cpp/skia/include/effects/SkHighContrastFilter.h +2 -2
  82. package/cpp/skia/include/gpu/GpuTypes.h +2 -0
  83. package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +5 -35
  84. package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +7 -106
  85. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +0 -11
  86. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -9
  87. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
  88. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
  89. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
  90. package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +4 -1
  91. package/cpp/skia/include/gpu/graphite/ContextOptions.h +4 -20
  92. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +32 -46
  93. package/cpp/skia/include/gpu/graphite/Recorder.h +1 -1
  94. package/cpp/skia/include/gpu/graphite/Surface.h +31 -0
  95. package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -10
  96. package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +3 -3
  97. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -1
  98. package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +6 -6
  99. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +5 -3
  100. package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +1 -1
  101. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
  102. package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +8 -0
  103. package/cpp/skia/include/private/SkEncodedInfo.h +43 -105
  104. package/cpp/skia/include/private/SkHdrMetadata.h +165 -2
  105. package/cpp/skia/include/private/SkPathRef.h +0 -457
  106. package/cpp/skia/include/private/base/SkFeatures.h +4 -0
  107. package/cpp/skia/include/private/base/SkFloatingPoint.h +1 -2
  108. package/cpp/skia/include/private/base/SkLoadUserConfig.h +2 -1
  109. package/cpp/skia/include/private/base/SkLog.h +68 -0
  110. package/cpp/skia/include/private/base/SkLogPriority.h +35 -0
  111. package/cpp/skia/include/private/base/SkMacros.h +9 -0
  112. package/cpp/skia/include/private/base/SkTArray.h +1 -1
  113. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +10 -24
  114. package/cpp/skia/include/utils/SkEventTracer.h +5 -7
  115. package/cpp/skia/modules/skottie/include/TextShaper.h +0 -7
  116. package/cpp/skia/modules/skparagraph/include/FontCollection.h +6 -20
  117. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +0 -6
  118. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +4 -19
  119. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -3
  120. package/cpp/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
  121. package/cpp/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
  122. package/cpp/skia/src/base/SkMathPriv.h +27 -132
  123. package/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
  124. package/lib/commonjs/animation/functions/interpolatePaths.js +5 -4
  125. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  126. package/lib/commonjs/external/reanimated/interpolators.d.ts +11 -2
  127. package/lib/commonjs/external/reanimated/interpolators.js +21 -4
  128. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  129. package/lib/commonjs/skia/types/Path/PathBuilder.d.ts +201 -0
  130. package/lib/commonjs/skia/types/Path/PathBuilder.js +6 -0
  131. package/lib/commonjs/skia/types/Path/PathBuilder.js.map +1 -0
  132. package/lib/commonjs/skia/types/Path/PathBuilderFactory.d.ts +13 -0
  133. package/lib/commonjs/skia/types/Path/PathBuilderFactory.js +6 -0
  134. package/lib/commonjs/skia/types/Path/PathBuilderFactory.js.map +1 -0
  135. package/lib/commonjs/skia/types/Path/PathFactory.d.ts +87 -1
  136. package/lib/commonjs/skia/types/Path/PathFactory.js.map +1 -1
  137. package/lib/commonjs/skia/types/Path/index.d.ts +2 -0
  138. package/lib/commonjs/skia/types/Path/index.js +22 -0
  139. package/lib/commonjs/skia/types/Path/index.js.map +1 -1
  140. package/lib/commonjs/skia/types/Skia.d.ts +2 -1
  141. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  142. package/lib/commonjs/skia/web/Host.js +1 -3
  143. package/lib/commonjs/skia/web/Host.js.map +1 -1
  144. package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -2
  145. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  146. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +4 -1
  147. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  148. package/lib/commonjs/skia/web/JsiSkPath.d.ts +42 -30
  149. package/lib/commonjs/skia/web/JsiSkPath.js +302 -111
  150. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  151. package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +45 -0
  152. package/lib/commonjs/skia/web/JsiSkPathBuilder.js +192 -0
  153. package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -0
  154. package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
  155. package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.js +26 -0
  156. package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.js.map +1 -0
  157. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +6 -2
  158. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  159. package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +13 -1
  160. package/lib/commonjs/skia/web/JsiSkPathFactory.js +140 -5
  161. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  162. package/lib/commonjs/skia/web/JsiSkia.js +8 -1
  163. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  164. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +18 -6
  165. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  166. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
  167. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js +2 -3
  168. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  169. package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +2 -2
  170. package/lib/commonjs/specs/WebGPUViewNativeComponent.js +2 -3
  171. package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +1 -1
  172. package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +2 -0
  173. package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +1 -1
  174. package/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
  175. package/lib/module/animation/functions/interpolatePaths.js +5 -4
  176. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  177. package/lib/module/external/reanimated/interpolators.d.ts +11 -2
  178. package/lib/module/external/reanimated/interpolators.js +21 -4
  179. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  180. package/lib/module/skia/types/Path/PathBuilder.d.ts +201 -0
  181. package/lib/module/skia/types/Path/PathBuilder.js +2 -0
  182. package/lib/module/skia/types/Path/PathBuilder.js.map +1 -0
  183. package/lib/module/skia/types/Path/PathBuilderFactory.d.ts +13 -0
  184. package/lib/module/skia/types/Path/PathBuilderFactory.js +2 -0
  185. package/lib/module/skia/types/Path/PathBuilderFactory.js.map +1 -0
  186. package/lib/module/skia/types/Path/PathFactory.d.ts +87 -1
  187. package/lib/module/skia/types/Path/PathFactory.js.map +1 -1
  188. package/lib/module/skia/types/Path/index.d.ts +2 -0
  189. package/lib/module/skia/types/Path/index.js +2 -0
  190. package/lib/module/skia/types/Path/index.js.map +1 -1
  191. package/lib/module/skia/types/Skia.d.ts +2 -1
  192. package/lib/module/skia/types/Skia.js.map +1 -1
  193. package/lib/module/skia/web/Host.js +1 -3
  194. package/lib/module/skia/web/Host.js.map +1 -1
  195. package/lib/module/skia/web/JsiSkCanvas.js +6 -2
  196. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  197. package/lib/module/skia/web/JsiSkContourMeasure.js +4 -1
  198. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  199. package/lib/module/skia/web/JsiSkPath.d.ts +42 -30
  200. package/lib/module/skia/web/JsiSkPath.js +300 -110
  201. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkPathBuilder.d.ts +45 -0
  203. package/lib/module/skia/web/JsiSkPathBuilder.js +186 -0
  204. package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -0
  205. package/lib/module/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
  206. package/lib/module/skia/web/JsiSkPathBuilderFactory.js +19 -0
  207. package/lib/module/skia/web/JsiSkPathBuilderFactory.js.map +1 -0
  208. package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -2
  209. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  210. package/lib/module/skia/web/JsiSkPathFactory.d.ts +13 -1
  211. package/lib/module/skia/web/JsiSkPathFactory.js +141 -6
  212. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  213. package/lib/module/skia/web/JsiSkia.js +8 -1
  214. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  215. package/lib/module/sksg/Recorder/commands/Drawing.js +18 -6
  216. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  217. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
  218. package/lib/module/specs/SkiaPictureViewNativeComponent.js +1 -1
  219. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  220. package/lib/module/specs/WebGPUViewNativeComponent.d.ts +2 -2
  221. package/lib/module/specs/WebGPUViewNativeComponent.js +1 -1
  222. package/lib/module/specs/WebGPUViewNativeComponent.js.map +1 -1
  223. package/lib/module/specs/WebGPUViewNativeComponent.web.js +2 -0
  224. package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +1 -1
  225. package/lib/typescript/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
  226. package/lib/typescript/lib/commonjs/external/reanimated/interpolators.d.ts +1 -1
  227. package/lib/typescript/lib/commonjs/skia/types/Path/PathBuilder.d.ts +1 -0
  228. package/lib/typescript/lib/commonjs/skia/types/Path/PathBuilderFactory.d.ts +1 -0
  229. package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +33 -25
  230. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +46 -0
  231. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilderFactory.d.ts +7 -0
  232. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +12 -0
  233. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
  234. package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -1
  235. package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +2 -1
  236. package/lib/typescript/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
  237. package/lib/typescript/lib/module/external/reanimated/interpolators.d.ts +1 -1
  238. package/lib/typescript/lib/module/mock/index.d.ts +1 -1
  239. package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
  240. package/lib/typescript/lib/module/skia/types/Path/PathBuilder.d.ts +1 -0
  241. package/lib/typescript/lib/module/skia/types/Path/PathBuilderFactory.d.ts +1 -0
  242. package/lib/typescript/lib/module/skia/types/Path/index.d.ts +2 -0
  243. package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +38 -25
  244. package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +45 -0
  245. package/lib/typescript/lib/module/skia/web/JsiSkPathBuilderFactory.d.ts +6 -0
  246. package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +12 -0
  247. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
  248. package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -1
  249. package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +1 -1
  250. package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +1 -1
  251. package/lib/typescript/src/external/reanimated/interpolators.d.ts +11 -2
  252. package/lib/typescript/src/skia/types/Path/PathBuilder.d.ts +201 -0
  253. package/lib/typescript/src/skia/types/Path/PathBuilderFactory.d.ts +13 -0
  254. package/lib/typescript/src/skia/types/Path/PathFactory.d.ts +87 -1
  255. package/lib/typescript/src/skia/types/Path/index.d.ts +2 -0
  256. package/lib/typescript/src/skia/types/Skia.d.ts +2 -1
  257. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +42 -30
  258. package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +45 -0
  259. package/lib/typescript/src/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
  260. package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +13 -1
  261. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
  262. package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +2 -2
  263. package/package.json +7 -6
  264. package/scripts/install-libs.js +16 -6
  265. package/src/animation/functions/interpolatePaths.ts +5 -6
  266. package/src/external/reanimated/interpolators.ts +25 -5
  267. package/src/skia/types/Path/PathBuilder.ts +303 -0
  268. package/src/skia/types/Path/PathBuilderFactory.ts +15 -0
  269. package/src/skia/types/Path/PathFactory.ts +108 -1
  270. package/src/skia/types/Path/index.ts +2 -0
  271. package/src/skia/types/Skia.ts +2 -1
  272. package/src/skia/web/Host.ts +7 -1
  273. package/src/skia/web/JsiSkCanvas.ts +6 -6
  274. package/src/skia/web/JsiSkContourMeasure.ts +4 -4
  275. package/src/skia/web/JsiSkPath.ts +451 -168
  276. package/src/skia/web/JsiSkPathBuilder.ts +293 -0
  277. package/src/skia/web/JsiSkPathBuilderFactory.ts +32 -0
  278. package/src/skia/web/JsiSkPathEffectFactory.ts +6 -2
  279. package/src/skia/web/JsiSkPathFactory.ts +231 -8
  280. package/src/skia/web/JsiSkia.ts +11 -8
  281. package/src/sksg/Recorder/commands/Drawing.ts +20 -7
  282. package/src/specs/SkiaPictureViewNativeComponent.ts +1 -2
  283. package/src/specs/WebGPUViewNativeComponent.ts +2 -2
  284. package/src/specs/WebGPUViewNativeComponent.web.ts +2 -0
  285. package/cpp/skia/include/effects/SkGradientShader.h +0 -359
  286. package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
@@ -9,6 +9,8 @@
9
9
 
10
10
  // Include this to set reasonable defaults (e.g. for SK_CPU_LENDIAN)
11
11
  #include "include/private/base/SkFeatures.h"
12
+ // Include this so that users can define the lowest active log priority in their config
13
+ #include "include/private/base/SkLogPriority.h" // IWYU pragma: keep
12
14
 
13
15
  // Allows embedders that want to disable macros that take arguments to just
14
16
  // define that symbol to be one of these
@@ -17,7 +19,6 @@
17
19
  #define SK_NOTHING_ARG3(arg1, arg2, arg3)
18
20
 
19
21
  // IWYU pragma: begin_exports
20
-
21
22
  // Note: SK_USER_CONFIG_HEADER will not work with Bazel builds and some C++ compilers.
22
23
  #if defined(SK_USER_CONFIG_HEADER)
23
24
  #include SK_USER_CONFIG_HEADER
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Copyright 2026 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 SkLog_DEFINED
9
+ #define SkLog_DEFINED
10
+
11
+ #include <cstdarg>
12
+
13
+ #include "include/private/base/SkAPI.h"
14
+ #include "include/private/base/SkAttributes.h"
15
+ #include "include/private/base/SkLoadUserConfig.h" // IWYU pragma: keep
16
+ #include "include/private/base/SkLogPriority.h"
17
+
18
+ #if !defined(SkLog)
19
+ // To be implemented per platform.
20
+ void SkLogVAList(SkLogPriority priority, const char format[], va_list args) SK_PRINTF_LIKE(2, 0);
21
+ void SK_SPI SkLog(SkLogPriority priority, const char format[], ...) SK_PRINTF_LIKE(2, 3);
22
+ #endif
23
+
24
+ /**
25
+ * TODO (b/469441457): SKGPU_GRAPHITE_LOWEST_ACTIVE_LOG_PRIORITY Was the config used to set the log
26
+ * priority, so we check for that define as well. Eventually, we should move clients using this
27
+ * define to the new one.
28
+ */
29
+ #if defined(SKGPU_GRAPHITE_LOWEST_ACTIVE_LOG_PRIORITY)
30
+ static constexpr SkLogPriority MapGraphitePriority(skgpu::graphite::LogPriority priority) {
31
+ switch (priority) {
32
+ case skgpu::graphite::LogPriority::kError: return SkLogPriority::kError;
33
+ case skgpu::graphite::LogPriority::kWarning: return SkLogPriority::kWarning;
34
+ case skgpu::graphite::LogPriority::kInfo: return SkLogPriority::kInfo;
35
+ case skgpu::graphite::LogPriority::kDebug: return SkLogPriority::kDebug;
36
+ default: return SkLogPriority::kDebug;
37
+ }
38
+ }
39
+ #define SKIA_LOWEST_ACTIVE_LOG_PRIORITY MapGraphitePriority(SKGPU_GRAPHITE_LOWEST_ACTIVE_LOG_PRIORITY)
40
+ #endif
41
+
42
+ #if !defined(SKIA_LOWEST_ACTIVE_LOG_PRIORITY)
43
+ #ifdef SK_DEBUG
44
+ #define SKIA_LOWEST_ACTIVE_LOG_PRIORITY SkLogPriority::kDebug
45
+ #else
46
+ #define SKIA_LOWEST_ACTIVE_LOG_PRIORITY SkLogPriority::kInfo
47
+ #endif
48
+ #endif
49
+
50
+ #define SKIA_LOG(priority, fmt, ...) \
51
+ do { \
52
+ if constexpr (priority <= SKIA_LOWEST_ACTIVE_LOG_PRIORITY) { \
53
+ if constexpr (priority == SkLogPriority::kFatal) { \
54
+ SK_ABORT("[skia] " fmt, ##__VA_ARGS__); \
55
+ } \
56
+ else { \
57
+ SkLog(priority, "[skia] " fmt "\n", ##__VA_ARGS__); \
58
+ } \
59
+ } \
60
+ } while (0)
61
+
62
+ #define SKIA_LOG_F(fmt, ...) SKIA_LOG(SkLogPriority::kFatal, "** ERROR ** " fmt, ##__VA_ARGS__)
63
+ #define SKIA_LOG_E(fmt, ...) SKIA_LOG(SkLogPriority::kError, "** ERROR ** " fmt, ##__VA_ARGS__)
64
+ #define SKIA_LOG_W(fmt, ...) SKIA_LOG(SkLogPriority::kWarning, "WARNING - " fmt, ##__VA_ARGS__)
65
+ #define SKIA_LOG_I(fmt, ...) SKIA_LOG(SkLogPriority::kInfo, fmt, ##__VA_ARGS__)
66
+ #define SKIA_LOG_D(fmt, ...) SKIA_LOG(SkLogPriority::kDebug, fmt, ##__VA_ARGS__)
67
+
68
+ #endif // SkLog_DEFINED
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright 2026 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 SkLogPriority_DEFINED
9
+ #define SkLogPriority_DEFINED
10
+
11
+ /**
12
+ * Note: this file may be included in clients' SkUserConfig.h files, so including any other headers
13
+ * in this file should be avoided.
14
+ */
15
+
16
+ /**
17
+ * SKIA_LOWEST_ACTIVE_LOG_PRIORITY can be defined to one of these values (in
18
+ * SkUserConfig.h) to control Skia's logging behavior.
19
+ *
20
+ * For example:
21
+ * ```
22
+ * #define SKIA_LOWEST_ACTIVE_LOG_PRIORITY SkLogPriority::kWarning
23
+ * ```
24
+ * Would cause Skia to log warnings, non-fatal errors, and fatal errors.
25
+ * However, debug logs would be omitted.
26
+ */
27
+ enum class SkLogPriority : int {
28
+ kFatal = 0,
29
+ kError = 1,
30
+ kWarning = 2,
31
+ kInfo = 3,
32
+ kDebug = 4,
33
+ };
34
+
35
+ #endif // SkLogPriority_DEFINED
@@ -28,6 +28,15 @@
28
28
 
29
29
  #define SK_MACRO_APPEND_COUNTER(name) SK_MACRO_CONCAT(name, __COUNTER__)
30
30
 
31
+ /*
32
+ * Makes a string of X, where X is expanded before conversion to a string if X itself contains
33
+ * macros.
34
+ *
35
+ * Usage: SK_MACRO_STRINGIFY(__LINE__) to make "123", where 123 is the current line number.
36
+ */
37
+ #define SK_MACRO_STRINGIFY(X) SK_MACRO_STRINGIFY_IMPL_PRIV(X)
38
+ #define SK_MACRO_STRINGIFY_IMPL_PRIV(X) #X
39
+
31
40
  ////////////////////////////////////////////////////////////////////////////////
32
41
 
33
42
  // Can be used to bracket data types that must be dense/packed, e.g. hash keys.
@@ -595,7 +595,7 @@ private:
595
595
 
596
596
  void poison() {
597
597
  #ifdef SK_SANITIZE_ADDRESS
598
- if (fData && fCapacity > fSize) {
598
+ if (fData && fCapacity > SkToUInt(fSize)) {
599
599
  // SkDebugf(" POISONING %p : %zu -> %zu\n", fData, Bytes(fSize), Bytes(fCapacity));
600
600
  sk_asan_poison_memory_region(this->end(), Bytes(fCapacity - fSize));
601
601
  fPoisoned = true;
@@ -13,6 +13,7 @@
13
13
  #include "include/core/SkRefCnt.h"
14
14
 
15
15
  #include <dxgiformat.h>
16
+ #include <memory>
16
17
 
17
18
  #include "include/gpu/ganesh/GrTypes.h"
18
19
 
@@ -31,19 +32,18 @@ struct GrD3DFenceInfo;
31
32
  // track the current D3D12_RESOURCE_STATES which can be shared with an internal GrD3DTextureResource
32
33
  // so that state updates can be seen by all users of the texture.
33
34
  struct GrD3DBackendSurfaceInfo {
34
- GrD3DBackendSurfaceInfo(const GrD3DTextureResourceInfo& info, GrD3DResourceState* state);
35
+ GrD3DBackendSurfaceInfo(const GrD3DTextureResourceInfo& info, sk_sp<GrD3DResourceState> state);
36
+ ~GrD3DBackendSurfaceInfo();
35
37
 
36
- void cleanup();
38
+ GrD3DBackendSurfaceInfo(const GrD3DBackendSurfaceInfo&);
39
+ GrD3DBackendSurfaceInfo& operator=(const GrD3DBackendSurfaceInfo&);
37
40
 
38
- GrD3DBackendSurfaceInfo& operator=(const GrD3DBackendSurfaceInfo&) = delete;
39
-
40
- // Assigns the passed in GrD3DBackendSurfaceInfo to this object. if isValid is true we will also
41
- // attempt to unref the old fLayout on this object.
42
- void assign(const GrD3DBackendSurfaceInfo&, bool isValid);
41
+ GrD3DBackendSurfaceInfo(GrD3DBackendSurfaceInfo&&);
42
+ GrD3DBackendSurfaceInfo& operator=(GrD3DBackendSurfaceInfo&&);
43
43
 
44
44
  void setResourceState(GrD3DResourceStateEnum state);
45
45
 
46
- sk_sp<GrD3DResourceState> getGrD3DResourceState() const;
46
+ sk_sp<GrD3DResourceState> getResourceState() const;
47
47
 
48
48
  GrD3DTextureResourceInfo snapTextureResourceInfo() const;
49
49
 
@@ -53,22 +53,8 @@ struct GrD3DBackendSurfaceInfo {
53
53
  #endif
54
54
 
55
55
  private:
56
- GrD3DTextureResourceInfo* fTextureResourceInfo;
57
- GrD3DResourceState* fResourceState;
58
- };
59
-
60
- struct GrD3DTextureResourceSpecHolder {
61
- public:
62
- GrD3DTextureResourceSpecHolder(const GrD3DSurfaceInfo&);
63
-
64
- void cleanup();
65
-
66
- GrD3DSurfaceInfo getSurfaceInfo(uint32_t sampleCount,
67
- uint32_t levelCount,
68
- skgpu::Protected isProtected) const;
69
-
70
- private:
71
- GrD3DTextureResourceSpec* fSpec;
56
+ std::unique_ptr<GrD3DTextureResourceInfo> fTextureResourceInfo;
57
+ sk_sp<GrD3DResourceState> fResourceState;
72
58
  };
73
59
 
74
60
  #endif
@@ -28,15 +28,13 @@ public:
28
28
  /**
29
29
  * If this is the first call to SetInstance or GetInstance then the passed instance is
30
30
  * installed and true is returned. Otherwise, false is returned. In either case ownership of the
31
- * tracer is transferred and it will be deleted when no longer needed.
31
+ * tracer is transferred.
32
32
  *
33
- * Not deleting the tracer on process exit should not cause problems as
34
- * the whole heap is about to go away with the process. This can also
35
- * improve performance by reducing the amount of work needed.
36
- *
37
- * @param leakTracer Do not delete tracer on process exit.
33
+ * On failure, the tracer is deleted; on success the tracer will be held until process exit, and
34
+ * will not have its destructor run. This avoids race conditions when using Skia from multiple
35
+ * threads in the midst of application teardown.
38
36
  */
39
- static bool SetInstance(SkEventTracer*, bool leakTracer = false);
37
+ static bool SetInstance(SkEventTracer*);
40
38
 
41
39
  /**
42
40
  * Gets the event tracer. If this is the first call to SetInstance or GetIntance then a default
@@ -185,13 +185,6 @@ public:
185
185
  static Result Shape(const SkString& text, const TextDesc& desc, const SkRect& box,
186
186
  const sk_sp<SkFontMgr>&, const sk_sp<SkShapers::Factory>&);
187
187
 
188
- #if !defined(SK_DISABLE_LEGACY_SHAPER_FACTORY)
189
- static Result Shape(const SkString& text, const TextDesc& desc, const SkPoint& point,
190
- const sk_sp<SkFontMgr>&);
191
- static Result Shape(const SkString& text, const TextDesc& desc, const SkRect& box,
192
- const sk_sp<SkFontMgr>&);
193
- #endif
194
-
195
188
  private:
196
189
  Shaper() = delete;
197
190
  };
@@ -11,7 +11,6 @@
11
11
  #include "modules/skparagraph/include/FontArguments.h"
12
12
  #include "modules/skparagraph/include/ParagraphCache.h"
13
13
  #include "modules/skparagraph/include/TextStyle.h"
14
- #include "src/core/SkTHash.h"
15
14
 
16
15
  namespace skia {
17
16
  namespace textlayout {
@@ -21,6 +20,7 @@ class Paragraph;
21
20
  class FontCollection : public SkRefCnt {
22
21
  public:
23
22
  FontCollection();
23
+ ~FontCollection() override;
24
24
 
25
25
  size_t getFontManagersCount() const;
26
26
 
@@ -36,7 +36,9 @@ public:
36
36
  std::vector<sk_sp<SkTypeface>> findTypefaces(const std::vector<SkString>& familyNames, SkFontStyle fontStyle);
37
37
  std::vector<sk_sp<SkTypeface>> findTypefaces(const std::vector<SkString>& familyNames, SkFontStyle fontStyle, const std::optional<FontArguments>& fontArgs);
38
38
 
39
- sk_sp<SkTypeface> defaultFallback(SkUnichar unicode, SkFontStyle fontStyle, const SkString& locale, const std::optional<FontArguments>& fontArgs);
39
+ sk_sp<SkTypeface> defaultFallback(SkUnichar unicode, const std::vector<SkString>& families,
40
+ SkFontStyle fontStyle, const SkString& locale,
41
+ const std::optional<FontArguments>& fontArgs);
40
42
  sk_sp<SkTypeface> defaultEmojiFallback(SkUnichar emojiStart, SkFontStyle fontStyle, const SkString& locale);
41
43
  sk_sp<SkTypeface> defaultFallback();
42
44
 
@@ -53,25 +55,9 @@ private:
53
55
 
54
56
  sk_sp<SkTypeface> matchTypeface(const SkString& familyName, SkFontStyle fontStyle);
55
57
 
56
- struct FamilyKey {
57
- FamilyKey(const std::vector<SkString>& familyNames, SkFontStyle style, const std::optional<FontArguments>& args)
58
- : fFamilyNames(familyNames), fFontStyle(style), fFontArguments(args) {}
59
-
60
- FamilyKey() {}
61
-
62
- std::vector<SkString> fFamilyNames;
63
- SkFontStyle fFontStyle;
64
- std::optional<FontArguments> fFontArguments;
65
-
66
- bool operator==(const FamilyKey& other) const;
67
-
68
- struct Hasher {
69
- size_t operator()(const FamilyKey& key) const;
70
- };
71
- };
72
-
58
+ struct FaceCache;
59
+ std::unique_ptr<FaceCache> fFaceCache;
73
60
  bool fEnableFontFallback;
74
- skia_private::THashMap<FamilyKey, std::vector<sk_sp<SkTypeface>>, FamilyKey::Hasher> fTypefaces;
75
61
  sk_sp<SkFontMgr> fDefaultFontManager;
76
62
  sk_sp<SkFontMgr> fAssetFontManager;
77
63
  sk_sp<SkFontMgr> fDynamicFontManager;
@@ -84,15 +84,9 @@ public:
84
84
  // been added, but keeping the initial ParagraphStyle.
85
85
  virtual void Reset() = 0;
86
86
 
87
- // Just until we fix all the google3 code
88
87
  static std::unique_ptr<ParagraphBuilder> make(const ParagraphStyle& style,
89
88
  sk_sp<FontCollection> fontCollection,
90
89
  sk_sp<SkUnicode> unicode);
91
-
92
- #if !defined(SK_DISABLE_LEGACY_PARAGRAPH_UNICODE)
93
- static std::unique_ptr<ParagraphBuilder> make(const ParagraphStyle& style,
94
- sk_sp<FontCollection> fontCollection);
95
- #endif
96
90
  };
97
91
  } // namespace textlayout
98
92
  } // namespace skia
@@ -3,7 +3,6 @@
3
3
  #define ParagraphCache_DEFINED
4
4
 
5
5
  #include "include/private/base/SkMutex.h"
6
- #include "src/core/SkLRUCache.h"
7
6
  #include <functional> // std::function
8
7
 
9
8
  #define PARAGRAPH_CACHE_STATS
@@ -12,8 +11,6 @@ namespace skia {
12
11
  namespace textlayout {
13
12
 
14
13
  class ParagraphImpl;
15
- class ParagraphCacheKey;
16
- class ParagraphCacheValue;
17
14
 
18
15
  class ParagraphCache {
19
16
  public:
@@ -30,8 +27,8 @@ public:
30
27
  fChecker = std::move(checker);
31
28
  }
32
29
  void printStatistics();
33
- void turnOn(bool value) { fCacheIsOn = value; }
34
- int count() { return fLRUCacheMap.count(); }
30
+ void turnOn(bool value);
31
+ int count();
35
32
 
36
33
  bool isPossiblyTextEditing(ParagraphImpl* paragraph);
37
34
 
@@ -44,21 +41,9 @@ public:
44
41
  mutable SkMutex fParagraphMutex;
45
42
  std::function<void(ParagraphImpl* impl, const char*, bool)> fChecker;
46
43
 
47
- static const int kMaxEntries = 128;
44
+ struct Cache;
45
+ std::unique_ptr<Cache> fCache;
48
46
 
49
- struct KeyHash {
50
- uint32_t operator()(const ParagraphCacheKey& key) const;
51
- };
52
-
53
- SkLRUCache<ParagraphCacheKey, std::unique_ptr<Entry>, KeyHash> fLRUCacheMap;
54
- bool fCacheIsOn;
55
- ParagraphCacheValue* fLastCachedValue;
56
-
57
- #ifdef PARAGRAPH_CACHE_STATS
58
- int fTotalRequests;
59
- int fCacheMisses;
60
- int fHashMisses; // cache hit but hash table missed
61
- #endif
62
47
  };
63
48
 
64
49
  } // namespace textlayout
@@ -7,7 +7,6 @@
7
7
  #include "include/core/SkStream.h"
8
8
  #include "include/core/SkString.h"
9
9
  #include "include/private/base/SkTArray.h"
10
- #include "src/core/SkTHash.h"
11
10
 
12
11
  #include <string>
13
12
  #include <unordered_map>
@@ -69,8 +68,8 @@ public:
69
68
  sk_sp<SkTypeface> onLegacyMakeTypeface(const char[], SkFontStyle) const override;
70
69
 
71
70
  private:
72
- skia_private::THashMap<SkString, sk_sp<TypefaceFontStyleSet>> fRegisteredFamilies;
73
- skia_private::TArray<SkString> fFamilyNames;
71
+ std::unordered_map<std::string, sk_sp<TypefaceFontStyleSet>> fRegisteredFamilies;
72
+ skia_private::TArray<std::string> fFamilyNames;
74
73
  };
75
74
 
76
75
  } // namespace textlayout
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2024 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 SkUnicode_icu_DEFINED
9
+ #define SkUnicode_icu_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "modules/skunicode/include/SkUnicode.h"
13
+
14
+ namespace SkUnicodes::ICU {
15
+ SKUNICODE_API sk_sp<SkUnicode> Make();
16
+ }
17
+
18
+ #endif //SkUnicode_icu_DEFINED
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2024 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 SkUnicode_libgrapheme_DEFINED
9
+ #define SkUnicode_libgrapheme_DEFINED
10
+
11
+ #include "modules/skunicode/include/SkUnicode.h"
12
+
13
+ #include <memory>
14
+
15
+ namespace SkUnicodes::Libgrapheme {
16
+ SKUNICODE_API sk_sp<SkUnicode> Make();
17
+ }
18
+
19
+ #endif
@@ -12,9 +12,31 @@
12
12
  #include "include/private/base/SkCPUTypes.h"
13
13
  #include "include/private/base/SkTemplates.h"
14
14
 
15
+ #include <bit>
15
16
  #include <cstddef>
16
17
  #include <cstdint>
17
18
 
19
+ /**
20
+ * Return the number of leading zero bits.
21
+ */
22
+ static constexpr int SkCLZ(uint32_t x) {
23
+ return std::countl_zero<uint32_t>(x);
24
+ }
25
+
26
+ /**
27
+ * Return the number of trailing zero bits.
28
+ */
29
+ static constexpr int SkCTZ(uint32_t x) {
30
+ return std::countr_zero<uint32_t>(x);
31
+ }
32
+
33
+ /*
34
+ * Return the number of set bits (i.e., the population count) in the provided uint32_t.
35
+ */
36
+ static constexpr int SkPopCount(uint32_t x) {
37
+ return std::popcount<uint32_t>(x);
38
+ }
39
+
18
40
  /**
19
41
  * Return the integer square root of value, with a bias of bitBias
20
42
  */
@@ -123,113 +145,6 @@ static inline unsigned SkDiv255Round(unsigned prod) {
123
145
  static inline uint32_t SkBSwap32(uint32_t v) { return __builtin_bswap32(v); }
124
146
  #endif
125
147
 
126
- /*
127
- * Return the number of set bits (i.e., the population count) in the provided uint32_t.
128
- */
129
- int SkPopCount_portable(uint32_t n);
130
-
131
- #if defined(__GNUC__) || defined(__clang__)
132
- static inline int SkPopCount(uint32_t n) {
133
- return __builtin_popcount(n);
134
- }
135
- #else
136
- static inline int SkPopCount(uint32_t n) {
137
- return SkPopCount_portable(n);
138
- }
139
- #endif
140
-
141
- /*
142
- * Return the 0-based index of the nth bit set in target
143
- * Returns 32 if there is no nth bit set.
144
- */
145
- int SkNthSet(uint32_t target, int n);
146
-
147
- //! Returns the number of leading zero bits (0...32)
148
- // From Hacker's Delight 2nd Edition
149
- constexpr int SkCLZ_portable(uint32_t x) {
150
- int n = 32;
151
- uint32_t y = x >> 16; if (y != 0) {n -= 16; x = y;}
152
- y = x >> 8; if (y != 0) {n -= 8; x = y;}
153
- y = x >> 4; if (y != 0) {n -= 4; x = y;}
154
- y = x >> 2; if (y != 0) {n -= 2; x = y;}
155
- y = x >> 1; if (y != 0) {return n - 2;}
156
- return n - static_cast<int>(x);
157
- }
158
-
159
- static_assert(32 == SkCLZ_portable(0));
160
- static_assert(31 == SkCLZ_portable(1));
161
- static_assert( 1 == SkCLZ_portable(1 << 30));
162
- static_assert( 1 == SkCLZ_portable((1 << 30) | (1 << 24) | 1));
163
- static_assert( 0 == SkCLZ_portable(~0U));
164
-
165
- #if defined(SK_BUILD_FOR_WIN)
166
- #include <intrin.h>
167
-
168
- static inline int SkCLZ(uint32_t mask) {
169
- if (mask) {
170
- unsigned long index = 0;
171
- _BitScanReverse(&index, mask);
172
- // Suppress this bogus /analyze warning. The check for non-zero
173
- // guarantees that _BitScanReverse will succeed.
174
- #pragma warning(push)
175
- #pragma warning(suppress : 6102) // Using 'index' from failed function call
176
- return static_cast<int>(index ^ 0x1F);
177
- #pragma warning(pop)
178
- } else {
179
- return 32;
180
- }
181
- }
182
- #elif defined(SK_CPU_ARM32) || defined(__GNUC__) || defined(__clang__)
183
- static inline int SkCLZ(uint32_t mask) {
184
- // __builtin_clz(0) is undefined, so we have to detect that case.
185
- return mask ? __builtin_clz(mask) : 32;
186
- }
187
- #else
188
- static inline int SkCLZ(uint32_t mask) {
189
- return SkCLZ_portable(mask);
190
- }
191
- #endif
192
-
193
- //! Returns the number of trailing zero bits (0...32)
194
- // From Hacker's Delight 2nd Edition
195
- constexpr int SkCTZ_portable(uint32_t x) {
196
- return 32 - SkCLZ_portable(~x & (x - 1));
197
- }
198
-
199
- static_assert(32 == SkCTZ_portable(0));
200
- static_assert( 0 == SkCTZ_portable(1));
201
- static_assert(30 == SkCTZ_portable(1 << 30));
202
- static_assert( 2 == SkCTZ_portable((1 << 30) | (1 << 24) | (1 << 2)));
203
- static_assert( 0 == SkCTZ_portable(~0U));
204
-
205
- #if defined(SK_BUILD_FOR_WIN)
206
- #include <intrin.h>
207
-
208
- static inline int SkCTZ(uint32_t mask) {
209
- if (mask) {
210
- unsigned long index = 0;
211
- _BitScanForward(&index, mask);
212
- // Suppress this bogus /analyze warning. The check for non-zero
213
- // guarantees that _BitScanReverse will succeed.
214
- #pragma warning(push)
215
- #pragma warning(suppress : 6102) // Using 'index' from failed function call
216
- return static_cast<int>(index);
217
- #pragma warning(pop)
218
- } else {
219
- return 32;
220
- }
221
- }
222
- #elif defined(SK_CPU_ARM32) || defined(__GNUC__) || defined(__clang__)
223
- static inline int SkCTZ(uint32_t mask) {
224
- // __builtin_ctz(0) is undefined, so we have to detect that case.
225
- return mask ? __builtin_ctz(mask) : 32;
226
- }
227
- #else
228
- static inline int SkCTZ(uint32_t mask) {
229
- return SkCTZ_portable(mask);
230
- }
231
- #endif
232
-
233
148
  /**
234
149
  * Returns the log2 of the specified value, were that value to be rounded up
235
150
  * to the next power of 2. It is undefined to pass 0. Examples:
@@ -239,16 +154,11 @@ static_assert( 0 == SkCTZ_portable(~0U));
239
154
  * SkNextLog2(4) -> 2
240
155
  * SkNextLog2(5) -> 3
241
156
  */
242
- static inline int SkNextLog2(uint32_t value) {
157
+ static constexpr int SkNextLog2(uint32_t value) {
243
158
  SkASSERT(value != 0);
244
159
  return 32 - SkCLZ(value - 1);
245
160
  }
246
161
 
247
- constexpr int SkNextLog2_portable(uint32_t value) {
248
- SkASSERT(value != 0);
249
- return 32 - SkCLZ_portable(value - 1);
250
- }
251
-
252
162
  /**
253
163
  * Returns the log2 of the specified value, were that value to be rounded down
254
164
  * to the previous power of 2. It is undefined to pass 0. Examples:
@@ -258,52 +168,37 @@ constexpr int SkNextLog2_portable(uint32_t value) {
258
168
  * SkPrevLog2(4) -> 2
259
169
  * SkPrevLog2(5) -> 2
260
170
  */
261
- static inline int SkPrevLog2(uint32_t value) {
171
+ static constexpr int SkPrevLog2(uint32_t value) {
262
172
  SkASSERT(value != 0);
263
173
  return 32 - SkCLZ(value >> 1);
264
174
  }
265
175
 
266
- constexpr int SkPrevLog2_portable(uint32_t value) {
267
- SkASSERT(value != 0);
268
- return 32 - SkCLZ_portable(value >> 1);
269
- }
270
-
271
176
  /**
272
177
  * Returns the smallest power-of-2 that is >= the specified value. If value
273
178
  * is already a power of 2, then it is returned unchanged. It is undefined
274
179
  * if value is <= 0.
275
180
  */
276
- static inline int SkNextPow2(int value) {
181
+ static constexpr int SkNextPow2(int value) {
277
182
  SkASSERT(value > 0);
278
183
  return 1 << SkNextLog2(static_cast<uint32_t>(value));
279
184
  }
280
185
 
281
- constexpr int SkNextPow2_portable(int value) {
282
- SkASSERT(value > 0);
283
- return 1 << SkNextLog2_portable(static_cast<uint32_t>(value));
284
- }
285
-
286
186
  /**
287
187
  * Returns the largest power-of-2 that is <= the specified value. If value
288
188
  * is already a power of 2, then it is returned unchanged. It is undefined
289
189
  * if value is <= 0.
290
190
  */
291
- static inline int SkPrevPow2(int value) {
191
+ static constexpr int SkPrevPow2(int value) {
292
192
  SkASSERT(value > 0);
293
193
  return 1 << SkPrevLog2(static_cast<uint32_t>(value));
294
194
  }
295
195
 
296
- constexpr int SkPrevPow2_portable(int value) {
297
- SkASSERT(value > 0);
298
- return 1 << SkPrevLog2_portable(static_cast<uint32_t>(value));
299
- }
300
-
301
196
  ///////////////////////////////////////////////////////////////////////////////
302
197
 
303
198
  /**
304
199
  * Returns the next power of 2 >= n or n if the next power of 2 can't be represented by size_t.
305
200
  */
306
- constexpr size_t SkNextSizePow2(size_t n) {
201
+ static constexpr size_t SkNextSizePow2(size_t n) {
307
202
  constexpr int kNumSizeTBits = 8 * sizeof(size_t);
308
203
  constexpr size_t kHighBitSet = size_t(1) << (kNumSizeTBits - 1);
309
204
 
@@ -16,4 +16,4 @@ import type { ExtrapolationType } from "./interpolate";
16
16
  * path2.lineTo(0, 100);
17
17
  * const path = interpolatePath(0.5, [0, 1], [path1, path2]);
18
18
  */
19
- export declare const interpolatePaths: (value: number, input: number[], outputRange: SkPath[], options?: ExtrapolationType, output?: SkPath) => SkPath;
19
+ export declare const interpolatePaths: (value: number, input: number[], outputRange: SkPath[], options?: ExtrapolationType, _output?: SkPath) => SkPath;