@shopify/react-native-skia 0.1.212 → 0.1.214

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. package/android/build.gradle +5 -0
  2. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  3. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  4. package/cpp/api/JsiSkSurface.h +4 -1
  5. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  6. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  7. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  9. package/cpp/skia/include/codec/SkCodec.h +4 -3
  10. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  11. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  18. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  19. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  20. package/cpp/skia/include/core/SkBitmap.h +8 -8
  21. package/cpp/skia/include/core/SkCanvas.h +37 -50
  22. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  23. package/cpp/skia/include/core/SkColor.h +1 -1
  24. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  25. package/cpp/skia/include/core/SkColorTable.h +3 -0
  26. package/cpp/skia/include/core/SkColorType.h +2 -0
  27. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  28. package/cpp/skia/include/core/SkDocument.h +1 -0
  29. package/cpp/skia/include/core/SkFont.h +11 -2
  30. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  31. package/cpp/skia/include/core/SkGraphics.h +3 -13
  32. package/cpp/skia/include/core/SkImage.h +57 -111
  33. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  34. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  35. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  36. package/cpp/skia/include/core/SkM44.h +7 -3
  37. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  38. package/cpp/skia/include/core/SkMatrix.h +17 -17
  39. package/cpp/skia/include/core/SkMesh.h +71 -61
  40. package/cpp/skia/include/core/SkMilestone.h +1 -1
  41. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  42. package/cpp/skia/include/core/SkPaint.h +1 -1
  43. package/cpp/skia/include/core/SkPath.h +12 -4
  44. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  45. package/cpp/skia/include/core/SkPicture.h +19 -6
  46. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  47. package/cpp/skia/include/core/SkPixmap.h +2 -3
  48. package/cpp/skia/include/core/SkRRect.h +1 -1
  49. package/cpp/skia/include/core/SkRect.h +107 -110
  50. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  51. package/cpp/skia/include/core/SkRegion.h +7 -1
  52. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  53. package/cpp/skia/include/core/SkShader.h +9 -0
  54. package/cpp/skia/include/core/SkStream.h +9 -9
  55. package/cpp/skia/include/core/SkString.h +1 -1
  56. package/cpp/skia/include/core/SkSurface.h +14 -25
  57. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  58. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  59. package/cpp/skia/include/core/SkTypeface.h +7 -2
  60. package/cpp/skia/include/core/SkTypes.h +4 -12
  61. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  62. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  63. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  64. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  65. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  66. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  67. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  68. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  69. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  70. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  71. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  72. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  73. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  74. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  75. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  77. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  78. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  79. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  80. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  81. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  82. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  83. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  84. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  85. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  86. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  87. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  88. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  89. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  90. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  91. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  92. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  93. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  94. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  95. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  96. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  97. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  98. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  99. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  100. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  101. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  102. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  103. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  104. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  105. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  106. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  107. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  108. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  109. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  110. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  111. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  112. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  113. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  114. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  115. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  116. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  117. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  118. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  119. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  120. package/cpp/skia/include/utils/SkBase64.h +2 -2
  121. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  122. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  123. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  124. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  125. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  126. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  127. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  128. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  129. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  130. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  131. package/cpp/skia/src/core/SkChecksum.h +2 -1
  132. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  133. package/cpp/skia/src/core/SkTHash.h +19 -9
  134. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  135. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  137. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  138. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  139. package/lib/commonjs/external/reanimated/index.js +13 -0
  140. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  142. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  144. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  147. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  149. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  150. package/lib/commonjs/index.d.ts +1 -0
  151. package/lib/commonjs/index.js +21 -0
  152. package/lib/commonjs/index.js.map +1 -1
  153. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  154. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  155. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  156. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  157. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  158. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  159. package/lib/commonjs/views/types.js +3 -0
  160. package/lib/commonjs/views/types.js.map +1 -1
  161. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  162. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  163. package/lib/module/external/reanimated/index.d.ts +1 -0
  164. package/lib/module/external/reanimated/index.js +1 -0
  165. package/lib/module/external/reanimated/index.js.map +1 -1
  166. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  167. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  168. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  169. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  170. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  171. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  172. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  173. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  174. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  175. package/lib/module/index.d.ts +1 -0
  176. package/lib/module/index.js +1 -0
  177. package/lib/module/index.js.map +1 -1
  178. package/lib/module/skia/types/MaskFilter.js +3 -0
  179. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  180. package/lib/module/views/types.js +3 -0
  181. package/lib/module/views/types.js.map +1 -1
  182. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  183. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  184. package/lib/typescript/src/index.d.ts +1 -0
  185. package/libs/android/arm64-v8a/libskia.a +0 -0
  186. package/libs/android/arm64-v8a/libskottie.a +0 -0
  187. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  188. package/libs/android/arm64-v8a/libsksg.a +0 -0
  189. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  190. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  191. package/libs/android/arm64-v8a/libsvg.a +0 -0
  192. package/libs/android/armeabi-v7a/libskia.a +0 -0
  193. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  194. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  195. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  196. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  197. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  198. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  199. package/libs/android/x86/libskia.a +0 -0
  200. package/libs/android/x86/libskottie.a +0 -0
  201. package/libs/android/x86/libskparagraph.a +0 -0
  202. package/libs/android/x86/libsksg.a +0 -0
  203. package/libs/android/x86/libskshaper.a +0 -0
  204. package/libs/android/x86/libskunicode.a +0 -0
  205. package/libs/android/x86/libsvg.a +0 -0
  206. package/libs/android/x86_64/libskia.a +0 -0
  207. package/libs/android/x86_64/libskottie.a +0 -0
  208. package/libs/android/x86_64/libskparagraph.a +0 -0
  209. package/libs/android/x86_64/libsksg.a +0 -0
  210. package/libs/android/x86_64/libskshaper.a +0 -0
  211. package/libs/android/x86_64/libskunicode.a +0 -0
  212. package/libs/android/x86_64/libsvg.a +0 -0
  213. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  214. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  215. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  216. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  217. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  218. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  220. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  221. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  223. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  224. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  225. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  226. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  227. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  228. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  229. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  230. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  231. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  232. package/package.json +1 -1
  233. package/react-native-skia.podspec +1 -1
  234. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  235. package/src/external/reanimated/index.ts +1 -0
  236. package/src/external/reanimated/moduleWrapper.ts +6 -10
  237. package/src/external/reanimated/renderHelpers.ts +41 -1
  238. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  239. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  240. package/src/index.ts +1 -0
  241. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  242. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  243. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  244. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  245. package/cpp/skia/include/core/SkTime.h +0 -63
  246. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  247. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  248. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  249. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  250. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  251. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  252. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  253. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  254. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -12,52 +12,42 @@
