@shopify/react-native-skia 0.1.213 → 0.1.214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  3. package/cpp/api/JsiSkSurface.h +4 -1
  4. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  5. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  6. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  7. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkCodec.h +4 -3
  9. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  10. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  11. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  18. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  19. package/cpp/skia/include/core/SkBitmap.h +8 -8
  20. package/cpp/skia/include/core/SkCanvas.h +37 -50
  21. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  22. package/cpp/skia/include/core/SkColor.h +1 -1
  23. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  24. package/cpp/skia/include/core/SkColorTable.h +3 -0
  25. package/cpp/skia/include/core/SkColorType.h +2 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  27. package/cpp/skia/include/core/SkDocument.h +1 -0
  28. package/cpp/skia/include/core/SkFont.h +11 -2
  29. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  30. package/cpp/skia/include/core/SkGraphics.h +3 -13
  31. package/cpp/skia/include/core/SkImage.h +57 -111
  32. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  33. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  34. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  35. package/cpp/skia/include/core/SkM44.h +7 -3
  36. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  37. package/cpp/skia/include/core/SkMatrix.h +17 -17
  38. package/cpp/skia/include/core/SkMesh.h +71 -61
  39. package/cpp/skia/include/core/SkMilestone.h +1 -1
  40. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  41. package/cpp/skia/include/core/SkPaint.h +1 -1
  42. package/cpp/skia/include/core/SkPath.h +12 -4
  43. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  44. package/cpp/skia/include/core/SkPicture.h +19 -6
  45. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  46. package/cpp/skia/include/core/SkPixmap.h +2 -3
  47. package/cpp/skia/include/core/SkRRect.h +1 -1
  48. package/cpp/skia/include/core/SkRect.h +107 -110
  49. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  50. package/cpp/skia/include/core/SkRegion.h +7 -1
  51. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  52. package/cpp/skia/include/core/SkShader.h +9 -0
  53. package/cpp/skia/include/core/SkStream.h +9 -9
  54. package/cpp/skia/include/core/SkString.h +1 -1
  55. package/cpp/skia/include/core/SkSurface.h +14 -25
  56. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  57. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  58. package/cpp/skia/include/core/SkTypeface.h +7 -2
  59. package/cpp/skia/include/core/SkTypes.h +4 -12
  60. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  61. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  62. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  63. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  64. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  65. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  66. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  67. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  68. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  69. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  70. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  71. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  72. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  73. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  74. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  75. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  77. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  78. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  79. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  80. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  81. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  82. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  83. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  84. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  85. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  86. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  87. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  88. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  89. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  90. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  91. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  92. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  93. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  94. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  95. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  96. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  97. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  98. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  99. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  100. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  101. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  102. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  103. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  104. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  105. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  106. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  107. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  108. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  109. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  110. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  111. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  112. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  113. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  114. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  115. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  116. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  117. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  118. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  119. package/cpp/skia/include/utils/SkBase64.h +2 -2
  120. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  121. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  122. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  123. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  124. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  125. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  126. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  127. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  128. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  129. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  130. package/cpp/skia/src/core/SkChecksum.h +2 -1
  131. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  132. package/cpp/skia/src/core/SkTHash.h +19 -9
  133. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  134. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  135. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  137. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  138. package/lib/commonjs/external/reanimated/index.js +13 -0
  139. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  140. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  142. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  144. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  147. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  149. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  150. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  151. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  152. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  153. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  154. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  155. package/lib/commonjs/views/types.js +3 -0
  156. package/lib/commonjs/views/types.js.map +1 -1
  157. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  158. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  159. package/lib/module/external/reanimated/index.d.ts +1 -0
  160. package/lib/module/external/reanimated/index.js +1 -0
  161. package/lib/module/external/reanimated/index.js.map +1 -1
  162. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  163. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  164. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  165. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  166. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  167. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  168. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  169. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  170. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  171. package/lib/module/skia/types/MaskFilter.js +3 -0
  172. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  173. package/lib/module/views/types.js +3 -0
  174. package/lib/module/views/types.js.map +1 -1
  175. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  176. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  177. package/libs/android/arm64-v8a/libskia.a +0 -0
  178. package/libs/android/arm64-v8a/libskottie.a +0 -0
  179. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  180. package/libs/android/arm64-v8a/libsksg.a +0 -0
  181. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  182. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  183. package/libs/android/arm64-v8a/libsvg.a +0 -0
  184. package/libs/android/armeabi-v7a/libskia.a +0 -0
  185. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  186. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  187. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  188. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  189. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  190. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  191. package/libs/android/x86/libskia.a +0 -0
  192. package/libs/android/x86/libskottie.a +0 -0
  193. package/libs/android/x86/libskparagraph.a +0 -0
  194. package/libs/android/x86/libsksg.a +0 -0
  195. package/libs/android/x86/libskshaper.a +0 -0
  196. package/libs/android/x86/libskunicode.a +0 -0
  197. package/libs/android/x86/libsvg.a +0 -0
  198. package/libs/android/x86_64/libskia.a +0 -0
  199. package/libs/android/x86_64/libskottie.a +0 -0
  200. package/libs/android/x86_64/libskparagraph.a +0 -0
  201. package/libs/android/x86_64/libsksg.a +0 -0
  202. package/libs/android/x86_64/libskshaper.a +0 -0
  203. package/libs/android/x86_64/libskunicode.a +0 -0
  204. package/libs/android/x86_64/libsvg.a +0 -0
  205. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  206. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  207. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  208. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  209. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  210. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  211. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  212. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  213. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  214. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  215. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  216. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  217. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  218. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  220. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  221. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  223. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  224. package/package.json +1 -1
  225. package/react-native-skia.podspec +1 -1
  226. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  227. package/src/external/reanimated/index.ts +1 -0
  228. package/src/external/reanimated/moduleWrapper.ts +6 -10
  229. package/src/external/reanimated/renderHelpers.ts +41 -1
  230. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  231. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  232. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  233. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  234. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  235. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  236. package/cpp/skia/include/core/SkTime.h +0 -63
  237. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  238. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  239. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  240. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  241. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  242. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  243. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  244. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  245. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -8,23 +8,24 @@
