@shopify/react-native-skia 0.1.192 → 0.1.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/android/CMakeLists.txt +1 -1
  2. package/android/build.gradle +1 -0
  3. package/android/cpp/jni/JniPlatformContext.cpp +1 -1
  4. package/cpp/api/JsiSkImage.h +25 -4
  5. package/cpp/api/JsiSkImageFactory.h +2 -2
  6. package/cpp/api/JsiSkPath.h +8 -6
  7. package/cpp/rnskia/dom/base/Declaration.h +5 -7
  8. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
  9. package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
  10. package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
  11. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
  12. package/cpp/skia/include/android/SkImageAndroid.h +101 -0
  13. package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
  14. package/cpp/skia/include/codec/SkCodec.h +31 -17
  15. package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
  16. package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
  17. package/cpp/skia/include/config/SkUserConfig.h +61 -29
  18. package/cpp/skia/include/core/SkBitmap.h +25 -25
  19. package/cpp/skia/include/core/SkBlurTypes.h +0 -2
  20. package/cpp/skia/include/core/SkCanvas.h +32 -15
  21. package/cpp/skia/include/core/SkCapabilities.h +2 -2
  22. package/cpp/skia/include/core/SkColor.h +2 -0
  23. package/cpp/skia/include/core/SkColorPriv.h +19 -4
  24. package/cpp/skia/include/core/SkColorSpace.h +14 -17
  25. package/cpp/skia/include/core/SkColorType.h +1 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +1 -1
  27. package/cpp/skia/include/core/SkCoverageMode.h +0 -2
  28. package/cpp/skia/include/core/SkCubicMap.h +2 -0
  29. package/cpp/skia/include/core/SkData.h +5 -2
  30. package/cpp/skia/include/core/SkDataTable.h +6 -2
  31. package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
  32. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
  33. package/cpp/skia/include/core/SkDrawable.h +10 -2
  34. package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
  35. package/cpp/skia/include/core/SkFlattenable.h +4 -2
  36. package/cpp/skia/include/core/SkFont.h +1 -0
  37. package/cpp/skia/include/core/SkFontMetrics.h +1 -0
  38. package/cpp/skia/include/core/SkFontMgr.h +20 -29
  39. package/cpp/skia/include/core/SkFontStyle.h +4 -1
  40. package/cpp/skia/include/core/SkGraphics.h +21 -18
  41. package/cpp/skia/include/core/SkICC.h +3 -13
  42. package/cpp/skia/include/core/SkImage.h +395 -717
  43. package/cpp/skia/include/core/SkImageGenerator.h +19 -74
  44. package/cpp/skia/include/core/SkImageInfo.h +7 -5
  45. package/cpp/skia/include/core/SkM44.h +11 -0
  46. package/cpp/skia/include/core/SkMaskFilter.h +6 -3
  47. package/cpp/skia/include/core/SkMatrix.h +14 -4
  48. package/cpp/skia/include/core/SkMesh.h +52 -18
  49. package/cpp/skia/include/core/SkMilestone.h +1 -1
  50. package/cpp/skia/include/core/SkPaint.h +11 -34
  51. package/cpp/skia/include/core/SkPath.h +23 -4
  52. package/cpp/skia/include/core/SkPathBuilder.h +13 -5
  53. package/cpp/skia/include/core/SkPathMeasure.h +1 -1
  54. package/cpp/skia/include/core/SkPathTypes.h +0 -2
  55. package/cpp/skia/include/core/SkPathUtils.h +42 -0
  56. package/cpp/skia/include/core/SkPicture.h +3 -2
  57. package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
  58. package/cpp/skia/include/core/SkPixelRef.h +4 -8
  59. package/cpp/skia/include/core/SkPixmap.h +12 -20
  60. package/cpp/skia/include/core/SkPoint.h +4 -2
  61. package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
  62. package/cpp/skia/include/core/SkRRect.h +5 -1
  63. package/cpp/skia/include/core/SkRect.h +6 -3
  64. package/cpp/skia/include/core/SkRefCnt.h +9 -14
  65. package/cpp/skia/include/core/SkRegion.h +1 -1
  66. package/cpp/skia/include/core/SkScalar.h +2 -4
  67. package/cpp/skia/include/core/SkSerialProcs.h +18 -10
  68. package/cpp/skia/include/core/SkShader.h +1 -64
  69. package/cpp/skia/include/core/SkSize.h +2 -0
  70. package/cpp/skia/include/core/SkSpan.h +4 -112
  71. package/cpp/skia/include/core/SkStream.h +11 -12
  72. package/cpp/skia/include/core/SkString.h +9 -25
  73. package/cpp/skia/include/core/SkStrokeRec.h +1 -1
  74. package/cpp/skia/include/core/SkSurface.h +83 -61
  75. package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
  76. package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
  77. package/cpp/skia/include/core/SkTextBlob.h +2 -2
  78. package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
  79. package/cpp/skia/include/core/SkTime.h +1 -1
  80. package/cpp/skia/include/core/SkTypeface.h +9 -2
  81. package/cpp/skia/include/core/SkTypes.h +37 -466
  82. package/cpp/skia/include/core/SkVertices.h +2 -0
  83. package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
  84. package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
  85. package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
  86. package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
  87. package/cpp/skia/include/effects/SkGradientShader.h +65 -14
  88. package/cpp/skia/include/effects/SkImageFilters.h +0 -11
  89. package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
  90. package/cpp/skia/include/encode/SkEncoder.h +7 -3
  91. package/cpp/skia/include/encode/SkICC.h +36 -0
  92. package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
  93. package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
  94. package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
  95. package/cpp/skia/include/gpu/GpuTypes.h +23 -1
  96. package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
  97. package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
  98. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
  99. package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
  100. package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
  101. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
  102. package/cpp/skia/include/gpu/GrTypes.h +18 -18
  103. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
  104. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
  105. package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
  106. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
  107. package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
  108. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  109. package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
  110. package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
  111. package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
  112. package/cpp/skia/include/gpu/graphite/Context.h +85 -32
  113. package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
  114. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
  115. package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
  116. package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
  117. package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
  118. package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
  119. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
  120. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
  121. package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
  122. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
  123. package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
  124. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
  125. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
  126. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
  127. package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
  128. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  129. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  130. package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
  131. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
  132. package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
  133. package/cpp/skia/include/pathops/SkPathOps.h +3 -3
  134. package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
  135. package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
  136. package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
  137. package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
  138. package/cpp/skia/include/private/SkChecksum.h +32 -7
  139. package/cpp/skia/include/private/SkColorData.h +1 -26
  140. package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
  141. package/cpp/skia/include/private/SkGainmapShader.h +53 -0
  142. package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
  143. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
  144. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
  145. package/cpp/skia/include/private/SkOpts_spi.h +3 -1
  146. package/cpp/skia/include/private/SkPathRef.h +64 -47
  147. package/cpp/skia/include/private/SkSLDefines.h +5 -5
  148. package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
  149. package/cpp/skia/include/private/SkSpinlock.h +1 -1
  150. package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
  151. package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
  152. package/cpp/skia/include/private/base/SkAPI.h +52 -0
  153. package/cpp/skia/include/private/base/SkAlign.h +39 -0
  154. package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
  155. package/cpp/skia/include/private/base/SkAssert.h +92 -0
  156. package/cpp/skia/include/private/base/SkAttributes.h +102 -0
  157. package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
  158. package/cpp/skia/include/private/base/SkContainers.h +46 -0
  159. package/cpp/skia/include/private/base/SkDebug.h +27 -0
  160. package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
  161. package/cpp/skia/include/private/base/SkFeatures.h +151 -0
  162. package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
  163. package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
  164. package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
  165. package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
  166. package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
  167. package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
  168. package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
  169. package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
  170. package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
  171. package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
  172. package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
  173. package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
  174. package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
  175. package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
  176. package/cpp/skia/include/private/base/SkTArray.h +694 -0
  177. package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
  178. package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
  179. package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
  180. package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
  181. package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
  182. package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
  183. package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
  184. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
  185. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
  186. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
  187. package/cpp/skia/include/private/chromium/Slug.h +0 -9
  188. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
  189. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  190. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
  191. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
  192. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
  193. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
  194. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
  195. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
  196. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
  197. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
  198. package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
  199. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
  200. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
  201. package/cpp/skia/include/utils/SkCamera.h +1 -1
  202. package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
  203. package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
  204. package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
  205. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
  206. package/cpp/skia/include/utils/SkParsePath.h +1 -1
  207. package/cpp/skia/modules/skcms/skcms.h +14 -0
  208. package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
  209. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
  210. package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
  211. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
  212. package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
  213. package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
  214. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
  215. package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
  216. package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
  217. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
  218. package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
  219. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  220. package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
  221. package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
  222. package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
  223. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  224. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  225. package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
  226. package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
  227. package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
  228. package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
  229. package/libs/android/arm64-v8a/libskia.a +0 -0
  230. package/libs/android/arm64-v8a/libskottie.a +0 -0
  231. package/libs/android/arm64-v8a/libsksg.a +0 -0
  232. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  233. package/libs/android/arm64-v8a/libsvg.a +0 -0
  234. package/libs/android/armeabi-v7a/libskia.a +0 -0
  235. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  236. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  237. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  238. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  239. package/libs/android/x86/libskia.a +0 -0
  240. package/libs/android/x86/libskottie.a +0 -0
  241. package/libs/android/x86/libsksg.a +0 -0
  242. package/libs/android/x86/libskshaper.a +0 -0
  243. package/libs/android/x86/libsvg.a +0 -0
  244. package/libs/android/x86_64/libskia.a +0 -0
  245. package/libs/android/x86_64/libskottie.a +0 -0
  246. package/libs/android/x86_64/libsksg.a +0 -0
  247. package/libs/android/x86_64/libskshaper.a +0 -0
  248. package/libs/android/x86_64/libsvg.a +0 -0
  249. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  250. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  251. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  252. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  253. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  254. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  255. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  256. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  257. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  258. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  259. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  260. package/package.json +1 -1
  261. package/react-native-skia.podspec +1 -1
  262. package/scripts/install-npm.js +11 -1
  263. package/cpp/skia/include/core/SkImageEncoder.h +0 -71
  264. package/cpp/skia/include/gpu/GrConfig.h +0 -53
  265. package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
  266. package/cpp/skia/include/private/SkHalf.h +0 -38
  267. package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
  268. package/cpp/skia/include/private/SkSLIRNode.h +0 -64
  269. package/cpp/skia/include/private/SkSLLayout.h +0 -144
  270. package/cpp/skia/include/private/SkSLModifiers.h +0 -178
  271. package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
  272. package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
  273. package/cpp/skia/include/private/SkSLStatement.h +0 -86
  274. package/cpp/skia/include/private/SkSLString.h +0 -41
  275. package/cpp/skia/include/private/SkSLSymbol.h +0 -94
  276. package/cpp/skia/include/private/SkSafe_math.h +0 -52
  277. package/cpp/skia/include/private/SkStringView.h +0 -51
  278. package/cpp/skia/include/private/SkTArray.h +0 -655
  279. package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
  280. package/cpp/skia/include/private/SkVx.h +0 -1026
  281. package/cpp/skia/include/sksl/DSL.h +0 -37
  282. package/cpp/skia/include/sksl/DSLBlock.h +0 -58
  283. package/cpp/skia/include/sksl/DSLCase.h +0 -62
  284. package/cpp/skia/include/sksl/DSLCore.h +0 -492
  285. package/cpp/skia/include/sksl/DSLExpression.h +0 -241
  286. package/cpp/skia/include/sksl/DSLFunction.h +0 -113
  287. package/cpp/skia/include/sksl/DSLLayout.h +0 -92
  288. package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
  289. package/cpp/skia/include/sksl/DSLStatement.h +0 -82
  290. package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
  291. package/cpp/skia/include/sksl/DSLType.h +0 -271
  292. package/cpp/skia/include/sksl/DSLVar.h +0 -231
  293. package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
  294. package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
  295. package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
  296. package/cpp/skia/include/utils/SkRandom.h +0 -169
  297. package/cpp/skia/src/core/SkLRUCache.h +0 -126
  298. package/cpp/skia/src/core/SkTInternalLList.h +0 -302
  299. /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
  300. /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
  301. /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