12
12
  #include "include/private/base/SkFloatBits.h"
13
13
  #include "include/private/base/SkMath.h"
14
14
 
15
- #include <cfloat>
16
15
  #include <cmath>
17
16
  #include <cstdint>
18
17
  #include <cstring>
19
-
20
- constexpr float SK_FloatSqrt2 = 1.41421356f;
21
- constexpr float SK_FloatPI = 3.14159265f;
22
- constexpr double SK_DoublePI = 3.14159265358979323846264338327950288;
23
-
24
- // C++98 cmath std::pow seems to be the earliest portable way to get float pow.
25
- // However, on Linux including cmath undefines isfinite.
26
- // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608
27
- static inline float sk_float_pow(float base, float exp) {
28
- return powf(base, exp);
29
- }
30
-
31
- #define sk_float_sqrt(x) sqrtf(x)
32
- #define sk_float_sin(x) sinf(x)
33
- #define sk_float_cos(x) cosf(x)
34
- #define sk_float_tan(x) tanf(x)
35
- #define sk_float_floor(x) floorf(x)
36
- #define sk_float_ceil(x) ceilf(x)
37
- #define sk_float_trunc(x) truncf(x)
38
- #ifdef SK_BUILD_FOR_MAC
39
- # define sk_float_acos(x) static_cast<float>(acos(x))
40
- # define sk_float_asin(x) static_cast<float>(asin(x))
41
- #else
42
- # define sk_float_acos(x) acosf(x)
43
- # define sk_float_asin(x) asinf(x)
44
- #endif
45
- #define sk_float_atan2(y,x) atan2f(y,x)
46
- #define sk_float_abs(x) fabsf(x)
47
- #define sk_float_copysign(x, y) copysignf(x, y)
48
- #define sk_float_mod(x,y) fmodf(x,y)
49
- #define sk_float_exp(x) expf(x)
50
- #define sk_float_log(x) logf(x)
51
-
52
- constexpr int sk_float_sgn(float x) {
18
+ #include <limits>
19
+
20
+ inline constexpr float SK_FloatSqrt2 = 1.41421356f;
21
+ inline constexpr float SK_FloatPI = 3.14159265f;
22
+ inline constexpr double SK_DoublePI = 3.14159265358979323846264338327950288;
23
+
24
+ static inline float sk_float_sqrt(float x) { return std::sqrt(x); }
25
+ static inline float sk_float_sin(float x) { return std::sin(x); }
26
+ static inline float sk_float_cos(float x) { return std::cos(x); }
27
+ static inline float sk_float_tan(float x) { return std::tan(x); }
28
+ static inline float sk_float_floor(float x) { return std::floor(x); }
29
+ static inline float sk_float_ceil(float x) { return std::ceil(x); }
30
+ static inline float sk_float_trunc(float x) { return std::trunc(x); }
31
+ static inline float sk_float_acos(float x) { return std::acos(x); }
32
+ static inline float sk_float_asin(float x) { return std::asin(x); }
33
+ static inline float sk_float_atan2(float y, float x) { return std::atan2(y,x); }
34
+ static inline float sk_float_abs(float x) { return std::fabs(x); }
35
+ static inline float sk_float_copysign(float x, float y) { return std::copysign(x, y); }
36
+ static inline float sk_float_mod(float x, float y) { return std::fmod(x,y); }
37
+ static inline float sk_float_pow(float x, float y) { return std::pow(x, y); }
38
+ static inline float sk_float_exp(float x) { return std::exp(x); }
39
+ static inline float sk_float_log(float x) { return std::log(x); }
40
+ static inline float sk_float_log2(float x) { return std::log2(x); }
41
+
42
+ static constexpr int sk_float_sgn(float x) {
53
43
  return (0.0f < x) - (x < 0.0f);
54
44
  }
55
45
 
56
- constexpr float sk_float_degrees_to_radians(float degrees) {
46
+ static constexpr float sk_float_degrees_to_radians(float degrees) {
57
47
  return degrees * (SK_FloatPI / 180);
58
48
  }
59
49
 
60
- constexpr float sk_float_radians_to_degrees(float radians) {
50
+ static constexpr float sk_float_radians_to_degrees(float radians) {
61
51
  return radians * (180 / SK_FloatPI);
62
52
  }
63
53
 
@@ -66,16 +56,6 @@ constexpr float sk_float_radians_to_degrees(float radians) {
66
56
  // as floatf(x + .5f), they would be 1 higher than expected.
67
57
  #define sk_float_round(x) (float)sk_double_round((double)(x))
68
58
 
69
- // can't find log2f on android, but maybe that just a tool bug?
70
- #ifdef SK_BUILD_FOR_ANDROID
71
- static inline float sk_float_log2(float x) {
72
- const double inv_ln_2 = 1.44269504088896;
73
- return (float)(log(x) * inv_ln_2);
74
- }
75
- #else
76
- #define sk_float_log2(x) log2f(x)
77
- #endif
78
-
79
59
  static inline bool sk_float_isfinite(float x) {
80
60
  return SkFloatBits_IsFinite(SkFloat2Bits(x));
81
61
  }
@@ -97,22 +77,20 @@ static inline bool sk_float_isinf(float x) {
97
77
  return SkFloatBits_IsInf(SkFloat2Bits(x));
98
78
  }
99
79
 
100
- static inline bool sk_float_isnan(float x) {
101
- return !(x == x);
102
- }
103
-
104
- #define sk_double_isnan(a) sk_float_isnan(a)
80
+ static constexpr bool sk_float_isnan(float x) { return x != x; }
81
+ static constexpr bool sk_double_isnan(double x) { return x != x; }
105
82
 
106
- #define SK_MaxS32FitsInFloat 2147483520
107
- #define SK_MinS32FitsInFloat -SK_MaxS32FitsInFloat
83
+ inline constexpr int SK_MaxS32FitsInFloat = 2147483520;
84
+ inline constexpr int SK_MinS32FitsInFloat = -SK_MaxS32FitsInFloat;
108
85
 
109
- #define SK_MaxS64FitsInFloat (SK_MaxS64 >> (63-24) << (63-24)) // 0x7fffff8000000000
110
- #define SK_MinS64FitsInFloat -SK_MaxS64FitsInFloat
86
+ // 0x7fffff8000000000
87
+ inline constexpr int64_t SK_MaxS64FitsInFloat = SK_MaxS64 >> (63-24) << (63-24);
88
+ inline constexpr int64_t SK_MinS64FitsInFloat = -SK_MaxS64FitsInFloat;
111
89
 
112
90
  /**
113
91
  * Return the closest int for the given float. Returns SK_MaxS32FitsInFloat for NaN.
114
92
  */
115
- static inline int sk_float_saturate2int(float x) {
93
+ static constexpr int sk_float_saturate2int(float x) {
116
94
  x = x < SK_MaxS32FitsInFloat ? x : SK_MaxS32FitsInFloat;
117
95
  x = x > SK_MinS32FitsInFloat ? x : SK_MinS32FitsInFloat;
118
96
  return (int)x;
@@ -121,7 +99,7 @@ static inline int sk_float_saturate2int(float x) {
121
99
  /**
122
100
  * Return the closest int for the given double. Returns SK_MaxS32 for NaN.
123
101
  */
124
- static inline int sk_double_saturate2int(double x) {
102
+ static constexpr int sk_double_saturate2int(double x) {
125
103
  x = x < SK_MaxS32 ? x : SK_MaxS32;
126
104
  x = x > SK_MinS32 ? x : SK_MinS32;
127
105
  return (int)x;
@@ -130,7 +108,7 @@ static inline int sk_double_saturate2int(double x) {
130
108
  /**
131
109
  * Return the closest int64_t for the given float. Returns SK_MaxS64FitsInFloat for NaN.
132
110
  */
133
- static inline int64_t sk_float_saturate2int64(float x) {
111
+ static constexpr int64_t sk_float_saturate2int64(float x) {
134
112
  x = x < SK_MaxS64FitsInFloat ? x : SK_MaxS64FitsInFloat;
135
113
  x = x > SK_MinS64FitsInFloat ? x : SK_MinS64FitsInFloat;
136
114
  return (int64_t)x;
@@ -155,72 +133,47 @@ static inline int64_t sk_float_saturate2int64(float x) {
155
133
  // Clang thinks this is undefined, but it's actually implementation defined to return either
156
134
  // the largest float or infinity (one of the two bracketing representable floats). Good enough!
157
135
  SK_NO_SANITIZE("float-cast-overflow")
158
- static inline float sk_double_to_float(double x) {
136
+ static constexpr float sk_double_to_float(double x) {
159
137
  return static_cast<float>(x);
160
138
  }
161
139
 
162
- #define SK_FloatNaN std::numeric_limits<float>::quiet_NaN()
163
- #define SK_FloatInfinity (+std::numeric_limits<float>::infinity())
164
- #define SK_FloatNegativeInfinity (-std::numeric_limits<float>::infinity())
140
+ inline constexpr float SK_FloatNaN = std::numeric_limits<float>::quiet_NaN();
141
+ inline constexpr float SK_FloatInfinity = std::numeric_limits<float>::infinity();
142
+ inline constexpr float SK_FloatNegativeInfinity = -SK_FloatInfinity;
165
143
 
166
- #define SK_DoubleNaN std::numeric_limits<double>::quiet_NaN()
144
+ inline constexpr double SK_DoubleNaN = std::numeric_limits<double>::quiet_NaN();
167
145
 
168
- // Returns false if any of the floats are outside of [0...1]
169
- // Returns true if count is 0
146
+ // Calculate the midpoint between a and b. Similar to std::midpoint in c++20.
147
+ static constexpr float sk_float_midpoint(float a, float b) {
148
+ // Use double math to avoid underflow and overflow.
149
+ return static_cast<float>(0.5 * (static_cast<double>(a) + b));
150
+ }
151
+
152
+ // Returns false if any of the floats are outside the range [0...1].
153
+ // Returns true if count is 0.
170
154
  bool sk_floats_are_unit(const float array[], size_t count);
171
155
 
172
156
  static inline float sk_float_rsqrt_portable(float x) { return 1.0f / sk_float_sqrt(x); }
173
157
  static inline float sk_float_rsqrt (float x) { return 1.0f / sk_float_sqrt(x); }
174
158
 
175
- // Returns the log2 of the provided value, were that value to be rounded up to the next power of 2.
176
- // Returns 0 if value <= 0:
177
- // Never returns a negative number, even if value is NaN.
178
- //
179
- // sk_float_nextlog2((-inf..1]) -> 0
180
- // sk_float_nextlog2((1..2]) -> 1
181
- // sk_float_nextlog2((2..4]) -> 2
182
- // sk_float_nextlog2((4..8]) -> 3
183
- // ...
184
- static inline int sk_float_nextlog2(float x) {
185
- uint32_t bits = (uint32_t)SkFloat2Bits(x);
186
- bits += (1u << 23) - 1u; // Increment the exponent for non-powers-of-2.
187
- int exp = ((int32_t)bits >> 23) - 127;
188
- return exp & ~(exp >> 31); // Return 0 for negative or denormalized floats, and exponents < 0.
189
- }
190
-
191
- // This is the number of significant digits we can print in a string such that when we read that
192
- // string back we get the floating point number we expect. The minimum value C requires is 6, but
193
- // most compilers support 9
194
- #ifdef FLT_DECIMAL_DIG
195
- #define SK_FLT_DECIMAL_DIG FLT_DECIMAL_DIG
196
- #else
197
- #define SK_FLT_DECIMAL_DIG 9
198
- #endif
159
+ // The number of significant digits to print.
160
+ inline constexpr int SK_FLT_DECIMAL_DIG = std::numeric_limits<float>::max_digits10;
199
161
 
200
- // IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not
162
+ // IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not,
201
163
  // so we have a helper that suppresses the possible undefined-behavior warnings.
202
-
203
164
  SK_NO_SANITIZE("float-divide-by-zero")
204
- static inline float sk_ieee_float_divide(float numer, float denom) {
165
+ static constexpr float sk_ieee_float_divide(float numer, float denom) {
205
166
  return numer / denom;
206
167
  }
207
168
 
208
169
  SK_NO_SANITIZE("float-divide-by-zero")
209
- static inline double sk_ieee_double_divide(double numer, double denom) {
170
+ static constexpr double sk_ieee_double_divide(double numer, double denom) {
210
171
  return numer / denom;
211
172
  }
212
173
 
213
- // While we clean up divide by zero, we'll replace places that do divide by zero with this TODO.
214
- static inline float sk_ieee_float_divide_TODO_IS_DIVIDE_BY_ZERO_SAFE_HERE(float n, float d) {
215
- return sk_ieee_float_divide(n,d);
216
- }
217
-
218
- static inline float sk_fmaf(float f, float m, float a) {
219
- #if defined(FP_FAST_FMA)
220
- return std::fmaf(f,m,a);
221
- #else
222
- return f*m+a;
223
- #endif
174
+ // Return a*b + c.
175
+ static inline float sk_fmaf(float a, float b, float c) {
176
+ return std::fma(a, b, c);
224
177
  }
225
178
 
226
179
  // Returns true iff the provided number is within a small epsilon of 0.
@@ -9,6 +9,7 @@
9
9
  #define SkSpan_DEFINED
10
10
 
11
11
  #include "include/private/base/SkAssert.h"
12
+ #include "include/private/base/SkDebug.h"
12
13
  #include "include/private/base/SkTo.h"
13
14
 
14
15
  #include <cstddef>
@@ -82,11 +83,10 @@ public:
82
83
  constexpr SkSpan& operator=(const SkSpan& that) = default;
83
84
 
84
85
  constexpr T& operator [] (size_t i) const {
85
- SkASSERT(i < this->size());
86
- return fPtr[i];
86
+ return fPtr[sk_collection_check_bounds(i, this->size())];
87
87
  }
88
- constexpr T& front() const { return fPtr[0]; }
89
- constexpr T& back() const { return fPtr[fSize - 1]; }
88
+ constexpr T& front() const { sk_collection_not_empty(this->empty()); return fPtr[0]; }
89
+ constexpr T& back() const { sk_collection_not_empty(this->empty()); return fPtr[fSize - 1]; }
90
90
  constexpr T* begin() const { return fPtr; }
91
91
  constexpr T* end() const { return fPtr + fSize; }
92
92
  constexpr auto rbegin() const { return std::make_reverse_iterator(this->end()); }
@@ -96,24 +96,30 @@ public:
96
96
  constexpr bool empty() const { return fSize == 0; }
97
97
  constexpr size_t size_bytes() const { return fSize * sizeof(T); }
98
98
  constexpr SkSpan<T> first(size_t prefixLen) const {
99
- SkASSERT(prefixLen <= this->size());
100
- return SkSpan{fPtr, prefixLen};
99
+ return SkSpan{fPtr, sk_collection_check_length(prefixLen, fSize)};
101
100
  }
102
101
  constexpr SkSpan<T> last(size_t postfixLen) const {
103
- SkASSERT(postfixLen <= this->size());
104
- return SkSpan{fPtr + (this->size() - postfixLen), postfixLen};
102
+ return SkSpan{fPtr + (this->size() - postfixLen),
103
+ sk_collection_check_length(postfixLen, fSize)};
105
104
  }
106
105
  constexpr SkSpan<T> subspan(size_t offset) const {
107
106
  return this->subspan(offset, this->size() - offset);
108
107
  }
109
108
  constexpr SkSpan<T> subspan(size_t offset, size_t count) const {
110
- SkASSERT(offset <= this->size());
111
- SkASSERT(count <= this->size() - offset);
112
- return SkSpan{fPtr + offset, count};
109
+ const size_t safeOffset = sk_collection_check_length(offset, fSize);
110
+
111
+ // Should read offset + count > size(), but that could overflow. We know that safeOffset
112
+ // is <= size, therefore the subtraction will not overflow.
113
+ if (count > this->size() - safeOffset) SK_UNLIKELY {
114
+ // The count is too large.
115
+ SkUNREACHABLE;
116
+ }
117
+ return SkSpan{fPtr + safeOffset, count};
113
118
  }
114
119
 
115
120
  private:
116
- static const constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
121
+ static constexpr size_t kMaxSize = std::numeric_limits<size_t>::max() / sizeof(T);
122
+
117
123
  T* fPtr;
118
124
  size_t fSize;
119
125
  };
@@ -12,6 +12,7 @@
12
12
  #include "include/private/base/SkAssert.h"
13
13
  #include "include/private/base/SkAttributes.h"
14
14
  #include "include/private/base/SkContainers.h"
15
+ #include "include/private/base/SkDebug.h"
15
16
  #include "include/private/base/SkMalloc.h"
16
17
  #include "include/private/base/SkMath.h"
17
18
  #include "include/private/base/SkSpan_impl.h"
@@ -277,7 +278,7 @@ public:
277
278
  * Removes the last element. Not safe to call when size() == 0.
278
279
  */
279
280
  void pop_back() {
280
- SkASSERT(fSize > 0);
281
+ sk_collection_not_empty(this->empty());
281
282
  --fSize;
282
283
  fData[fSize].~T();
283
284
  }
@@ -386,15 +387,11 @@ public:
386
387
  * Get the i^th element.
387
388
  */
388
389
  T& operator[] (int i) {
389
- SkASSERT(i < this->size());
390
- SkASSERT(i >= 0);
391
- return fData[i];
390
+ return fData[sk_collection_check_bounds(i, this->size())];
392
391
  }
393
392
 
394
393
  const T& operator[] (int i) const {
395
- SkASSERT(i < this->size());
396
- SkASSERT(i >= 0);
397
- return fData[i];
394
+ return fData[sk_collection_check_bounds(i, this->size())];
398
395
  }
399
396
 
400
397
  T& at(int i) { return (*this)[i]; }
@@ -403,30 +400,38 @@ public:
403
400
  /**
404
401
  * equivalent to operator[](0)
405
402
  */
406
- T& front() { SkASSERT(fSize > 0); return fData[0];}
403
+ T& front() {
404
+ sk_collection_not_empty(this->empty());
405
+ return fData[0];
406
+ }
407
407
 
408
- const T& front() const { SkASSERT(fSize > 0); return fData[0];}
408
+ const T& front() const {
409
+ sk_collection_not_empty(this->empty());
410
+ return fData[0];
411
+ }
409
412
 
410
413
  /**
411
414
  * equivalent to operator[](size() - 1)
412
415
  */
413
- T& back() { SkASSERT(fSize); return fData[fSize - 1];}
416
+ T& back() {
417
+ sk_collection_not_empty(this->empty());
418
+ return fData[fSize - 1];
419
+ }
414
420
 
415
- const T& back() const { SkASSERT(fSize > 0); return fData[fSize - 1];}
421
+ const T& back() const {
422
+ sk_collection_not_empty(this->empty());
423
+ return fData[fSize - 1];
424
+ }
416
425
 
417
426
  /**
418
427
  * equivalent to operator[](size()-1-i)
419
428
  */
420
429
  T& fromBack(int i) {
421
- SkASSERT(i >= 0);
422
- SkASSERT(i < this->size());
423
- return fData[fSize - i - 1];
430
+ return (*this)[fSize - i - 1];
424
431
  }
425
432
 
426
433
  const T& fromBack(int i) const {
427
- SkASSERT(i >= 0);
428
- SkASSERT(i < this->size());
429
- return fData[fSize - i - 1];
434
+ return (*this)[fSize - i - 1];
430
435
  }
431
436
 
432
437
  bool operator==(const TArray<T, MEM_MOVE>& right) const {
@@ -10,6 +10,7 @@
10
10
 
11
11
  #include "include/private/base/SkAPI.h"
12
12
  #include "include/private/base/SkAssert.h"
13
+ #include "include/private/base/SkDebug.h"
13
14
  #include "include/private/base/SkTo.h"
14
15
 
15
16
  #include <algorithm>
@@ -152,20 +153,18 @@ public:
152
153
  const T* end() const { return this->data() + this->size(); }
153
154
 
154
155
  T& operator[](int index) {
155
- SkASSERT(index < this->size());
156
- return this->data()[index];
156
+ return this->data()[sk_collection_check_bounds(index, this->size())];
157
157
  }
158
158
  const T& operator[](int index) const {
159
- SkASSERT(index < this->size());
160
- return this->data()[index];
159
+ return this->data()[sk_collection_check_bounds(index, this->size())];
161
160
  }
162
161
 
163
162
  const T& back() const {
164
- SkASSERT(this->size() > 0);
163
+ sk_collection_not_empty(this->empty());
165
164
  return this->data()[this->size() - 1];
166
165
  }
167
166
  T& back() {
168
- SkASSERT(this->size() > 0);
167
+ sk_collection_not_empty(this->empty());
169
168
  return this->data()[this->size() - 1];
170
169
  }
171
170
 
@@ -13,6 +13,7 @@
13
13
  #include "include/private/base/SkDebug.h"
14
14
  #include "include/private/base/SkMalloc.h"
15
15
  #include "include/private/base/SkTLogic.h"
16
+ #include "include/private/base/SkTo.h"
16
17
 
17
18
  #include <array>
18
19
  #include <cstddef>
@@ -98,49 +99,69 @@ namespace skia_private {
98
99
  template <typename T> class AutoTArray {
99
100
  public:
100
101
  AutoTArray() {}
101
- /** Allocate count number of T elements
102
- */
103
- explicit AutoTArray(int count) {
104
- SkASSERT(count >= 0);
105
- if (count) {
106
- fArray.reset(new T[count]);
107
- }
108
- SkDEBUGCODE(fCount = count;)
102
+ // Allocate size number of T elements
103
+ explicit AutoTArray(size_t size) {
104
+ fSize = check_size_bytes_too_big<T>(size);
105
+ fData.reset(size > 0 ? new T[size] : nullptr);
109
106
  }
110
107
 
111
- AutoTArray(AutoTArray&& other) : fArray(std::move(other.fArray)) {
112
- SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;)
108
+ // TODO: remove when all uses are gone.
109
+ explicit AutoTArray(int size) : AutoTArray(SkToSizeT(size)) {}
110
+
111
+ AutoTArray(AutoTArray&& other) : fData(std::move(other.fData)) {
112
+ fSize = std::exchange(other.fSize, 0);
113
113
  }
114
114
  AutoTArray& operator=(AutoTArray&& other) {
115
115
  if (this != &other) {
116
- fArray = std::move(other.fArray);
117
- SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;)
116
+ fData = std::move(other.fData);
117
+ fSize = std::exchange(other.fSize, 0);
118
118
  }
119
119
  return *this;
120
120
  }
121
121
 
122
- /** Reallocates given a new count. Reallocation occurs even if new count equals old count.
123
- */
124
- void reset(int count = 0) { *this = AutoTArray(count); }
122
+ // Reallocates given a new count. Reallocation occurs even if new count equals old count.
123
+ void reset(size_t count = 0) {
124
+ *this = AutoTArray(count);
125
+ }
125
126
 
126
- /** Return the array of T elements. Will be NULL if count == 0
127
- */
128
- T* get() const { return fArray.get(); }
127
+ T* get() const { return fData.get(); }
129
128
 
130
- /** Return the nth element in the array
131
- */
132
- T& operator[](int index) const {
133
- SkASSERT((unsigned)index < (unsigned)fCount);
134
- return fArray[index];
129
+ T& operator[](size_t index) const {
130
+ return fData[sk_collection_check_bounds(index, fSize)];
135
131
  }
136
132
 
137
- /** Aliases matching other types, like std::vector. */
138
- const T* data() const { return fArray.get(); }
139
- T* data() { return fArray.get(); }
133
+ const T* data() const { return fData.get(); }
134
+ T* data() { return fData.get(); }
135
+
136
+ size_t size() const { return fSize; }
137
+ bool empty() const { return fSize == 0; }
138
+ size_t size_bytes() const { return sizeof(T) * fSize; }
139
+
140
+ T* begin() {
141
+ return fData;
142
+ }
143
+ const T* begin() const {
144
+ return fData;
145
+ }
146
+
147
+ // It's safe to use fItemArray + fSize because if fItemArray is nullptr then adding 0 is
148
+ // valid and returns nullptr. See [expr.add] in the C++ standard.
149
+ T* end() {
150
+ if (fData == nullptr) {
151
+ SkASSERT(fSize == 0);
152
+ }
153
+ return fData + fSize;
154
+ }
155
+ const T* end() const {
156
+ if (fData == nullptr) {
157
+ SkASSERT(fSize == 0);
158
+ }
159
+ return fData + fSize;
160
+ }
140
161
 
141
162
  private:
142
- std::unique_ptr<T[]> fArray;
143
- SkDEBUGCODE(int fCount = 0;)
163
+ std::unique_ptr<T[]> fData;
164
+ size_t fSize = 0;
144
165
  };
145
166
 
146
167
  /** Wraps AutoTArray, with room for kCountRequested elements preallocated.
@@ -223,8 +244,7 @@ public:
223
244
  /** Return the nth element in the array
224
245
  */
225
246
  T& operator[](int index) const {
226
- SkASSERT(index < fCount);
227
- return fArray[index];
247
+ return fArray[sk_collection_check_bounds(index, fCount)];
228
248
  }
229
249
 
230
250
  /** Aliases matching other types, like std::vector. */
@@ -10,7 +10,6 @@
10
10
 
11
11
  #include "include/core/SkRefCnt.h"
12
12
  #include "include/core/SkTypes.h"
13
- #include "include/gpu/GrTypes.h"
14
13
  #include "include/private/chromium/GrDeferredDisplayList.h"
15
14
  #include "include/private/chromium/GrSurfaceCharacterization.h"
16
15
 
@@ -25,6 +24,10 @@ class GrPromiseImageTexture;
25
24
  class SkSurface;
26
25
  enum SkAlphaType : int;
27
26
  enum SkColorType : int;
27
+ enum GrSurfaceOrigin : int;
28
+ namespace skgpu {
29
+ enum class Mipmapped : bool;
30
+ }
28
31
 
29
32
  /*
30
33
  * This class is intended to be used as:
@@ -64,7 +67,7 @@ public:
64
67
  sk_sp<SkImage> makePromiseTexture(const GrBackendFormat& backendFormat,
65
68
  int width,
66
69
  int height,
67
- GrMipmapped mipmapped,
70
+ skgpu::Mipmapped mipmapped,
68
71
  GrSurfaceOrigin origin,
69
72
  SkColorType colorType,
70
73
  SkAlphaType alphaType,
@@ -144,7 +144,7 @@ private:
144
144
  : fContextInfo(std::move(contextInfo))
145
145
  , fCacheMaxResourceBytes(cacheMaxResourceBytes)
146
146
  , fImageInfo(ii)
147
- , fBackendFormat(backendFormat)
147
+ , fBackendFormat(std::move(backendFormat))
148
148
  , fOrigin(origin)
149
149
  , fSampleCnt(sampleCnt)
150
150
  , fIsTextureable(isTextureable)
@@ -182,7 +182,7 @@ private:
182
182
  fCacheMaxResourceBytes = cacheMaxResourceBytes;
183
183
 
184
184
  fImageInfo = ii;
185
- fBackendFormat = backendFormat;
185
+ fBackendFormat = std::move(backendFormat);
186
186
  fOrigin = origin;
187
187
  fSampleCnt = sampleCnt;
188
188
  fIsTextureable = isTextureable;
@@ -8,20 +8,23 @@
8
8
  #ifndef SkChromeRemoteGlyphCache_DEFINED
9
9
  #define SkChromeRemoteGlyphCache_DEFINED
10
10
 
11
- #include <memory>
12
- #include <vector>
13
-
14
- #include "include/core/SkData.h"
15
11
  #include "include/core/SkRefCnt.h"
16
12
  #include "include/core/SkTypeface.h"
17
- #include "include/utils/SkNoDrawCanvas.h"
13
+ #include "include/private/base/SkAPI.h"
14
+
15
+ #include <cstddef>
16
+ #include <cstdint>
17
+ #include <memory>
18
+ #include <vector>
18
19
 
19
- struct SkPackedGlyphID;
20
20
  class SkAutoDescriptor;
21
+ class SkCanvas;
22
+ class SkColorSpace;
21
23
  class SkStrikeCache;
22
24
  class SkStrikeClientImpl;
23
- class SkStrikeServer;
24
25
  class SkStrikeServerImpl;
26
+ class SkSurfaceProps;
27
+ struct SkDeserialProcs;
25
28
  namespace sktext::gpu { class Slug; }
26
29
 
27
30
  using SkDiscardableHandleId = uint32_t;
@@ -140,7 +143,9 @@ public:
140
143
 
141
144
  // Given a buffer, unflatten into a slug making sure to do the typefaceID translation from
142
145
  // renderer to GPU. Returns nullptr if there was a problem.
143
- sk_sp<sktext::gpu::Slug> deserializeSlugForTest(const void* data, size_t size) const;
146
+ sk_sp<sktext::gpu::Slug> deserializeSlugForTest(const void* data,
147
+ size_t size,
148
+ const SkDeserialProcs&) const;
144
149
 
145
150
  private:
146
151
  std::unique_ptr<SkStrikeClientImpl> fImpl;
@@ -47,7 +47,7 @@ public:
47
47
  *
48
48
  * Nested calls to lock are not allowed.
49
49
  */
50
- virtual bool SK_WARN_UNUSED_RESULT lock() = 0;
50
+ [[nodiscard]] virtual bool lock() = 0;
51
51
 
52
52
  /**
53
53
  * Returns the current pointer for the discardable memory. This call is ONLY