8
8
  #ifndef SkMesh_DEFINED
9
9
  #define SkMesh_DEFINED
10
10
 
11
- #include "include/core/SkTypes.h"
12
-
13
- #ifdef SK_ENABLE_SKSL
14
- #include "include/core/SkAlphaType.h"
11
+ #include "include/core/SkData.h"
15
12
  #include "include/core/SkRect.h"
16
13
  #include "include/core/SkRefCnt.h"
17
14
  #include "include/core/SkSpan.h"
18
15
  #include "include/core/SkString.h"
19
16
  #include "include/effects/SkRuntimeEffect.h"
17
+ #include "include/private/base/SkAPI.h"
20
18
 
19
+ #include <cstddef>
20
+ #include <cstdint>
21
21
  #include <memory>
22
+ #include <string_view>
22
23
  #include <tuple>
23
24
  #include <vector>
24
25
 
25
26
  class GrDirectContext;
26
27
  class SkColorSpace;
27
- class SkData;
28
+ enum SkAlphaType : int;
28
29
 
29
30
  namespace SkSL { struct Program; }
30
31
 
@@ -102,6 +103,7 @@ public:
102
103
  };
103
104
 
104
105
  using Uniform = SkRuntimeEffect::Uniform;
106
+ using Child = SkRuntimeEffect::Child;
105
107
 
106
108
  ~SkMeshSpecification();
107
109
 
@@ -166,13 +168,22 @@ public:
166
168
  */
167
169
  SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
168
170
 
169
- /** Returns pointer to the named uniform variable's description, or nullptr if not found. */
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
+ */
175
+ SkSpan<const Child> children() const { return SkSpan(fChildren); }
176
+
177
+ /** Returns a pointer to the named child's description, or nullptr if not found. */
178
+ const Child* findChild(std::string_view name) const;
179
+
180
+ /** Returns a pointer to the named uniform variable's description, or nullptr if not found. */
170
181
  const Uniform* findUniform(std::string_view name) const;
171
182
 
172
- /** Returns pointer to the named attribute, or nullptr if not found. */
183
+ /** Returns a pointer to the named attribute, or nullptr if not found. */
173
184
  const Attribute* findAttribute(std::string_view name) const;
