@shopify/react-native-skia 0.1.234 → 0.1.236

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. package/cpp/api/JsiSkTypefaceFactory.h +2 -1
  2. package/cpp/skia/include/android/AHardwareBufferUtils.h +23 -0
  3. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +2 -0
  4. package/cpp/skia/include/android/graphite/SurfaceAndroid.h +59 -0
  5. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -1
  6. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
  7. package/cpp/skia/include/codec/SkCodec.h +21 -3
  8. package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
  9. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
  10. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -1
  11. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
  12. package/cpp/skia/include/codec/SkPngDecoder.h +1 -1
  13. package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
  14. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
  15. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -1
  16. package/cpp/skia/include/config/SkUserConfig.h +3 -1
  17. package/cpp/skia/include/core/SkCanvas.h +66 -37
  18. package/cpp/skia/include/core/SkColorFilter.h +5 -2
  19. package/cpp/skia/include/core/SkContourMeasure.h +1 -0
  20. package/cpp/skia/include/core/SkDocument.h +1 -0
  21. package/cpp/skia/include/core/SkFont.h +14 -24
  22. package/cpp/skia/include/core/SkFontArguments.h +1 -1
  23. package/cpp/skia/include/core/SkFontMetrics.h +1 -1
  24. package/cpp/skia/include/core/SkFontMgr.h +0 -7
  25. package/cpp/skia/include/core/SkGraphics.h +13 -0
  26. package/cpp/skia/include/core/SkMesh.h +9 -13
  27. package/cpp/skia/include/core/SkMilestone.h +1 -1
  28. package/cpp/skia/include/core/SkPathMeasure.h +2 -0
  29. package/cpp/skia/include/core/SkSerialProcs.h +29 -11
  30. package/cpp/skia/include/core/SkSize.h +3 -3
  31. package/cpp/skia/include/core/SkStream.h +3 -13
  32. package/cpp/skia/include/core/SkSurface.h +6 -3
  33. package/cpp/skia/include/core/SkSurfaceProps.h +2 -4
  34. package/cpp/skia/include/core/SkTraceMemoryDump.h +15 -0
  35. package/cpp/skia/include/core/SkTypeface.h +8 -56
  36. package/cpp/skia/include/core/SkTypes.h +8 -0
  37. package/cpp/skia/include/core/SkVertices.h +1 -1
  38. package/cpp/skia/include/docs/SkMultiPictureDocument.h +53 -0
  39. package/cpp/skia/include/docs/SkPDFDocument.h +11 -0
  40. package/cpp/skia/include/effects/SkGradientShader.h +9 -0
  41. package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -7
  42. package/cpp/skia/include/gpu/GrBackendSemaphore.h +33 -47
  43. package/cpp/skia/include/gpu/GrBackendSurface.h +2 -3
  44. package/cpp/skia/include/gpu/GrContextOptions.h +0 -6
  45. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +44 -28
  46. package/cpp/skia/include/gpu/GrDirectContext.h +12 -31
  47. package/cpp/skia/include/gpu/GrTypes.h +1 -16
  48. package/cpp/skia/include/gpu/MutableTextureState.h +35 -80
  49. package/cpp/skia/include/gpu/ShaderErrorHandler.h +11 -1
  50. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +2 -2
  51. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +1 -1
  52. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +3 -2
  53. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
  54. package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +30 -0
  55. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  56. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -0
  57. package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -0
  58. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +3 -3
  59. package/cpp/skia/include/gpu/graphite/BackendTexture.h +39 -27
  60. package/cpp/skia/include/gpu/graphite/Context.h +39 -13
  61. package/cpp/skia/include/gpu/graphite/ContextOptions.h +2 -0
  62. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +2 -1
  63. package/cpp/skia/include/gpu/graphite/Image.h +106 -87
  64. package/cpp/skia/include/gpu/graphite/Recorder.h +24 -3
  65. package/cpp/skia/include/gpu/graphite/Surface.h +7 -2
  66. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +41 -2
  67. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +11 -6
  68. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -2
  69. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +6 -6
  70. package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -0
  71. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  72. package/cpp/skia/include/gpu/vk/GrVkTypes.h +1 -44
  73. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
  74. package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +25 -0
  75. package/cpp/skia/include/gpu/vk/VulkanTypes.h +44 -0
  76. package/cpp/skia/include/ports/SkFontConfigInterface.h +3 -6
  77. package/cpp/skia/include/private/SkEncodedInfo.h +5 -0
  78. package/cpp/skia/include/private/SkExif.h +102 -0
  79. package/cpp/skia/include/private/SkGainmapInfo.h +11 -1
  80. package/cpp/skia/include/private/base/SkAssert.h +16 -0
  81. package/cpp/skia/include/private/base/SkDeque.h +2 -7
  82. package/cpp/skia/include/private/base/SkLoadUserConfig.h +1 -1
  83. package/cpp/skia/include/private/base/SkTArray.h +69 -28
  84. package/cpp/skia/include/private/base/SkThreadAnnotations.h +18 -5
  85. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +26 -30
  86. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +4 -3
  87. package/cpp/skia/include/private/chromium/SkImageChromium.h +1 -1
  88. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +8 -6
  89. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +29 -0
  90. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +12 -9
  91. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +16 -11
  92. package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -2
  93. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
  94. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
  95. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
  96. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
  97. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
  98. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +9 -2
  99. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +31 -3
  100. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10624 -5716
  101. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +2 -1
  102. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +2 -1
  103. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +28 -1
  104. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +2 -1
  105. package/cpp/skia/include/utils/mac/SkCGUtils.h +23 -11
  106. package/cpp/skia/modules/skcms/skcms.h +2 -410
  107. package/cpp/skia/modules/skcms/src/Transform_inl.h +831 -704
  108. package/cpp/skia/modules/skcms/src/skcms_Transform.h +161 -0
  109. package/cpp/skia/modules/skcms/src/skcms_internals.h +136 -0
  110. package/cpp/skia/modules/skcms/src/skcms_public.h +404 -0
  111. package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
  112. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -0
  113. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
  114. package/cpp/skia/modules/skparagraph/include/TextStyle.h +4 -3
  115. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -3
  116. package/cpp/skia/modules/skresources/include/SkResources.h +28 -17
  117. package/cpp/skia/modules/skunicode/include/SkUnicode.h +12 -0
  118. package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -1
  119. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +4 -1
  120. package/cpp/skia/src/base/SkUTF.h +7 -0
  121. package/cpp/skia/src/core/SkTHash.h +20 -8
  122. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +3 -2
  123. package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -57
  124. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  125. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  126. package/lib/commonjs/external/reanimated/index.js +13 -0
  127. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  128. package/lib/commonjs/external/reanimated/interpolators.js +13 -1
  129. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  130. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
  131. package/lib/commonjs/external/reanimated/moduleWrapper.js +5 -3
  132. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  133. package/lib/commonjs/external/reanimated/textures.d.ts +5 -0
  134. package/lib/commonjs/external/reanimated/textures.js +52 -0
  135. package/lib/commonjs/external/reanimated/textures.js.map +1 -0
  136. package/lib/commonjs/headless/index.js +1 -1
  137. package/lib/commonjs/headless/index.js.map +1 -1
  138. package/lib/commonjs/mock/index.js +3 -0
  139. package/lib/commonjs/mock/index.js.map +1 -1
  140. package/lib/commonjs/renderer/Canvas.js +1 -1
  141. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  142. package/lib/commonjs/renderer/Container.d.ts +1 -1
  143. package/lib/commonjs/renderer/Container.js +2 -1
  144. package/lib/commonjs/renderer/Container.js.map +1 -1
  145. package/lib/commonjs/renderer/Offscreen.d.ts +1 -0
  146. package/lib/commonjs/renderer/Offscreen.js +18 -5
  147. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  148. package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
  149. package/lib/commonjs/renderer/Reconciler.js +7 -4
  150. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  151. package/lib/commonjs/skia/types/Matrix4.d.ts +2 -2
  152. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  153. package/lib/commonjs/skia/types/Shader/Shader.d.ts +1 -1
  154. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  155. package/lib/module/dom/nodes/JsiSkDOM.d.ts +3 -2
  156. package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
  157. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  158. package/lib/module/external/reanimated/index.d.ts +1 -0
  159. package/lib/module/external/reanimated/index.js +1 -0
  160. package/lib/module/external/reanimated/index.js.map +1 -1
  161. package/lib/module/external/reanimated/interpolators.js +13 -1
  162. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  163. package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
  164. package/lib/module/external/reanimated/moduleWrapper.js +3 -2
  165. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  166. package/lib/module/external/reanimated/textures.d.ts +5 -0
  167. package/lib/module/external/reanimated/textures.js +35 -0
  168. package/lib/module/external/reanimated/textures.js.map +1 -0
  169. package/lib/module/headless/index.js +1 -1
  170. package/lib/module/headless/index.js.map +1 -1
  171. package/lib/module/mock/index.js +3 -0
  172. package/lib/module/mock/index.js.map +1 -1
  173. package/lib/module/renderer/Canvas.js +1 -1
  174. package/lib/module/renderer/Canvas.js.map +1 -1
  175. package/lib/module/renderer/Container.d.ts +1 -1
  176. package/lib/module/renderer/Container.js +2 -1
  177. package/lib/module/renderer/Container.js.map +1 -1
  178. package/lib/module/renderer/Offscreen.d.ts +1 -0
  179. package/lib/module/renderer/Offscreen.js +11 -3
  180. package/lib/module/renderer/Offscreen.js.map +1 -1
  181. package/lib/module/renderer/Reconciler.d.ts +1 -1
  182. package/lib/module/renderer/Reconciler.js +7 -4
  183. package/lib/module/renderer/Reconciler.js.map +1 -1
  184. package/lib/module/skia/types/Matrix4.d.ts +2 -2
  185. package/lib/module/skia/types/Matrix4.js.map +1 -1
  186. package/lib/module/skia/types/Shader/Shader.d.ts +1 -1
  187. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  188. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +3 -2
  189. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  190. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
  191. package/lib/typescript/src/external/reanimated/textures.d.ts +5 -0
  192. package/lib/typescript/src/renderer/Container.d.ts +1 -1
  193. package/lib/typescript/src/renderer/Offscreen.d.ts +1 -0
  194. package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
  195. package/lib/typescript/src/skia/types/Matrix4.d.ts +2 -2
  196. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
  197. package/libs/android/arm64-v8a/libskia.a +0 -0
  198. package/libs/android/arm64-v8a/libskottie.a +0 -0
  199. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  200. package/libs/android/arm64-v8a/libsksg.a +0 -0
  201. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  202. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  203. package/libs/android/arm64-v8a/libsvg.a +0 -0
  204. package/libs/android/armeabi-v7a/libskia.a +0 -0
  205. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  206. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  207. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  208. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  209. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  210. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  211. package/libs/android/x86/libskia.a +0 -0
  212. package/libs/android/x86/libskottie.a +0 -0
  213. package/libs/android/x86/libskparagraph.a +0 -0
  214. package/libs/android/x86/libsksg.a +0 -0
  215. package/libs/android/x86/libskshaper.a +0 -0
  216. package/libs/android/x86/libskunicode.a +0 -0
  217. package/libs/android/x86/libsvg.a +0 -0
  218. package/libs/android/x86_64/libskia.a +0 -0
  219. package/libs/android/x86_64/libskottie.a +0 -0
  220. package/libs/android/x86_64/libskparagraph.a +0 -0
  221. package/libs/android/x86_64/libsksg.a +0 -0
  222. package/libs/android/x86_64/libskshaper.a +0 -0
  223. package/libs/android/x86_64/libskunicode.a +0 -0
  224. package/libs/android/x86_64/libsvg.a +0 -0
  225. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  226. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  227. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  228. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  229. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  230. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  231. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  232. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  233. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  234. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  235. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  236. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  237. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  238. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  239. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  240. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  241. package/package.json +1 -1
  242. package/src/dom/nodes/JsiSkDOM.ts +55 -56
  243. package/src/external/reanimated/index.ts +1 -0
  244. package/src/external/reanimated/interpolators.ts +15 -2
  245. package/src/external/reanimated/moduleWrapper.ts +1 -0
  246. package/src/external/reanimated/textures.tsx +50 -0
  247. package/src/headless/index.ts +1 -1
  248. package/src/mock/index.ts +3 -0
  249. package/src/renderer/Canvas.tsx +1 -1
  250. package/src/renderer/Container.tsx +3 -2
  251. package/src/renderer/Offscreen.tsx +12 -3
  252. package/src/renderer/Reconciler.tsx +5 -2
  253. package/src/skia/types/Matrix4.ts +2 -2
  254. package/src/skia/types/Shader/Shader.ts +6 -1
  255. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -142
  256. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +0 -107
  257. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +0 -32
  258. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +0 -83
  259. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +0 -47
  260. package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +0 -57
  261. package/cpp/skia/include/utils/SkBase64.h +0 -53
  262. package/cpp/skia/modules/skcms/skcms_internal.h +0 -56