@@ -1,104 +0,0 @@
1
- /*
2
- * Copyright 2021 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 SKSL_POSITION
9
- #define SKSL_POSITION
10
-
11
- #include "include/core/SkTypes.h"
12
-
13
- #include <cstdint>
14
- #include <string_view>
15
-
16
- namespace SkSL {
17
-
18
- class Position {
19
- public:
20
- Position()
21
- : fStartOffset(-1)
22
- , fLength(0) {}
23
-
24
- static Position Range(int startOffset, int endOffset) {
25
- SkASSERT(startOffset <= endOffset);
26
- SkASSERT(startOffset <= 0xFFFFFF);
27
- int length = endOffset - startOffset;
28
- Position result;
29
- result.fStartOffset = startOffset;
30
- result.fLength = length <= 0xFF ? length : 0xFF;
31
- return result;
32
- }
33
-
34
- bool valid() const {
35
- return fStartOffset != -1;
36
- }
37
-
38
- int line(std::string_view source) const;
39
-
40
- int startOffset() const {
41
- SkASSERT(this->valid());
42
- return fStartOffset;
43
- }
44
-
45
- int endOffset() const {
46
- SkASSERT(this->valid());
47
- return fStartOffset + fLength;
48
- }
49
-
50
- // Returns the position from this through, and including the entirety of, end.
51
- Position rangeThrough(Position end) const {
52
- if (fStartOffset == -1 || end.fStartOffset == -1) {
53
- return *this;
54
- }
55
- SkASSERTF(this->startOffset() <= end.startOffset() && this->endOffset() <= end.endOffset(),
56
- "Invalid range: (%d-%d) - (%d-%d)\n", this->startOffset(), this->endOffset(),
57
- end.startOffset(), end.endOffset());
58
- return Range(this->startOffset(), end.endOffset());
59
- }
60
-
61
- // Returns a position representing the character immediately after this position
62
- Position after() const {
63
- int endOffset = this->endOffset();
64
- return Range(endOffset, endOffset + 1);
65
- }
66
-
67
- bool operator==(const Position& other) const {
68
- return fStartOffset == other.fStartOffset && fLength == other.fLength;
69
- }
70
-
71
- bool operator!=(const Position& other) const {
72
- return !(*this == other);
73
- }
74
-
75
- bool operator>(const Position& other) const {
76
- return fStartOffset > other.fStartOffset;
77
- }
78
-
79
- bool operator>=(const Position& other) const {
80
- return fStartOffset >= other.fStartOffset;
81
- }
82
-
83
- bool operator<(const Position& other) const {
84
- return fStartOffset < other.fStartOffset;
85
- }
86
-
87
- bool operator<=(const Position& other) const {
88
- return fStartOffset <= other.fStartOffset;
89
- }
90
-
91
- private:
92
- int32_t fStartOffset : 24;
93
- uint32_t fLength : 8;
94
- };
95
-
96
- struct ForLoopPositions {
97
- Position initPosition = Position();
98
- Position conditionPosition = Position();
99
- Position nextPosition = Position();
100
- };
101
-
102
- } // namespace SkSL
103
-
104
- #endif
@@ -1,169 +0,0 @@
1
- /*
2
- * Copyright 2006 The Android Open Source Project
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 SkRandom_DEFINED
9
- #define SkRandom_DEFINED
10
-
11
- #include "include/core/SkScalar.h"
12
- #include "include/private/SkFixed.h"
13
- #include "include/private/SkFloatBits.h"
14
-
15
- /** \class SkRandom
16
-
17
- Utility class that implements pseudo random 32bit numbers using Marsaglia's
18
- multiply-with-carry "mother of all" algorithm. Unlike rand(), this class holds
19
- its own state, so that multiple instances can be used with no side-effects.
20
-
21
- Has a large period and all bits are well-randomized.
22
- */
23
- class SkRandom {
24
- public:
25
- SkRandom() { init(0); }
26
- SkRandom(uint32_t seed) { init(seed); }
27
- SkRandom(const SkRandom& rand) : fK(rand.fK), fJ(rand.fJ) {}
28
-
29
- SkRandom& operator=(const SkRandom& rand) {
30
- fK = rand.fK;
31
- fJ = rand.fJ;
32
-
33
- return *this;
34
- }
35
-
36
- /** Return the next pseudo random number as an unsigned 32bit value.
37
- */
38
- uint32_t nextU() {
39
- fK = kKMul*(fK & 0xffff) + (fK >> 16);
40
- fJ = kJMul*(fJ & 0xffff) + (fJ >> 16);
41
- return (((fK << 16) | (fK >> 16)) + fJ);
42
- }
43
-
44
- /** Return the next pseudo random number as a signed 32bit value.
45
- */
46
- int32_t nextS() { return (int32_t)this->nextU(); }
47
-
48
- /**
49
- * Returns value [0...1) as an IEEE float
50
- */
51
- float nextF() {
52
- int floatint = 0x3f800000 | (int)(this->nextU() >> 9);
53
- float f = SkBits2Float(floatint) - 1.0f;
54
- return f;
55
- }
56
-
57
- /**
58
- * Returns value [min...max) as a float
59
- */
60
- float nextRangeF(float min, float max) {
61
- return min + this->nextF() * (max - min);
62
- }
63
-
64
- /** Return the next pseudo random number, as an unsigned value of
65
- at most bitCount bits.
66
- @param bitCount The maximum number of bits to be returned
67
- */
68
- uint32_t nextBits(unsigned bitCount) {
69
- SkASSERT(bitCount > 0 && bitCount <= 32);
70
- return this->nextU() >> (32 - bitCount);
71
- }
72
-
73
- /** Return the next pseudo random unsigned number, mapped to lie within
74
- [min, max] inclusive.
75
- */
76
- uint32_t nextRangeU(uint32_t min, uint32_t max) {
77
- SkASSERT(min <= max);
78
- uint32_t range = max - min + 1;
79
- if (0 == range) {
80
- return this->nextU();
81
- } else {
82
- return min + this->nextU() % range;
83
- }
84
- }
85
-
86
- /** Return the next pseudo random unsigned number, mapped to lie within
87
- [0, count).
88
- */
89
- uint32_t nextULessThan(uint32_t count) {
90
- SkASSERT(count > 0);
91
- return this->nextRangeU(0, count - 1);
92
- }
93
-
94
- /** Return the next pseudo random number expressed as a SkScalar
95
- in the range [0..SK_Scalar1).
96
- */
97
- SkScalar nextUScalar1() { return SkFixedToScalar(this->nextUFixed1()); }
98
-
99
- /** Return the next pseudo random number expressed as a SkScalar
100
- in the range [min..max).
101
- */
102
- SkScalar nextRangeScalar(SkScalar min, SkScalar max) {
103
- return this->nextUScalar1() * (max - min) + min;
104
- }
105
-
106
- /** Return the next pseudo random number expressed as a SkScalar
107
- in the range [-SK_Scalar1..SK_Scalar1).
108
- */
109
- SkScalar nextSScalar1() { return SkFixedToScalar(this->nextSFixed1()); }
110
-
111
- /** Return the next pseudo random number as a bool.
112
- */
113
- bool nextBool() { return this->nextU() >= 0x80000000; }
114
-
115
- /** A biased version of nextBool().
116
- */
117
- bool nextBiasedBool(SkScalar fractionTrue) {
118
- SkASSERT(fractionTrue >= 0 && fractionTrue <= SK_Scalar1);
119
- return this->nextUScalar1() <= fractionTrue;
120
- }
121
-
122
- /** Reset the random object.
123
- */
124
- void setSeed(uint32_t seed) { init(seed); }
125
-
126
- private:
127
- // Initialize state variables with LCG.
128
- // We must ensure that both J and K are non-zero, otherwise the
129
- // multiply-with-carry step will forevermore return zero.
130
- void init(uint32_t seed) {
131
- fK = NextLCG(seed);
132
- if (0 == fK) {
133
- fK = NextLCG(fK);
134
- }
135
- fJ = NextLCG(fK);
136
- if (0 == fJ) {
137
- fJ = NextLCG(fJ);
138
- }
139
- SkASSERT(0 != fK && 0 != fJ);
140
- }
141
- static uint32_t NextLCG(uint32_t seed) { return kMul*seed + kAdd; }
142
-
143
- /** Return the next pseudo random number expressed as an unsigned SkFixed
144
- in the range [0..SK_Fixed1).
145
- */
146
- SkFixed nextUFixed1() { return this->nextU() >> 16; }
147
-
148
- /** Return the next pseudo random number expressed as a signed SkFixed
149
- in the range [-SK_Fixed1..SK_Fixed1).
150
- */
151
- SkFixed nextSFixed1() { return this->nextS() >> 15; }
152
-
153
- // See "Numerical Recipes in C", 1992 page 284 for these constants
154
- // For the LCG that sets the initial state from a seed
155
- enum {
156
- kMul = 1664525,
157
- kAdd = 1013904223
158
- };
159
- // Constants for the multiply-with-carry steps
160
- enum {
161
- kKMul = 30345,
162
- kJMul = 18000,
163
- };
164
-
165
- uint32_t fK;
166
- uint32_t fJ;
167
- };
168
-
169
- #endif
@@ -1,126 +0,0 @@
1
- /*
2
- * Copyright 2016 Google Inc.
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 SkLRUCache_DEFINED
9
- #define SkLRUCache_DEFINED
10
-
11
- #include "include/private/SkChecksum.h"
12
- #include "include/private/SkTHash.h"
13
- #include "src/core/SkTInternalLList.h"
14
-
15
- /**
16
- * A generic LRU cache.
17
- */
18
- template <typename K, typename V, typename HashK = SkGoodHash>
19
- class SkLRUCache : public SkNoncopyable {
20
- private:
21
- struct Entry {
22
- Entry(const K& key, V&& value)
23
- : fKey(key)
24
- , fValue(std::move(value)) {}
25
-
26
- K fKey;
27
- V fValue;
28
-
29
- SK_DECLARE_INTERNAL_LLIST_INTERFACE(Entry);
30
- };
31
-
32
- public:
33
- explicit SkLRUCache(int maxCount)
34
- : fMaxCount(maxCount) {}
35
-
36
- ~SkLRUCache() {
37
- Entry* node = fLRU.head();
38
- while (node) {
39
- fLRU.remove(node);
40
- delete node;
41
- node = fLRU.head();
42
- }
43
- }
44
-
45
- V* find(const K& key) {
46
- Entry** value = fMap.find(key);
47
- if (!value) {
48
- return nullptr;
49
- }
50
- Entry* entry = *value;
51
- if (entry != fLRU.head()) {
52
- fLRU.remove(entry);
53
- fLRU.addToHead(entry);
54
- } // else it's already at head position, don't need to do anything
55
- return &entry->fValue;
56
- }
57
-
58
- V* insert(const K& key, V value) {
59
- SkASSERT(!this->find(key));
60
-
61
- Entry* entry = new Entry(key, std::move(value));
62
- fMap.set(entry);
63
- fLRU.addToHead(entry);
64
- while (fMap.count() > fMaxCount) {
65
- this->remove(fLRU.tail()->fKey);
66
- }
67
- return &entry->fValue;
68
- }
69
-
70
- V* insert_or_update(const K& key, V value) {
71
- if (V* found = this->find(key)) {
72
- *found = std::move(value);
73
- return found;
74
- } else {
75
- return this->insert(key, std::move(value));
76
- }
77
- }
78
-
79
- int count() {
80
- return fMap.count();
81
- }
82
-
83
- template <typename Fn> // f(K*, V*)
84
- void foreach(Fn&& fn) {
85
- typename SkTInternalLList<Entry>::Iter iter;
86
- for (Entry* e = iter.init(fLRU, SkTInternalLList<Entry>::Iter::kHead_IterStart); e;
87
- e = iter.next()) {
88
- fn(&e->fKey, &e->fValue);
89
- }
90
- }
91
-
92
- void reset() {
93
- fMap.reset();
94
- for (Entry* e = fLRU.head(); e; e = fLRU.head()) {
95
- fLRU.remove(e);
96
- delete e;
97
- }
98
- }
99
-
100
- private:
101
- struct Traits {
102
- static const K& GetKey(Entry* e) {
103
- return e->fKey;
104
- }
105
-
106
- static uint32_t Hash(const K& k) {
107
- return HashK()(k);
108
- }
109
- };
110
-
111
- void remove(const K& key) {
112
- Entry** value = fMap.find(key);
113
- SkASSERT(value);
114
- Entry* entry = *value;
115
- SkASSERT(key == entry->fKey);
116
- fMap.remove(key);
117
- fLRU.remove(entry);
118
- delete entry;
119
- }
120
-
121
- int fMaxCount;
122
- SkTHashTable<Entry*, K, Traits> fMap;
123
- SkTInternalLList<Entry> fLRU;
124
- };
125
-
126
- #endif
@@ -1,302 +0,0 @@
1
- /*
2
- * Copyright 2012 Google Inc.
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 SkTInternalLList_DEFINED
9
- #define SkTInternalLList_DEFINED
10
-
11
- #include "include/core/SkTypes.h"
12
-
13
- /**
14
- * This macro creates the member variables required by the SkTInternalLList class. It should be
15
- * placed in the private section of any class that will be stored in a double linked list.
16
- */
17
- #define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName) \
18
- friend class SkTInternalLList<ClassName>; \
19
- /* back pointer to the owning list - for debugging */ \
20
- SkDEBUGCODE(SkTInternalLList<ClassName>* fList = nullptr;) \
21
- ClassName* fPrev = nullptr; \
22
- ClassName* fNext = nullptr
23
-
24
- /**
25
- * This class implements a templated internal doubly linked list data structure.
26
- */
27
- template <class T> class SkTInternalLList {
28
- public:
29
- SkTInternalLList() {}
30
-
31
- void reset() {
32
- fHead = nullptr;
33
- fTail = nullptr;
34
- }
35
-
36
- void remove(T* entry) {
37
- SkASSERT(fHead && fTail);
38
- SkASSERT(this->isInList(entry));
39
-
40
- T* prev = entry->fPrev;
41
- T* next = entry->fNext;
42
-
43
- if (prev) {
44
- prev->fNext = next;
45
- } else {
46
- fHead = next;
47
- }
48
- if (next) {
49
- next->fPrev = prev;
50
- } else {
51
- fTail = prev;
52
- }
53
-
54
- entry->fPrev = nullptr;
55
- entry->fNext = nullptr;
56
-
57
- #ifdef SK_DEBUG
58
- entry->fList = nullptr;
59
- #endif
60
- }
61
-
62
- void addToHead(T* entry) {
63
- SkASSERT(nullptr == entry->fPrev && nullptr == entry->fNext);
64
- SkASSERT(nullptr == entry->fList);
65
-
66
- entry->fPrev = nullptr;
67
- entry->fNext = fHead;
68
- if (fHead) {
69
- fHead->fPrev = entry;
70
- }
71
- fHead = entry;
72
- if (nullptr == fTail) {
73
- fTail = entry;
74
- }
75
-
76
- #ifdef SK_DEBUG
77
- entry->fList = this;
78
- #endif
79
- }
80
-
81
- void addToTail(T* entry) {
82
- SkASSERT(nullptr == entry->fPrev && nullptr == entry->fNext);
83
- SkASSERT(nullptr == entry->fList);
84
-
85
- entry->fPrev = fTail;
86
- entry->fNext = nullptr;
87
- if (fTail) {
88
- fTail->fNext = entry;
89
- }
90
- fTail = entry;
91
- if (nullptr == fHead) {
92
- fHead = entry;
93
- }
94
-
95
- #ifdef SK_DEBUG
96
- entry->fList = this;
97
- #endif
98
- }
99
-
100
- /**
101
- * Inserts a new list entry before an existing list entry. The new entry must not already be
102
- * a member of this or any other list. If existingEntry is NULL then the new entry is added
103
- * at the tail.
104
- */
105
- void addBefore(T* newEntry, T* existingEntry) {
106
- SkASSERT(newEntry);
107
-
108
- if (nullptr == existingEntry) {
109
- this->addToTail(newEntry);
110
- return;
111
- }
112
-
113
- SkASSERT(this->isInList(existingEntry));
114
- newEntry->fNext = existingEntry;
115
- T* prev = existingEntry->fPrev;
116
- existingEntry->fPrev = newEntry;
117
- newEntry->fPrev = prev;
118
- if (nullptr == prev) {
119
- SkASSERT(fHead == existingEntry);
120
- fHead = newEntry;
121
- } else {
122
- prev->fNext = newEntry;
123
- }
124
- #ifdef SK_DEBUG
125
- newEntry->fList = this;
126
- #endif
127
- }
128
-
129
- /**
130
- * Inserts a new list entry after an existing list entry. The new entry must not already be
131
- * a member of this or any other list. If existingEntry is NULL then the new entry is added
132
- * at the head.
133
- */
134
- void addAfter(T* newEntry, T* existingEntry) {
135
- SkASSERT(newEntry);
136
-
137
- if (nullptr == existingEntry) {
138
- this->addToHead(newEntry);
139
- return;
140
- }
141
-
142
- SkASSERT(this->isInList(existingEntry));
143
- newEntry->fPrev = existingEntry;
144
- T* next = existingEntry->fNext;
145
- existingEntry->fNext = newEntry;
146
- newEntry->fNext = next;
147
- if (nullptr == next) {
148
- SkASSERT(fTail == existingEntry);
149
- fTail = newEntry;
150
- } else {
151
- next->fPrev = newEntry;
152
- }
153
- #ifdef SK_DEBUG
154
- newEntry->fList = this;
155
- #endif
156
- }
157
-
158
- void concat(SkTInternalLList&& list) {
159
- if (list.isEmpty()) {
160
- return;
161
- }
162
-
163
- list.fHead->fPrev = fTail;
164
- if (!fHead) {
165
- SkASSERT(!list.fHead->fPrev);
166
- fHead = list.fHead;
167
- } else {
168
- SkASSERT(fTail);
169
- fTail->fNext = list.fHead;
170
- }
171
- fTail = list.fTail;
172
-
173
- #ifdef SK_DEBUG
174
- for (T* node = list.fHead; node; node = node->fNext) {
175
- SkASSERT(node->fList == &list);
176
- node->fList = this;
177
- }
178
- #endif
179
-
180
- list.fHead = list.fTail = nullptr;
181
- }
182
-
183
- bool isEmpty() const {
184
- SkASSERT(SkToBool(fHead) == SkToBool(fTail));
185
- return !fHead;
186
- }
187
-
188
- T* head() const { return fHead; }
189
- T* tail() const { return fTail; }
190
-
191
- class Iter {
192
- public:
193
- enum IterStart {
194
- kHead_IterStart,
195
- kTail_IterStart
196
- };
197
-
198
- Iter() : fCurr(nullptr) {}
199
- Iter(const Iter& iter) : fCurr(iter.fCurr) {}
200
- Iter& operator= (const Iter& iter) { fCurr = iter.fCurr; return *this; }
201
-
202
- T* init(const SkTInternalLList& list, IterStart startLoc) {
203
- if (kHead_IterStart == startLoc) {
204
- fCurr = list.fHead;
205
- } else {
206
- SkASSERT(kTail_IterStart == startLoc);
207
- fCurr = list.fTail;
208
- }
209
-
210
- return fCurr;
211
- }
212
-
213
- T* get() { return fCurr; }
214
-
215
- /**
216
- * Return the next/previous element in the list or NULL if at the end.
217
- */
218
- T* next() {
219
- if (nullptr == fCurr) {
220
- return nullptr;
221
- }
222
-
223
- fCurr = fCurr->fNext;
224
- return fCurr;
225
- }
226
-
227
- T* prev() {
228
- if (nullptr == fCurr) {
229
- return nullptr;
230
- }
231
-
232
- fCurr = fCurr->fPrev;
233
- return fCurr;
234
- }
235
-
236
- /**
237
- * C++11 range-for interface.
238
- */
239
- bool operator!=(const Iter& that) { return fCurr != that.fCurr; }
240
- T* operator*() { return this->get(); }
241
- void operator++() { this->next(); }
242
-
243
- private:
244
- T* fCurr;
245
- };
246
-
247
- Iter begin() const {
248
- Iter iter;
249
- iter.init(*this, Iter::kHead_IterStart);
250
- return iter;
251
- }
252
-
253
- Iter end() const { return Iter(); }
254
-
255
- #ifdef SK_DEBUG
256
- void validate() const {
257
- SkASSERT(!fHead == !fTail);
258
- Iter iter;
259
- for (T* item = iter.init(*this, Iter::kHead_IterStart); item; item = iter.next()) {
260
- SkASSERT(this->isInList(item));
261
- if (nullptr == item->fPrev) {
262
- SkASSERT(fHead == item);
263
- } else {
264
- SkASSERT(item->fPrev->fNext == item);
265
- }
266
- if (nullptr == item->fNext) {
267
- SkASSERT(fTail == item);
268
- } else {
269
- SkASSERT(item->fNext->fPrev == item);
270
- }
271
- }
272
- }
273
-
274
- /**
275
- * Debugging-only method that uses the list back pointer to check if 'entry' is indeed in 'this'
276
- * list.
277
- */
278
- bool isInList(const T* entry) const {
279
- return entry->fList == this;
280
- }
281
-
282
- /**
283
- * Debugging-only method that laboriously counts the list entries.
284
- */
285
- int countEntries() const {
286
- int count = 0;
287
- for (T* entry = fHead; entry; entry = entry->fNext) {
288
- ++count;
289
- }
290
- return count;
291
- }
292
- #endif // SK_DEBUG
293
-
294
- private:
295
- T* fHead = nullptr;
296
- T* fTail = nullptr;
297
-
298
- SkTInternalLList(const SkTInternalLList&) = delete;
299
- SkTInternalLList& operator=(const SkTInternalLList&) = delete;
300
- };
301
-
302
- #endif