174
185
 
175
- /** Returns pointer to the named varying, or nullptr if not found. */
186
+ /** Returns a pointer to the named varying, or nullptr if not found. */
176
187
  const Varying* findVarying(std::string_view name) const;
177
188
 
178
189
  size_t stride() const { return fStride; }
@@ -200,6 +211,7 @@ private:
200
211
  int passthroughLocalCoordsVaryingIndex,
201
212
  uint32_t deadVaryingMask,
202
213
  std::vector<Uniform> uniforms,
214
+ std::vector<Child> children,
203
215
  std::unique_ptr<const SkSL::Program>,
204
216
  std::unique_ptr<const SkSL::Program>,
205
217
  ColorType,
@@ -215,6 +227,7 @@ private:
215
227
  const std::vector<Attribute> fAttributes;
216
228
  const std::vector<Varying> fVaryings;
217
229
  const std::vector<Uniform> fUniforms;
230
+ const std::vector<Child> fChildren;
218
231
  const std::unique_ptr<const SkSL::Program> fVS;
219
232
  const std::unique_ptr<const SkSL::Program> fFS;
220
233
  const size_t fStride;
@@ -230,18 +243,18 @@ private:
230
243
  * A vertex buffer, a topology, optionally an index buffer, and a compatible SkMeshSpecification.
231
244
  *
232
245
  * The data in the vertex buffer is expected to contain the attributes described by the spec
233
- * for vertexCount vertices beginning at vertexOffset. vertexOffset must be aligned to the
246
+ * for vertexCount vertices, beginning at vertexOffset. vertexOffset must be aligned to the
234
247
  * SkMeshSpecification's vertex stride. The size of the buffer must be at least vertexOffset +
235
248
  * spec->stride()*vertexCount (even if vertex attributes contains pad at the end of the stride). If
236
- * the specified bounds does not contain all the points output by the spec's vertex program when
237
- * applied to the vertices in the custom mesh then the result is undefined.
249
+ * the specified bounds do not contain all the points output by the spec's vertex program when
250
+ * applied to the vertices in the custom mesh, then the result is undefined.
238
251
  *
239
252
  * MakeIndexed may be used to create an indexed mesh. indexCount indices are read from the index
240
- * buffer at the specified offset which must be aligned to 2. The indices are always unsigned 16bit
241
- * integers. The index count must be at least 3.
253
+ * buffer at the specified offset, which must be aligned to 2. The indices are always unsigned
254
+ * 16-bit integers. The index count must be at least 3.
242
255
  *
243
- * If Make() is used the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at least
244
- * 3.
256
+ * If Make() is used, the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at
257
+ * least 3.
245
258
  *
246
259
  * Both Make() and MakeIndexed() take a SkData with the uniform values. See
247
260
  * SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing
@@ -249,7 +262,7 @@ private:
249
262
  */