@@ -69,6 +69,19 @@ public:
69
69
  */
70
70
  static int SetFontCacheCountLimit(int count);
71
71
 
72
+ /**
73
+ * Return the current limit to the number of entries in the typeface cache.
74
+ * A cache "entry" is associated with each typeface.
75
+ */
76
+ static int GetTypefaceCacheCountLimit();
77
+
78
+ /**
79
+ * Set the limit to the number of entries in the typeface cache, and return
80
+ * the previous value. Changes to this only take effect the next time
81
+ * each cache object is modified.
82
+ */
83
+ static int SetTypefaceCacheCountLimit(int count);
84
+
72
85
  /**
73
86
  * For debugging purposes, this will attempt to purge the font cache. It
74
87
  * does not change the limit, but will cause subsequent font measures and
@@ -15,6 +15,7 @@
15
15
  #include "include/core/SkString.h"
16
16
  #include "include/effects/SkRuntimeEffect.h"
17
17
  #include "include/private/base/SkAPI.h"
18
+ #include "include/private/base/SkTArray.h"
18
19
 
19
20
  #include <cstddef>
20
21
  #include <cstdint>
@@ -168,10 +169,7 @@ public:
168
169
  */
169
170
  SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
170
171
 
171
- /**
172
- * Provides basic info about individual children: names, indices and runtime effect type.
173
- * TODO(b/40045302): SkMesh will currently reject mesh specifications that include child effects
174
- */
172
+ /** Provides basic info about individual children: names, indices and runtime effect type. */
175
173
  SkSpan<const Child> children() const { return SkSpan(fChildren); }