250
263
  class SkMesh {
251
264
  public:
252
- class IndexBuffer : public SkRefCnt {
265
+ class IndexBuffer : public SkRefCnt {
253
266
  public:
254
267
  virtual size_t size() const = 0;
255
268
 
@@ -292,64 +305,27 @@ public:
292
305
  SkMesh& operator=(const SkMesh&);
293
306
  SkMesh& operator=(SkMesh&&);
294
307
 
295
- /**
296
- * Makes an index buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
297
- * depending on whether GrDirectContext* is nullptr.
298
- *
299
- * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
300
- * uploaded to the GPU and a GPU-backed buffer is returned. It may
301
- * only be used to draw into SkSurfaces that are backed by the passed
302
- * GrDirectContext.
303
- * @param data The data used to populate the buffer, or nullptr to create a zero-
304
- * initialized buffer.
305
- * @param size Both the size of the data in 'data' and the size of the resulting
306
- * buffer.
307
- */
308
- static sk_sp<IndexBuffer> MakeIndexBuffer(GrDirectContext*, const void* data, size_t size);
309
-
310
- /**
311
- * Makes a copy of an index buffer. The implementation currently only supports a CPU-backed
312
- * source buffer.
313
- */
314
- static sk_sp<IndexBuffer> CopyIndexBuffer(GrDirectContext*, sk_sp<IndexBuffer>);
315
-
316
- /**
317
- * Makes a vertex buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed
318
- * depending on whether GrDirectContext* is nullptr.
319
- *
320
- * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is
321
- * uploaded to the GPU and a GPU-backed buffer is returned. It may
322
- * only be used to draw into SkSurfaces that are backed by the passed
323
- * GrDirectContext.
324
- * @param data The data used to populate the buffer, or nullptr to create a zero-
325
- * initialized buffer.
326
- * @param size Both the size of the data in 'data' and the size of the resulting
327
- * buffer.
328
- */
329
- static sk_sp<VertexBuffer> MakeVertexBuffer(GrDirectContext*, const void*, size_t size);
330
-
331
- /**
332
- * Makes a copy of a vertex buffer. The implementation currently only supports a CPU-backed
333
- * source buffer.
334
- */
335
- static sk_sp<VertexBuffer> CopyVertexBuffer(GrDirectContext*, sk_sp<VertexBuffer>);
336
-
337
308
  enum class Mode { kTriangles, kTriangleStrip };
338
309
 
339
310
  struct Result;
340
311
 
312
+ using ChildPtr = SkRuntimeEffect::ChildPtr;
313
+
341
314
  /**
342
315
  * Creates a non-indexed SkMesh. The returned SkMesh can be tested for validity using
343
316
  * SkMesh::isValid(). An invalid mesh simply fails to draws if passed to SkCanvas::drawMesh().
344
317
  * If the mesh is invalid the returned string give contain the reason for the failure (e.g. the
345
318
  * vertex buffer was null or uniform data too small).
346
319
  */
320
+
321
+ // TODO(b/40045302): support for `children` is a work-in-progress
347
322
  static Result Make(sk_sp<SkMeshSpecification>,
348
323
  Mode,
349
324
  sk_sp<VertexBuffer>,
350
325
  size_t vertexCount,
351
326
  size_t vertexOffset,
352
327
  sk_sp<const SkData> uniforms,
328
+ SkSpan<ChildPtr> children,
353
329
  const SkRect& bounds);
354
330
 
355
331
  /**
@@ -358,6 +334,8 @@ public:
358
334
  * If the mesh is invalid the returned string give contain the reason for the failure (e.g. the
359
335
  * index buffer was null or uniform data too small).
360
336
  */
337
+
338
+ // TODO(b/40045302): support for `children` is a work-in-progress
361
339
  static Result MakeIndexed(sk_sp<SkMeshSpecification>,
362
340
  Mode,
363
341
  sk_sp<VertexBuffer>,
@@ -367,6 +345,7 @@ public:
367
345
  size_t indexCount,
368
346
  size_t indexOffset,
369
347
  sk_sp<const SkData> uniforms,
348
+ SkSpan<ChildPtr> children,
370
349
  const SkRect& bounds);
371
350
 
372
351
  sk_sp<SkMeshSpecification> refSpec() const { return fSpec; }
@@ -389,13 +368,13 @@ public:
389
368
  sk_sp<const SkData> refUniforms() const { return fUniforms; }
390
369
  const SkData* uniforms() const { return fUniforms.get(); }
391
370
 
371
+ SkSpan<const ChildPtr> children() const { return SkSpan(fChildren); }
372
+
392
373
  SkRect bounds() const { return fBounds; }
393
374
 
394
375
  bool isValid() const;
395
376
 
396
377
  private:
397
- friend struct SkMeshPriv;
398
-
399
378
  std::tuple<bool, SkString> validate() const;
400
379
 
401
380
  sk_sp<SkMeshSpecification> fSpec;
@@ -404,6 +383,7 @@ private:
404
383
  sk_sp<IndexBuffer> fIB;
405
384
 
406
385
  sk_sp<const SkData> fUniforms;
386
+ std::vector<ChildPtr> fChildren;
407
387
 
408
388
  size_t fVOffset = 0; // Must be a multiple of spec->stride()
409
389
  size_t fVCount = 0;
@@ -418,6 +398,36 @@ private:
418
398
 
419
399
  struct SkMesh::Result { SkMesh mesh; SkString error; };
420
400
 
421
- #endif // SK_ENABLE_SKSL
401
+ namespace SkMeshes {
402
+ /**
403
+ * Makes a CPU-backed index buffer to be used with SkMeshes.
404
+ *
405
+ * @param data The data used to populate the buffer, or nullptr to create a zero-
406
+ * initialized buffer.
407
+ * @param size Both the size of the data in 'data' and the size of the resulting
408
+ * buffer.
409
+ */
410
+ SK_API sk_sp<SkMesh::IndexBuffer> MakeIndexBuffer(const void* data, size_t size);
411
+
412
+ /**
413
+ * Makes a copy of an index buffer. The copy will be CPU-backed.
414
+ */
415
+ SK_API sk_sp<SkMesh::IndexBuffer> CopyIndexBuffer(sk_sp<SkMesh::IndexBuffer>);
416
+
417
+ /**
418
+ * Makes a CPU-backed vertex buffer to be used with SkMeshes.
419
+ *
420
+ * @param data The data used to populate the buffer, or nullptr to create a zero-
421
+ * initialized buffer.
422
+ * @param size Both the size of the data in 'data' and the size of the resulting
423
+ * buffer.
424
+ */
425
+ SK_API sk_sp<SkMesh::VertexBuffer> MakeVertexBuffer(const void*, size_t size);
426
+
427
+ /**
428
+ * Makes a copy of a vertex buffer. The copy will be CPU-backed.
429
+ */
430
+ SK_API sk_sp<SkMesh::VertexBuffer> CopyVertexBuffer(sk_sp<SkMesh::VertexBuffer>);
431
+ } // namespace SkMeshes
422
432
 
423
433
  #endif
@@ -5,5 +5,5 @@
5
5
  * found in the LICENSE file.
6
6
  */
7
7
  #ifndef SK_MILESTONE
8
- #define SK_MILESTONE 116
8
+ #define SK_MILESTONE 119
9
9
  #endif
@@ -8,9 +8,34 @@
8
8
  #ifndef SkOverdrawCanvas_DEFINED
9
9
  #define SkOverdrawCanvas_DEFINED
10
10
 
11
+ #include "include/core/SkCanvas.h"
11
12
  #include "include/core/SkCanvasVirtualEnforcer.h"
13
+ #include "include/core/SkColor.h"
14
+ #include "include/core/SkPaint.h"
15
+ #include "include/core/SkSamplingOptions.h"
16
+ #include "include/core/SkScalar.h"
17
+ #include "include/private/base/SkAPI.h"
12
18
  #include "include/utils/SkNWayCanvas.h"
13
19
 
20
+ #include <cstddef>
21
+
22
+ class SkData;
23
+ class SkDrawable;
24
+ class SkImage;
25
+ class SkMatrix;
26
+ class SkPath;
27
+ class SkPicture;
28
+ class SkRRect;
29
+ class SkRegion;
30
+ class SkTextBlob;
31
+ class SkVertices;
32
+ enum class SkBlendMode;
33
+ namespace sktext { class GlyphRunList; }
34
+ struct SkDrawShadowRec;
35
+ struct SkPoint;
36
+ struct SkRSXform;
37
+ struct SkRect;
38
+
14
39
  /**
15
40
  * Captures all drawing commands. Rather than draw the actual content, this device
16
41
  * increments the alpha channel of each pixel every time it would have been touched
@@ -598,7 +598,7 @@ public:
598
598
 
599
599
  /** (to be made private)
600
600
  Returns true if SkPaint does not include elements requiring extensive computation
601
- to compute SkBaseDevice bounds of drawn geometry. For instance, SkPaint with SkPathEffect
601
+ to compute device bounds of drawn geometry. For instance, SkPaint with SkPathEffect
602
602
  always returns false.
603
603
 
604
604
  @return true if SkPaint allows for fast computation of bounds
@@ -330,10 +330,10 @@ public:
330
330
 
331
331
  /** Specifies whether SkPath is volatile; whether it will be altered or discarded
332
332
  by the caller after it is drawn. SkPath by default have volatile set false, allowing
333
- SkBaseDevice to attach a cache of data which speeds repeated drawing.
333
+ Skia to attach a cache of data which speeds repeated drawing.
334
334
 
335
335
  Mark temporary paths, discarded or modified after use, as volatile
336
- to inform SkBaseDevice that the path need not be cached.
336
+ to inform Skia that the path need not be cached.
337
337
 
338
338
  Mark animating SkPath volatile to improve performance.
339
339
  Mark unchanging SkPath non-volatile to improve repeated rendering.
@@ -1248,8 +1248,16 @@ public:
1248
1248
  the last contour or start a new contour.
1249
1249
  */
1250
1250
  enum AddPathMode {
1251
- kAppend_AddPathMode, //!< appended to destination unaltered
1252
- kExtend_AddPathMode, //!< add line if prior contour is not closed
1251
+ /** Contours are appended to the destination path as new contours.
1252
+ */
1253
+ kAppend_AddPathMode,
1254
+ /** Extends the last contour of the destination path with the first countour
1255
+ of the source path, connecting them with a line. If the last contour is
1256
+ closed, a new empty contour starting at its start point is extended instead.
1257
+ If the destination path is empty, the result is the source path.
1258
+ The last path of the result is closed only if the last path of the source is.
1259
+ */
1260
+ kExtend_AddPathMode,
1253
1261
  };
1254
1262
 
1255
1263
  /** Appends src to SkPath, offset by (dx, dy).
@@ -42,8 +42,7 @@ public:
42
42
  Returns false if there is no path, or a zero-length path was specified, in which case
43
43
  position and tangent are unchanged.
44
44
  */
45
- bool SK_WARN_UNUSED_RESULT getPosTan(SkScalar distance, SkPoint* position,
46
- SkVector* tangent);
45
+ [[nodiscard]] bool getPosTan(SkScalar distance, SkPoint* position, SkVector* tangent);
47
46
 
48
47
  enum MatrixFlags {
49
48
  kGetPosition_MatrixFlag = 0x01,
@@ -56,8 +55,8 @@ public:
56
55
  Returns false if there is no path, or a zero-length path was specified, in which case
57
56
  matrix is unchanged.
58
57
  */
59
- bool SK_WARN_UNUSED_RESULT getMatrix(SkScalar distance, SkMatrix* matrix,
60
- MatrixFlags flags = kGetPosAndTan_MatrixFlag);
58
+ [[nodiscard]] bool getMatrix(SkScalar distance, SkMatrix* matrix,
59
+ MatrixFlags flags = kGetPosAndTan_MatrixFlag);
61
60
 
62
61
  /** Given a start and stop distance, return in dst the intervening segment(s).
63
62
  If the segment is zero-length, return false, else return true.
@@ -10,19 +10,24 @@
10
10
 
11
11
  #include "include/core/SkRect.h"
12
12
  #include "include/core/SkRefCnt.h"
13
- #include "include/core/SkSamplingOptions.h"
14
- #include "include/core/SkShader.h"
15
- #include "include/core/SkTileMode.h"
13
+ #include "include/core/SkShader.h" // IWYU pragma: keep
16
14
  #include "include/core/SkTypes.h"
17
15
 
16
+ #include <atomic>
17
+ #include <cstddef>
18
+ #include <cstdint>
19
+
18
20
  class SkCanvas;
19
21
  class SkData;
20
- struct SkDeserialProcs;
21
- class SkImage;
22
22
  class SkMatrix;
23
- struct SkSerialProcs;
24
23
  class SkStream;
25
24
  class SkWStream;
25
+ enum class SkFilterMode;
26
+ struct SkDeserialProcs;
27
+ struct SkSerialProcs;
28
+
29
+ // TODO(kjlubick) Remove this after cleaning up clients
30
+ #include "include/core/SkTileMode.h" // IWYU pragma: keep
26
31
 
27
32
  /** \class SkPicture
28
33
  SkPicture records drawing commands made to SkCanvas. The command stream may be
@@ -157,6 +162,10 @@ public:
157
162
  may be used to provide user context to procs->fPictureProc; procs->fPictureProc
158
163
  is called with a pointer to SkPicture and user context.
159
164
 
165
+ The default behavior for serializing SkImages is to encode a nullptr. Should
166
+ clients want to, for example, encode these SkImages as PNGs so they can be
167
+ deserialized, they must provide SkSerialProcs with the fImageProc set to do so.
168
+
160
169
  @param procs custom serial data encoders; may be nullptr
161
170
  @return storage containing serialized SkPicture
162
171
 
@@ -171,6 +180,10 @@ public:
171
180
  may be used to provide user context to procs->fPictureProc; procs->fPictureProc
172
181
  is called with a pointer to SkPicture and user context.
173
182
 
183
+ The default behavior for serializing SkImages is to encode a nullptr. Should
184
+ clients want to, for example, encode these SkImages as PNGs so they can be
185
+ deserialized, they must provide SkSerialProcs with the fImageProc set to do so.
186
+
174
187
  @param stream writable serial data stream
175
188
  @param procs custom serial data encoders; may be nullptr
176
189
 
@@ -8,9 +8,10 @@
8
8
  #ifndef SkPictureRecorder_DEFINED
9
9
  #define SkPictureRecorder_DEFINED
10
10
 
11
- #include "include/core/SkBBHFactory.h"
12
- #include "include/core/SkPicture.h"
11
+ #include "include/core/SkRect.h"
13
12
  #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkScalar.h"
14
+ #include "include/private/base/SkAPI.h"
14
15
 
15
16
  #include <memory>
16
17
 
@@ -20,9 +21,11 @@ namespace android {
20
21
  };
21
22
  #endif
22
23
 
24
+ class SkBBHFactory;
25
+ class SkBBoxHierarchy;
23
26
  class SkCanvas;
24
27
  class SkDrawable;
25
- class SkPictureRecord;
28
+ class SkPicture;
26
29
  class SkRecord;
27
30
  class SkRecorder;
28
31
 
@@ -31,9 +34,6 @@ public:
31
34
  SkPictureRecorder();
32
35
  ~SkPictureRecorder();
33
36
 
34
- enum FinishFlags {
35
- };
36
-
37
37
  /** Returns the canvas that records the drawing commands.
38
38
  @param bounds the cull rect used when recording this picture. Any drawing the falls outside
39
39
  of this rect is undefined, and may be drawn or it may not.
@@ -17,7 +17,6 @@
17
17
  #include "include/core/SkSize.h"
18
18
  #include "include/private/base/SkAPI.h"
19
19
  #include "include/private/base/SkAssert.h"
20
- #include "include/private/base/SkAttributes.h"
21
20
 
22
21
  #include <cstddef>
23
22
  #include <cstdint>
@@ -115,7 +114,7 @@ public:
115
114
 
116
115
  /** Deprecated.
117
116
  */
118
- bool SK_WARN_UNUSED_RESULT reset(const SkMask& mask);
117
+ [[nodiscard]] bool reset(const SkMask& mask);
119
118
 
120
119
  /** Sets subset width, height, pixel address to intersection of SkPixmap with area,
121
120
  if intersection is not empty; and return true. Otherwise, leave subset unchanged
@@ -127,7 +126,7 @@ public:
127
126
  @param area bounds to intersect with SkPixmap
128
127
  @return true if intersection of SkPixmap and area is not empty
129
128
  */
130
- bool SK_WARN_UNUSED_RESULT extractSubset(SkPixmap* subset, const SkIRect& area) const;
129
+ [[nodiscard]] bool extractSubset(SkPixmap* subset, const SkIRect& area) const;
131
130
 
132
131
  /** Returns width, height, SkAlphaType, SkColorType, and SkColorSpace.
133
132
 
@@ -394,7 +394,7 @@ public:
394
394
  @param dy offset added to rect().fTop and rect().fBottom
395
395
  @return SkRRect bounds offset by (dx, dy), with unchanged corner radii
396
396
  */
397
- SkRRect SK_WARN_UNUSED_RESULT makeOffset(SkScalar dx, SkScalar dy) const {
397
+ [[nodiscard]] SkRRect makeOffset(SkScalar dx, SkScalar dy) const {
398
398
  return SkRRect(fRect.makeOffset(dx, dy), fRadii, fType);
399
399
  }
400
400