176
174
 
177
175
  /** Returns a pointer to the named child's description, or nullptr if not found. */
@@ -188,6 +186,8 @@ public:
188
186
 
189
187
  size_t stride() const { return fStride; }
190
188
 
189
+ SkColorSpace* colorSpace() const { return fColorSpace.get(); }
190
+
191
191
  private:
192
192
  friend struct SkMeshSpecificationPriv;
193
193
 
@@ -317,8 +317,6 @@ public:
317
317
  * If the mesh is invalid the returned string give contain the reason for the failure (e.g. the
318
318
  * vertex buffer was null or uniform data too small).
319
319
  */
320
-
321
- // TODO(b/40045302): support for `children` is a work-in-progress
322
320
  static Result Make(sk_sp<SkMeshSpecification>,
323
321
  Mode,
324
322
  sk_sp<VertexBuffer>,
@@ -334,8 +332,6 @@ public:
334
332
  * If the mesh is invalid the returned string give contain the reason for the failure (e.g. the
335
333
  * index buffer was null or uniform data too small).
336
334
  */
337
-
338
- // TODO(b/40045302): support for `children` is a work-in-progress
339
335
  static Result MakeIndexed(sk_sp<SkMeshSpecification>,
340
336
  Mode,
341
337
  sk_sp<VertexBuffer>,
@@ -383,7 +379,7 @@ private:
383
379
  sk_sp<IndexBuffer> fIB;
384
380
 
385
381
  sk_sp<const SkData> fUniforms;
386
- std::vector<ChildPtr> fChildren;
382
+ skia_private::STArray<2, ChildPtr> fChildren;
387
383
 
388
384
  size_t fVOffset = 0; // Must be a multiple of spec->stride()
389
385
  size_t fVCount = 0;
@@ -405,14 +401,14 @@ namespace SkMeshes {
405
401
  * @param data The data used to populate the buffer, or nullptr to create a zero-
406
402
  * initialized buffer.
407
403
  * @param size Both the size of the data in 'data' and the size of the resulting
408
- * buffer.
404
+ * buffer, in bytes.
409
405
  */
410
406
  SK_API sk_sp<SkMesh::IndexBuffer> MakeIndexBuffer(const void* data, size_t size);
411
407
 
412
408
  /**
413
409
  * Makes a copy of an index buffer. The copy will be CPU-backed.
414
410
  */
415
- SK_API sk_sp<SkMesh::IndexBuffer> CopyIndexBuffer(sk_sp<SkMesh::IndexBuffer>);
411
+ SK_API sk_sp<SkMesh::IndexBuffer> CopyIndexBuffer(const sk_sp<SkMesh::IndexBuffer>&);
416
412
 
417
413
  /**
418
414
  * Makes a CPU-backed vertex buffer to be used with SkMeshes.
@@ -420,14 +416,14 @@ SK_API sk_sp<SkMesh::IndexBuffer> CopyIndexBuffer(sk_sp<SkMesh::IndexBuffer>);
420
416
  * @param data The data used to populate the buffer, or nullptr to create a zero-
421
417
  * initialized buffer.
422
418
  * @param size Both the size of the data in 'data' and the size of the resulting
423
- * buffer.
419
+ * buffer, in bytes.
424
420
  */
425
421
  SK_API sk_sp<SkMesh::VertexBuffer> MakeVertexBuffer(const void*, size_t size);
426
422
 
427
423
  /**
428
424
  * Makes a copy of a vertex buffer. The copy will be CPU-backed.
429
425
  */
430
- SK_API sk_sp<SkMesh::VertexBuffer> CopyVertexBuffer(sk_sp<SkMesh::VertexBuffer>);
426
+ SK_API sk_sp<SkMesh::VertexBuffer> CopyVertexBuffer(const sk_sp<SkMesh::VertexBuffer>&);
431
427
  } // namespace SkMeshes
432
428
 
433
429
  #endif
@@ -5,5 +5,5 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
  #ifndef SK_MILESTONE
8
- #define SK_MILESTONE 119
8
+ #define SK_MILESTONE 122
9
9
  #endif
@@ -79,6 +79,8 @@ public:
79
79
  void dump();
80
80
  #endif
81
81
 
82
+ const SkContourMeasure* currentMeasure() const { return fContour.get(); }
83
+
82
84
  private:
83
85
  SkContourMeasureIter fIter;
84
86
  sk_sp<SkContourMeasure> fContour;
@@ -12,12 +12,14 @@
12
12
  #include "include/private/base/SkAPI.h"
13
13
 
14
14
  #include <cstddef>
15
+ #include <optional>
15
16
 
16
17
  class SkData;
17
18
  class SkImage;
18
19
  class SkPicture;
19
20
  class SkTypeface;
20
21
  class SkReadBuffer;
22
+ enum SkAlphaType : int;
21
23
  namespace sktext::gpu {
22
24
  class Slug;
23
25
  }
@@ -48,10 +50,25 @@ using SkDeserialPictureProc = sk_sp<SkPicture> (*)(const void* data, size_t leng
48
50
  *
49
51
  * This will also be used to decode the internal mipmap layers that are saved on some images.
50
52
  *
51
- * Note that unlike SkDeserialPictureProc and SkDeserialTypefaceProc, return nullptr from this
52
- * does not indicate failure, but is a signal for Skia to take its default action.
53
+ * An explicit SkAlphaType may have been encoded in the bytestream; if not, then the passed in
54
+ * optional will be not present.
55
+ *
56
+ * Clients should set at least SkDeserialImageProc; SkDeserialImageFromDataProc may be called
57
+ * if the internal implementation has a SkData copy already. Implementations of SkDeserialImageProc
58
+ * must make a copy of any data they needed after the proc finishes, since the data will go away
59
+ * after serialization ends.
53
60
  */
61
+ #if !defined(SK_LEGACY_DESERIAL_IMAGE_PROC)
54
62
  using SkDeserialImageProc = sk_sp<SkImage> (*)(const void* data, size_t length, void* ctx);
63
+ #else
64
+ using SkDeserialImageProc = sk_sp<SkImage> (*)(const void* data,
65
+ size_t length,
66
+ std::optional<SkAlphaType>,
67
+ void* ctx);
68
+ #endif
69
+ using SkDeserialImageFromDataProc = sk_sp<SkImage> (*)(sk_sp<SkData>,
70
+ std::optional<SkAlphaType>,
71
+ void* ctx);
55
72
 
56
73
  /**
57
74
  * Slugs are currently only deserializable with a GPU backend. Clients will not be able to
@@ -78,22 +95,23 @@ struct SK_API SkSerialProcs {
78
95
  };
79
96
 
80
97
  struct SK_API SkDeserialProcs {
81
- SkDeserialPictureProc fPictureProc = nullptr;
82
- void* fPictureCtx = nullptr;
98
+ SkDeserialPictureProc fPictureProc = nullptr;
99
+ void* fPictureCtx = nullptr;
83
100
 
84
- SkDeserialImageProc fImageProc = nullptr;
85
- void* fImageCtx = nullptr;
101
+ SkDeserialImageProc fImageProc = nullptr;
102
+ SkDeserialImageFromDataProc fImageDataProc = nullptr;
103
+ void* fImageCtx = nullptr;
86
104
 
87
- SkSlugProc fSlugProc = nullptr;
88
- void* fSlugCtx = nullptr;
105
+ SkSlugProc fSlugProc = nullptr;
106
+ void* fSlugCtx = nullptr;
89
107
 
90
- SkDeserialTypefaceProc fTypefaceProc = nullptr;
91
- void* fTypefaceCtx = nullptr;
108
+ SkDeserialTypefaceProc fTypefaceProc = nullptr;
109
+ void* fTypefaceCtx = nullptr;
92
110
 
93
111
  // This looks like a flag, but it could be considered a proc as well (one that takes no
94
112
  // parameters and returns a bool). Given that there are only two valid implementations of that
95
113
  // proc, we just insert the bool directly.
96
- bool fAllowSkSL = true;
114
+ bool fAllowSkSL = true;
97
115
  };
98
116
 
99
117
  #endif
@@ -52,13 +52,13 @@ struct SkSize {
52
52
  SkScalar fWidth;
53
53
  SkScalar fHeight;
54
54
 
55
- static SkSize Make(SkScalar w, SkScalar h) { return {w, h}; }
55
+ static constexpr SkSize Make(SkScalar w, SkScalar h) { return {w, h}; }
56
56
 
57
- static SkSize Make(const SkISize& src) {
57
+ static constexpr SkSize Make(const SkISize& src) {
58
58
  return {SkIntToScalar(src.width()), SkIntToScalar(src.height())};
59
59
  }
60
60
 
61
- static SkSize MakeEmpty() { return {0, 0}; }
61
+ static constexpr SkSize MakeEmpty() { return {0, 0}; }
62
62
 
63
63
  void set(SkScalar w, SkScalar h) { *this = SkSize{w, h}; }
64
64
 
@@ -25,19 +25,6 @@ class SkStreamAsset;
25
25
  /**
26
26
  * SkStream -- abstraction for a source of bytes. Subclasses can be backed by
27
27
  * memory, or a file, or something else.
28
- *
29
- * NOTE:
30
- *
31
- * Classic "streams" APIs are sort of async, in that on a request for N
32
- * bytes, they may return fewer than N bytes on a given call, in which case
33
- * the caller can "try again" to get more bytes, eventually (modulo an error)
34
- * receiving their total N bytes.
35
- *
36
- * Skia streams behave differently. They are effectively synchronous, and will
37
- * always return all N bytes of the request if possible. If they return fewer
38
- * (the read() call returns the number of bytes read) then that means there is
39
- * no more data (at EOF or hit an error). The caller should *not* call again
40
- * in hopes of fulfilling more of the request.
41
28
  */
42
29
  class SK_API SkStream {
43
30
  public:
@@ -81,6 +68,9 @@ public:
81
68
  virtual size_t peek(void* /*buffer*/, size_t /*size*/) const { return 0; }
82
69
 
83
70
  /** Returns true when all the bytes in the stream have been read.
71
+ * As SkStream represents synchronous I/O, isAtEnd returns false when the
72
+ * final stream length isn't known yet, even when all the bytes available
73
+ * so far have been read.
84
74
  * This may return true early (when there are no more bytes to be read)
85
75
  * or late (after the first unsuccessful read).
86
76
  */
@@ -604,9 +604,12 @@ public:
604
604
  const SkSurfaceProps& props() const { return fProps; }
605
605
 
606
606
  /** Inserts a list of GPU semaphores that the current GPU-backed API must wait on before
607
- executing any more commands on the GPU for this surface. If this call returns false, then
608
- the GPU back-end will not wait on any passed in semaphores, and the client will still own
609
- the semaphores, regardless of the value of deleteSemaphoresAfterWait.
607
+ executing any more commands on the GPU for this surface. We only guarantee blocking
608
+ transfer and fragment shader work, but may block earlier stages as well depending on the
609
+ backend.
610
+ If this call returns false, then the GPU back-end will not wait on any passed in
611
+ semaphores, and the client will still own the semaphores, regardless of the value of
612
+ deleteSemaphoresAfterWait.
610
613
 
611
614
  If deleteSemaphoresAfterWait is false then Skia will not delete the semaphores. In this case
612
615
  it is the client's responsibility to not destroy or attempt to reuse the semaphores until it
@@ -59,15 +59,13 @@ public:
59
59
  // Currently this only impacts GPU backends
60
60
  kAlwaysDither_Flag = 1 << 2,
61
61
  };
62
- /** Deprecated alias used by Chromium. Will be removed. */
63
- static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_Flag;
64
62
 
65
63
  /** No flags, unknown pixel geometry. */
66
64
  SkSurfaceProps();
67
65
  SkSurfaceProps(uint32_t flags, SkPixelGeometry);
68
66
 
69
- SkSurfaceProps(const SkSurfaceProps&);
70
- SkSurfaceProps& operator=(const SkSurfaceProps&);
67
+ SkSurfaceProps(const SkSurfaceProps&) = default;
68
+ SkSurfaceProps& operator=(const SkSurfaceProps&) = default;
71
69
 
72
70
  SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const {
73
71
  return SkSurfaceProps(fFlags, newPixelGeometry);
@@ -89,6 +89,21 @@ public:
89
89
  */
90
90
  virtual void dumpWrappedState(const char* /*dumpName*/, bool /*isWrappedObject*/) {}
91
91
 
92
+ /**
93
+ * Returns true if we should dump unbudgeted objects. Unbudgeted objects can either come from
94
+ * wrapped objects passed into Skia from the client or from Skia created objects currently held
95
+ * by the client in a public Skia object (e.g. SkSurface or SkImage). This call is only used
96
+ * when dumping Graphite memory statistics.
97
+ */
98
+ virtual bool shouldDumpUnbudgetedObjects() const { return true; }
99
+
100
+ /**
101
+ * If shouldDumpUnbudgetedObjects() returns true then this function will be called to populate
102
+ * the output with information on whether the item being dumped is budgeted. This call is only
103
+ * used when dumping Graphite memory statistics.
104
+ */
105
+ virtual void dumpBudgetedState(const char* /*dumpName*/, bool /*isBudgeted*/) {}
106
+
92
107
  protected:
93
108
  virtual ~SkTraceMemoryDump() = default;
94
109
  SkTraceMemoryDump() = default;
@@ -24,6 +24,7 @@
24
24
 
25
25
  class SkData;
26
26
  class SkDescriptor;
27
+ class SkFontMgr;
27
28
  class SkFontDescriptor;
28
29
  class SkScalerContext;
29
30
  class SkStream;
@@ -36,10 +37,6 @@ struct SkScalerContextRec;
36
37
 
37
38
  using SkTypefaceID = uint32_t;
38
39
 
39
- // SkFontID is deprecated, please use SkTypefaceID.
40
- using SkFontID = SkTypefaceID;
41
-
42
-
43
40
  /** Machine endian. */
44
41
  typedef uint32_t SkFontTableTag;
45
42
 
@@ -103,46 +100,13 @@ public:
103
100
  */
104
101
  SkTypefaceID uniqueID() const { return fUniqueID; }
105
102
 
106
- /** Return the uniqueID for the specified typeface. If the face is null,
107
- resolve it to the default font and return its uniqueID. Will never
108
- return 0.
109
- */
110
- static SkTypefaceID UniqueID(const SkTypeface* face);
111
-
112
103
  /** Returns true if the two typefaces reference the same underlying font,
113
- handling either being null (treating null as the default font)
104
+ handling either being null (treating null as not equal to any font).
114
105
  */
115
106
  static bool Equal(const SkTypeface* facea, const SkTypeface* faceb);
116
107
 
117
- /** Returns the default normal typeface, which is never nullptr. */
118
- static sk_sp<SkTypeface> MakeDefault();
119
-
120
- /** Creates a new reference to the typeface that most closely matches the
121
- requested familyName and fontStyle. This method allows extended font
122
- face specifiers as in the SkFontStyle type. Will never return null.
123
-
124
- @param familyName May be NULL. The name of the font family.
125
- @param fontStyle The style of the typeface.
126
- @return reference to the closest-matching typeface. Call must call
127
- unref() when they are done.
128
- */
129
- static sk_sp<SkTypeface> MakeFromName(const char familyName[], SkFontStyle fontStyle);
130
-
131
- /** Return a new typeface given a file. If the file does not exist, or is
132
- not a valid font file, returns nullptr.
133
- */
134
- static sk_sp<SkTypeface> MakeFromFile(const char path[], int index = 0);
135
-
136
- /** Return a new typeface given a stream. If the stream is
137
- not a valid font file, returns nullptr. Ownership of the stream is
138
- transferred, so the caller must not reference it again.
139
- */
140
- static sk_sp<SkTypeface> MakeFromStream(std::unique_ptr<SkStreamAsset> stream, int index = 0);
141
-
142
- /** Return a new typeface given a SkData. If the data is null, or is not a valid font file,
143
- * returns nullptr.
144
- */
145
- static sk_sp<SkTypeface> MakeFromData(sk_sp<SkData>, int index = 0);
108
+ /** Returns a non-null typeface which contains no glyphs. */
109
+ static sk_sp<SkTypeface> MakeEmpty();
146
110
 
147
111
  /** Return a new typeface based on this typeface but parameterized as specified in the
148
112
  SkFontArguments. If the SkFontArguments does not supply an argument for a parameter
@@ -177,9 +141,11 @@ public:
177
141
  /** Given the data previously written by serialize(), return a new instance
178
142
  of a typeface referring to the same font. If that font is not available,
179
143
  return nullptr.
144
+ Goes through all registered typeface factories and lastResortMgr (if non-null).
180
145
  Does not affect ownership of SkStream.
181
146
  */
182
- static sk_sp<SkTypeface> MakeDeserialize(SkStream*);
147
+
148
+ static sk_sp<SkTypeface> MakeDeserialize(SkStream*, sk_sp<SkFontMgr> lastResortMgr);
183
149
 
184
150
  /**
185
151
  * Given an array of UTF32 character codes, return their corresponding glyph IDs.
@@ -454,21 +420,7 @@ private:
454
420
  friend class SkRandomTypeface; // getAdvancedMetrics
455
421
  friend class SkPDFFont; // getAdvancedMetrics
456
422
 
457
- /** Style specifies the intrinsic style attributes of a given typeface */
458
- enum Style {
459
- kNormal = 0,
460
- kBold = 0x01,
461
- kItalic = 0x02,
462
-
463
- // helpers
464
- kBoldItalic = 0x03
465
- };
466
- static SkFontStyle FromOldStyle(Style oldStyle);
467
- static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal);
468
-
469
- friend class SkFontPriv; // GetDefaultTypeface
470
- friend class SkPaintPriv; // GetDefaultTypeface
471
- friend class SkFont; // getGlyphToUnicodeMap
423
+ friend class SkFontPriv; // getGlyphToUnicodeMap
472
424
 
473
425
  private:
474
426
  SkTypefaceID fUniqueID;
@@ -86,6 +86,14 @@
86
86
  #define SK_GAMMA_EXPONENT (0.0f) // SRGB
87
87
  #endif
88
88
 
89
+ #if !defined(SK_GAMMA_CONTRAST)
90
+ // A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
91
+ // With lower values small text appears washed out (though correctly so).
92
+ // With higher values lcd fringing is worse and the smoothing effect of
93
+ // partial coverage is diminished.
94
+ #define SK_GAMMA_CONTRAST (0.5f)
95
+ #endif
96
+
89
97
  #if defined(SK_HISTOGRAM_ENUMERATION) || \
90
98
  defined(SK_HISTOGRAM_BOOLEAN) || \
91
99
  defined(SK_HISTOGRAM_EXACT_LINEAR) || \
@@ -61,7 +61,7 @@ public:
61
61
  kHasTexCoords_BuilderFlag = 1 << 0,
62
62
  kHasColors_BuilderFlag = 1 << 1,
63
63
  };
64
- class Builder {
64
+ class SK_API Builder {
65
65
  public:
66
66
  Builder(VertexMode mode, int vertexCount, int indexCount, uint32_t flags);
67
67
 
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright 2023 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 SkMultiPictureDocument_DEFINED
9
+ #define SkMultiPictureDocument_DEFINED
10
+
11
+ #include "include/core/SkPicture.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkSize.h"
14
+ #include "include/core/SkTypes.h"
15
+
16
+ #include <functional>
17
+
18
+ class SkDocument;
19
+ class SkStreamSeekable;
20
+ class SkWStream;
21
+ struct SkDeserialProcs;
22
+ struct SkSerialProcs;
23
+
24
+ struct SkDocumentPage {
25
+ sk_sp<SkPicture> fPicture;
26
+ SkSize fSize;
27
+ };
28
+
29
+ namespace SkMultiPictureDocument {
30
+ /**
31
+ * Writes into a file format that is similar to SkPicture::serialize()
32
+ * Accepts a callback for endPage behavior
33
+ */
34
+ SK_API sk_sp<SkDocument> Make(SkWStream* dst, const SkSerialProcs* = nullptr,
35
+ std::function<void(const SkPicture*)> onEndPage = nullptr);
36
+
37
+ /**
38
+ * Returns the number of pages in the SkMultiPictureDocument.
39
+ */
40
+ SK_API int ReadPageCount(SkStreamSeekable* src);
41
+
42
+ /**
43
+ * Read the SkMultiPictureDocument into the provided array of pages.
44
+ * dstArrayCount must equal SkMultiPictureDocumentReadPageCount().
45
+ * Return false on error.
46
+ */
47
+ SK_API bool Read(SkStreamSeekable* src,
48
+ SkDocumentPage* dstArray,
49
+ int dstArrayCount,
50
+ const SkDeserialProcs* = nullptr);
51
+ } // namespace SkMultiPictureDocument
52
+
53
+ #endif // SkMultiPictureDocument_DEFINED
@@ -117,6 +117,12 @@ struct Metadata {
117
117
  */
118
118
  DateTime fModified = {0, 0, 0, 0, 0, 0, 0, 0};
119
119
 
120
+ /** The natural language of the text in the PDF. If fLang is empty, the root
121
+ StructureElementNode::fLang will be used (if not empty). Text not in
122
+ this language should be marked with StructureElementNode::fLang.
123
+ */
124
+ SkString fLang;
125
+
120
126
  /** The DPI (pixels-per-inch) at which features without native PDF support
121
127
  will be rasterized (e.g. draw image with perspective, draw text with
122
128
  perspective, ...) A larger DPI would create a PDF that reflects the
@@ -145,6 +151,11 @@ struct Metadata {
145
151
  */
146
152
  StructureElementNode* fStructureElementTreeRoot = nullptr;
147
153
 
154
+ enum class Outline : int {
155
+ None = 0,
156
+ StructureElementHeaders = 1,
157
+ } fOutline = Outline::None;
158
+
148
159
  /** Executor to handle threaded work within PDF Backend. If this is nullptr,
149
160
  then all work will be done serially on the main thread. To have worker
150
161
  threads assist with various tasks, set this to a valid SkExecutor
@@ -79,8 +79,17 @@ public:
79
79
  kSRGBLinear,
80
80
  kLab,
81
81
  kOKLab,
82
+ // This is the same as kOKLab, except it has a simplified version of the CSS gamut
83
+ // mapping algorithm (https://www.w3.org/TR/css-color-4/#css-gamut-mapping)
84
+ // into Rec2020 space applied to it.
85
+ // Warning: This space is experimental and should not be used in production.
86
+ kOKLabGamutMap,
82
87
  kLCH,
83
88
  kOKLCH,
89
+ // This is the same as kOKLCH, except it has the same gamut mapping applied to it
90
+ // as kOKLabGamutMap does.
91
+ // Warning: This space is experimental and should not be used in production.
92
+ kOKLCHGamutMap,
84
93
  kSRGB,
85
94
  kHSL,
86
95
  kHWB,
@@ -59,7 +59,7 @@ class Program;
59
59
  class SK_API SkRuntimeEffect : public SkRefCnt {
60
60
  public:
61
61
  // Reflected description of a uniform variable in the effect's SkSL
62
- struct Uniform {
62
+ struct SK_API Uniform {
63
63
  enum class Type {
64
64
  kFloat,
65
65
  kFloat2,
@@ -180,7 +180,7 @@ public:
180
180
  }
181
181
 
182
182
  // Object that allows passing a SkShader, SkColorFilter or SkBlender as a child
183
- class ChildPtr {
183
+ class SK_API ChildPtr {
184
184
  public:
185
185
  ChildPtr() = default;
186
186
  ChildPtr(sk_sp<SkShader> s) : fChild(std::move(s)) {}
@@ -305,11 +305,7 @@ private:
305
305
 
306
306
  const SkSL::RP::Program* getRPProgram(SkSL::DebugTracePriv* debugTrace) const;
307
307
 
308
- #if defined(SK_GANESH)
309
- friend class GrSkSLFP; // fBaseProgram, fSampleUsages
310
- friend class GrGLSLSkSLFP; //
311
- #endif
312
-
308
+ friend class GrSkSLFP; // usesColorTransform
313
309
  friend class SkRuntimeShader; // fBaseProgram, fMain, fSampleUsages, getRPProgram()
314
310
  friend class SkRuntimeBlender; //
315
311
  friend class SkRuntimeColorFilter; //