@shopify/react-native-skia 0.1.192 → 0.1.194

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 (304) 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/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +104 -103
  5. package/cpp/api/JsiSkImage.h +25 -4
  6. package/cpp/api/JsiSkImageFactory.h +2 -2
  7. package/cpp/api/JsiSkPath.h +8 -6
  8. package/cpp/rnskia/dom/base/Declaration.h +5 -7
  9. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +3 -1
  10. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
  11. package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
  12. package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
  13. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
  14. package/cpp/skia/include/android/SkImageAndroid.h +101 -0
  15. package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
  16. package/cpp/skia/include/codec/SkCodec.h +31 -17
  17. package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
  18. package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
  19. package/cpp/skia/include/config/SkUserConfig.h +61 -29
  20. package/cpp/skia/include/core/SkBitmap.h +25 -25
  21. package/cpp/skia/include/core/SkBlurTypes.h +0 -2
  22. package/cpp/skia/include/core/SkCanvas.h +32 -15
  23. package/cpp/skia/include/core/SkCapabilities.h +2 -2
  24. package/cpp/skia/include/core/SkColor.h +2 -0
  25. package/cpp/skia/include/core/SkColorPriv.h +19 -4
  26. package/cpp/skia/include/core/SkColorSpace.h +14 -17
  27. package/cpp/skia/include/core/SkColorType.h +1 -0
  28. package/cpp/skia/include/core/SkContourMeasure.h +1 -1
  29. package/cpp/skia/include/core/SkCoverageMode.h +0 -2
  30. package/cpp/skia/include/core/SkCubicMap.h +2 -0
  31. package/cpp/skia/include/core/SkData.h +5 -2
  32. package/cpp/skia/include/core/SkDataTable.h +6 -2
  33. package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
  34. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
  35. package/cpp/skia/include/core/SkDrawable.h +10 -2
  36. package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
  37. package/cpp/skia/include/core/SkFlattenable.h +4 -2
  38. package/cpp/skia/include/core/SkFont.h +1 -0
  39. package/cpp/skia/include/core/SkFontMetrics.h +1 -0
  40. package/cpp/skia/include/core/SkFontMgr.h +20 -29
  41. package/cpp/skia/include/core/SkFontStyle.h +4 -1
  42. package/cpp/skia/include/core/SkGraphics.h +21 -18
  43. package/cpp/skia/include/core/SkICC.h +3 -13
  44. package/cpp/skia/include/core/SkImage.h +395 -717
  45. package/cpp/skia/include/core/SkImageGenerator.h +19 -74
  46. package/cpp/skia/include/core/SkImageInfo.h +7 -5
  47. package/cpp/skia/include/core/SkM44.h +11 -0
  48. package/cpp/skia/include/core/SkMaskFilter.h +6 -3
  49. package/cpp/skia/include/core/SkMatrix.h +14 -4
  50. package/cpp/skia/include/core/SkMesh.h +52 -18
  51. package/cpp/skia/include/core/SkMilestone.h +1 -1
  52. package/cpp/skia/include/core/SkPaint.h +11 -34
  53. package/cpp/skia/include/core/SkPath.h +23 -4
  54. package/cpp/skia/include/core/SkPathBuilder.h +13 -5
  55. package/cpp/skia/include/core/SkPathMeasure.h +1 -1
  56. package/cpp/skia/include/core/SkPathTypes.h +0 -2
  57. package/cpp/skia/include/core/SkPathUtils.h +42 -0
  58. package/cpp/skia/include/core/SkPicture.h +3 -2
  59. package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
  60. package/cpp/skia/include/core/SkPixelRef.h +4 -8
  61. package/cpp/skia/include/core/SkPixmap.h +12 -20
  62. package/cpp/skia/include/core/SkPoint.h +4 -2
  63. package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
  64. package/cpp/skia/include/core/SkRRect.h +5 -1
  65. package/cpp/skia/include/core/SkRect.h +6 -3
  66. package/cpp/skia/include/core/SkRefCnt.h +9 -14
  67. package/cpp/skia/include/core/SkRegion.h +1 -1
  68. package/cpp/skia/include/core/SkScalar.h +2 -4
  69. package/cpp/skia/include/core/SkSerialProcs.h +18 -10
  70. package/cpp/skia/include/core/SkShader.h +1 -64
  71. package/cpp/skia/include/core/SkSize.h +2 -0
  72. package/cpp/skia/include/core/SkSpan.h +4 -112
  73. package/cpp/skia/include/core/SkStream.h +11 -12
  74. package/cpp/skia/include/core/SkString.h +9 -25
  75. package/cpp/skia/include/core/SkStrokeRec.h +1 -1
  76. package/cpp/skia/include/core/SkSurface.h +83 -61
  77. package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
  78. package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
  79. package/cpp/skia/include/core/SkTextBlob.h +2 -2
  80. package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
  81. package/cpp/skia/include/core/SkTime.h +1 -1
  82. package/cpp/skia/include/core/SkTypeface.h +9 -2
  83. package/cpp/skia/include/core/SkTypes.h +37 -466
  84. package/cpp/skia/include/core/SkVertices.h +2 -0
  85. package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
  86. package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
  87. package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
  88. package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
  89. package/cpp/skia/include/effects/SkGradientShader.h +65 -14
  90. package/cpp/skia/include/effects/SkImageFilters.h +0 -11
  91. package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
  92. package/cpp/skia/include/encode/SkEncoder.h +7 -3
  93. package/cpp/skia/include/encode/SkICC.h +36 -0
  94. package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
  95. package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
  96. package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
  97. package/cpp/skia/include/gpu/GpuTypes.h +23 -1
  98. package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
  99. package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
  100. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
  101. package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
  102. package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
  103. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
  104. package/cpp/skia/include/gpu/GrTypes.h +18 -18
  105. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
  106. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
  107. package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
  108. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
  109. package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
  110. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
  111. package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
  112. package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
  113. package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
  114. package/cpp/skia/include/gpu/graphite/Context.h +85 -32
  115. package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
  116. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
  117. package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
  118. package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
  119. package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
  120. package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
  121. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
  122. package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
  123. package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
  124. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
  125. package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
  126. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
  127. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
  128. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
  129. package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
  130. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  131. package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
  132. package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
  133. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
  134. package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
  135. package/cpp/skia/include/pathops/SkPathOps.h +3 -3
  136. package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
  137. package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
  138. package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
  139. package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
  140. package/cpp/skia/include/private/SkChecksum.h +32 -7
  141. package/cpp/skia/include/private/SkColorData.h +1 -26
  142. package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
  143. package/cpp/skia/include/private/SkGainmapShader.h +53 -0
  144. package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
  145. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
  146. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
  147. package/cpp/skia/include/private/SkOpts_spi.h +3 -1
  148. package/cpp/skia/include/private/SkPathRef.h +64 -47
  149. package/cpp/skia/include/private/SkSLDefines.h +5 -5
  150. package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
  151. package/cpp/skia/include/private/SkSpinlock.h +1 -1
  152. package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
  153. package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
  154. package/cpp/skia/include/private/base/SkAPI.h +52 -0
  155. package/cpp/skia/include/private/base/SkAlign.h +39 -0
  156. package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
  157. package/cpp/skia/include/private/base/SkAssert.h +92 -0
  158. package/cpp/skia/include/private/base/SkAttributes.h +102 -0
  159. package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
  160. package/cpp/skia/include/private/base/SkContainers.h +46 -0
  161. package/cpp/skia/include/private/base/SkDebug.h +27 -0
  162. package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
  163. package/cpp/skia/include/private/base/SkFeatures.h +151 -0
  164. package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
  165. package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
  166. package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
  167. package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
  168. package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
  169. package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
  170. package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
  171. package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
  172. package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
  173. package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
  174. package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
  175. package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
  176. package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
  177. package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
  178. package/cpp/skia/include/private/base/SkTArray.h +694 -0
  179. package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
  180. package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
  181. package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
  182. package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
  183. package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
  184. package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
  185. package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
  186. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
  187. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
  188. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
  189. package/cpp/skia/include/private/chromium/Slug.h +0 -9
  190. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
  191. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  192. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
  193. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
  194. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
  195. package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
  196. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
  197. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
  198. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
  199. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
  200. package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
  201. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
  202. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
  203. package/cpp/skia/include/utils/SkCamera.h +1 -1
  204. package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
  205. package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
  206. package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
  207. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
  208. package/cpp/skia/include/utils/SkParsePath.h +1 -1
  209. package/cpp/skia/modules/skcms/skcms.h +14 -0
  210. package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
  211. package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
  212. package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
  213. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
  214. package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
  215. package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
  216. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
  217. package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
  218. package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
  219. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
  220. package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
  221. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  222. package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
  223. package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
  224. package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
  225. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  226. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  227. package/cpp/skia/modules/svg/include/SkSVGTypes.h +22 -21
  228. package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
  229. package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
  230. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +1 -2
  231. package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
  232. package/libs/android/arm64-v8a/libskia.a +0 -0
  233. package/libs/android/arm64-v8a/libskottie.a +0 -0
  234. package/libs/android/arm64-v8a/libsksg.a +0 -0
  235. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  236. package/libs/android/arm64-v8a/libsvg.a +0 -0
  237. package/libs/android/armeabi-v7a/libskia.a +0 -0
  238. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  239. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  240. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  241. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  242. package/libs/android/x86/libskia.a +0 -0
  243. package/libs/android/x86/libskottie.a +0 -0
  244. package/libs/android/x86/libsksg.a +0 -0
  245. package/libs/android/x86/libskshaper.a +0 -0
  246. package/libs/android/x86/libsvg.a +0 -0
  247. package/libs/android/x86_64/libskia.a +0 -0
  248. package/libs/android/x86_64/libskottie.a +0 -0
  249. package/libs/android/x86_64/libsksg.a +0 -0
  250. package/libs/android/x86_64/libskshaper.a +0 -0
  251. package/libs/android/x86_64/libsvg.a +0 -0
  252. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  253. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  254. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  255. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  256. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  257. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  258. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  259. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  260. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  261. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  262. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  263. package/package.json +1 -1
  264. package/react-native-skia.podspec +1 -1
  265. package/scripts/install-npm.js +11 -1
  266. package/cpp/skia/include/core/SkImageEncoder.h +0 -71
  267. package/cpp/skia/include/gpu/GrConfig.h +0 -53
  268. package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
  269. package/cpp/skia/include/private/SkHalf.h +0 -38
  270. package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
  271. package/cpp/skia/include/private/SkSLIRNode.h +0 -64
  272. package/cpp/skia/include/private/SkSLLayout.h +0 -144
  273. package/cpp/skia/include/private/SkSLModifiers.h +0 -178
  274. package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
  275. package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
  276. package/cpp/skia/include/private/SkSLStatement.h +0 -86
  277. package/cpp/skia/include/private/SkSLString.h +0 -41
  278. package/cpp/skia/include/private/SkSLSymbol.h +0 -94
  279. package/cpp/skia/include/private/SkSafe_math.h +0 -52
  280. package/cpp/skia/include/private/SkStringView.h +0 -51
  281. package/cpp/skia/include/private/SkTArray.h +0 -655
  282. package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
  283. package/cpp/skia/include/private/SkVx.h +0 -1026
  284. package/cpp/skia/include/sksl/DSL.h +0 -37
  285. package/cpp/skia/include/sksl/DSLBlock.h +0 -58
  286. package/cpp/skia/include/sksl/DSLCase.h +0 -62
  287. package/cpp/skia/include/sksl/DSLCore.h +0 -492
  288. package/cpp/skia/include/sksl/DSLExpression.h +0 -241
  289. package/cpp/skia/include/sksl/DSLFunction.h +0 -113
  290. package/cpp/skia/include/sksl/DSLLayout.h +0 -92
  291. package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
  292. package/cpp/skia/include/sksl/DSLStatement.h +0 -82
  293. package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
  294. package/cpp/skia/include/sksl/DSLType.h +0 -271
  295. package/cpp/skia/include/sksl/DSLVar.h +0 -231
  296. package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
  297. package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
  298. package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
  299. package/cpp/skia/include/utils/SkRandom.h +0 -169
  300. package/cpp/skia/src/core/SkLRUCache.h +0 -126
  301. package/cpp/skia/src/core/SkTInternalLList.h +0 -302
  302. /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
  303. /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
  304. /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.4.1)
3
3
 
4
4
  set (CMAKE_VERBOSE_MAKEFILE ON)
5
5
  set (CMAKE_CXX_STANDARD 17)
6
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
6
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_GANESH -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
7
7
 
8
8
  set (PACKAGE_NAME "rnskia")
9
9
  set (SKIA_LIB "skia")
@@ -278,6 +278,7 @@ if (ENABLE_PREFAB) {
278
278
  into "${project.buildDir}/headers/rnskia/"
279
279
  includeEmptyDirs = false
280
280
  include "**/*.h"
281
+ duplicatesStrategy = 'include'
281
282
  eachFile {
282
283
  String path = it.path
283
284
 
@@ -101,7 +101,7 @@ sk_sp<SkImage> JniPlatformContext::takeScreenshotFromViewTag(size_t tag) {
101
101
  // Create pixmap from pixels and make a copy of it so that
102
102
  // the SkImage owns its own pixels
103
103
  SkPixmap pm(skInfo, pixels, bmi.stride);
104
- auto skImage = SkImage::MakeRasterCopy(pm);
104
+ auto skImage = SkImages::RasterFromPixmapCopy(pm);
105
105
 
106
106
  // Unlock pixels
107
107
  AndroidBitmap_unlockPixels(env, bitmap);
@@ -58,123 +58,124 @@ public class ViewScreenshotService {
58
58
  paint.setDither(true);
59
59
 
60
60
  // Render the main view and its children
61
- final Canvas c = new Canvas(bitmap);
62
- view.draw(c);
61
+ final Canvas canvas = new Canvas(bitmap);
63
62
 
64
- // Enumerate children
65
- final List<View> childrenList = getAllChildren(view);
63
+ // Renders view with child views to canvas
64
+ renderViewToCanvas(canvas, view, paint);
66
65
 
67
- for (final View child : childrenList) {
68
- // skip any child that we don't know how to process
69
- if (child instanceof TextureView) {
70
- // skip all invisible to user child views
71
- if (child.getVisibility() != VISIBLE) continue;
66
+ return bitmap;
67
+ }
72
68
 
73
- final TextureView tvChild = (TextureView) child;
74
- tvChild.setOpaque(false); // <-- switch off background fill
75
-
76
- // TextureView should use bitmaps with matching size,
77
- // otherwise content of the TextureView will be scaled to provided bitmap dimensions
78
- final Bitmap childBitmapBuffer = tvChild.getBitmap(Bitmap.createBitmap(child.getWidth(), child.getHeight(), Bitmap.Config.ARGB_8888));
79
-
80
- final int countCanvasSave = c.save();
81
- applyTransformations(c, view, child);
82
-
83
- // due to re-use of bitmaps for screenshot, we can get bitmap that is bigger in size than requested
84
- c.drawBitmap(childBitmapBuffer, 0, 0, paint);
85
-
86
- c.restoreToCount(countCanvasSave);
87
- } else if (child instanceof SurfaceView) {
88
- final SurfaceView svChild = (SurfaceView)child;
89
- final CountDownLatch latch = new CountDownLatch(1);
90
-
91
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
92
- final Bitmap childBitmapBuffer = Bitmap.createBitmap(child.getWidth(), child.getHeight(), Bitmap.Config.ARGB_8888);
93
- try {
94
- PixelCopy.request(svChild, childBitmapBuffer, new PixelCopy.OnPixelCopyFinishedListener() {
95
- @Override
96
- public void onPixelCopyFinished(int copyResult) {
97
- final int countCanvasSave = c.save();
98
- applyTransformations(c, view, child);
99
- c.drawBitmap(childBitmapBuffer, 0, 0, paint);
100
- c.restoreToCount(countCanvasSave);
101
- latch.countDown();
102
- }
103
- }, new Handler(Looper.getMainLooper()));
104
- latch.await(SURFACE_VIEW_READ_PIXELS_TIMEOUT, TimeUnit.SECONDS);
105
- } catch (Exception e) {
106
- Log.e(TAG, "Cannot PixelCopy for " + svChild, e);
107
- }
108
- } else {
109
- Bitmap cache = svChild.getDrawingCache();
110
- if (cache != null) {
111
- c.drawBitmap(svChild.getDrawingCache(), 0, 0, paint);
112
- }
69
+ private static void renderViewToCanvas(Canvas canvas, View view, Paint paint) {
70
+ // Apply transformations for the current view
71
+ canvas.save();
72
+ applyTransformations(canvas, view);
73
+
74
+ // Draw children if the view has children
75
+ if ((view instanceof ViewGroup)) {
76
+ // Draw children
77
+ ViewGroup group = (ViewGroup) view;
78
+
79
+ // Hide visible children - this needs to be done because view.draw(canvas)
80
+ // will render all visible non-texture/surface views directly - causing
81
+ // views to be rendered twice - once by view.draw() and once when we
82
+ // enumerate children. We therefore need to turn off rendering of visible
83
+ // children before we call view.draw:
84
+ List<View> visibleChildren = new ArrayList<>();
85
+ for (int i = 0; i < group.getChildCount(); i++) {
86
+ View child = group.getChildAt(i);
87
+ if (child.getVisibility() == VISIBLE) {
88
+ visibleChildren.add(child);
89
+ child.setVisibility(View.INVISIBLE);
113
90
  }
114
91
  }
115
- }
116
-
117
- return bitmap;
118
- }
119
92
 
120
- private static List<View> getAllChildren(@NonNull final View v) {
121
- if (!(v instanceof ViewGroup)) {
122
- final ArrayList<View> viewArrayList = new ArrayList<>();
123
- viewArrayList.add(v);
93
+ // Draw ourselves
94
+ view.draw(canvas);
124
95
 
125
- return viewArrayList;
126
- }
96
+ // Enable children again
97
+ for (int i = 0; i < visibleChildren.size(); i++) {
98
+ View child = visibleChildren.get(i);
99
+ child.setVisibility(VISIBLE);
100
+ }
127
101
 
128
- final ArrayList<View> result = new ArrayList<>();
102
+ // Draw children
103
+ for (int i = 0; i < group.getChildCount(); i++) {
104
+ View child = group.getChildAt(i);
129
105
 
130
- ViewGroup viewGroup = (ViewGroup) v;
131
- for (int i = 0; i < viewGroup.getChildCount(); i++) {
132
- View child = viewGroup.getChildAt(i);
106
+ // skip all invisible to user child views
107
+ if (child.getVisibility() != VISIBLE) continue;
133
108
 
134
- //Do not add any parents, just add child elements
135
- result.addAll(getAllChildren(child));
109
+ // skip any child that we don't know how to process
110
+ if (child instanceof TextureView) {
111
+ final TextureView tvChild = (TextureView) child;
112
+ tvChild.setOpaque(false); // <-- switch off background fill
113
+
114
+ canvas.save();
115
+ applyTransformations(canvas, child);
116
+
117
+ // TextureView should use bitmaps with matching size,
118
+ // otherwise content of the TextureView will be scaled to provided bitmap dimensions
119
+ final Bitmap childBitmapBuffer = tvChild.getBitmap(Bitmap.createBitmap(child.getWidth(), child.getHeight(), Bitmap.Config.ARGB_8888));
120
+ canvas.drawBitmap(childBitmapBuffer, 0, 0, paint);
121
+
122
+ canvas.restore();
123
+
124
+ } else if (child instanceof SurfaceView) {
125
+ final SurfaceView svChild = (SurfaceView) child;
126
+ final CountDownLatch latch = new CountDownLatch(1);
127
+
128
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
129
+ final Bitmap childBitmapBuffer = Bitmap.createBitmap(child.getWidth(), child.getHeight(), Bitmap.Config.ARGB_8888);
130
+ try {
131
+ PixelCopy.request(svChild, childBitmapBuffer, copyResult -> {
132
+ canvas.save();
133
+ applyTransformations(canvas, child);
134
+ canvas.drawBitmap(childBitmapBuffer, 0, 0, paint);
135
+ canvas.restore();
136
+ latch.countDown();
137
+ }, new Handler(Looper.getMainLooper()));
138
+ latch.await(SURFACE_VIEW_READ_PIXELS_TIMEOUT, TimeUnit.SECONDS);
139
+ } catch (Exception e) {
140
+ Log.e(TAG, "Cannot PixelCopy for " + svChild, e);
141
+ }
142
+ } else {
143
+ Bitmap cache = svChild.getDrawingCache();
144
+ if (cache != null) {
145
+ canvas.save();
146
+ applyTransformations(canvas, child);
147
+ canvas.drawBitmap(svChild.getDrawingCache(), 0, 0, paint);
148
+ canvas.restore();
149
+ }
150
+ }
151
+ } else {
152
+ // Regular views needs to be rendered again to ensure correct z-index
153
+ // order with texture views and surface views.
154
+ renderViewToCanvas(canvas, child, paint);
155
+ }
156
+ }
157
+ } else {
158
+ // Draw ourselves
159
+ view.draw(canvas);
136
160
  }
137
161
 
138
- return result;
162
+ // Restore canvas
163
+ canvas.restore();
139
164
  }
140
165
 
141
- /**
142
- * Concat all the transformation matrix's from parent to child.
143
- */
144
166
  @NonNull
145
- @SuppressWarnings("UnusedReturnValue")
146
- private static Matrix applyTransformations(final Canvas c, @NonNull final View root, @NonNull final View child) {
147
- final Matrix transform = new Matrix();
148
- final LinkedList<View> ms = new LinkedList<>();
149
-
150
- // find all parents of the child view
151
- View iterator = child;
152
- do {
153
- ms.add(iterator);
154
-
155
- iterator = (View) iterator.getParent();
156
- } while (iterator != root);
157
-
158
- // apply transformations from parent --> child order
159
- Collections.reverse(ms);
160
-
161
- for (final View v : ms) {
162
- c.save();
163
-
164
- // apply each view transformations, so each child will be affected by them
165
- final float dx = v.getLeft() + ((v != child) ? v.getPaddingLeft() : 0) + v.getTranslationX();
166
- final float dy = v.getTop() + ((v != child) ? v.getPaddingTop() : 0) + v.getTranslationY();
167
- c.translate(dx, dy);
168
- c.rotate(v.getRotation(), v.getPivotX(), v.getPivotY());
169
- c.scale(v.getScaleX(), v.getScaleY());
170
-
171
- // compute the matrix just for any future use
172
- transform.postTranslate(dx, dy);
173
- transform.postRotate(v.getRotation(), v.getPivotX(), v.getPivotY());
174
- transform.postScale(v.getScaleX(), v.getScaleY());
175
- }
176
-
177
- return transform;
167
+ private static void applyTransformations(final Canvas c, @NonNull final View view) {
168
+ // Get the transformation matrix of the view
169
+ final Matrix matrix = view.getMatrix();
170
+
171
+ // Create a new matrix for translation
172
+ final Matrix translateMatrix = new Matrix();
173
+ final float dx = view.getLeft() + view.getPaddingLeft() + view.getTranslationX();
174
+ final float dy = view.getTop() + view.getPaddingTop() + view.getTranslationY();
175
+ translateMatrix.setTranslate(dx, dy);
176
+
177
+ // Pre-concatenate the current matrix of the canvas with the translation and transformation matrices of the view
178
+ c.concat(translateMatrix);
179
+ c.concat(matrix);
178
180
  }
179
-
180
181
  }
@@ -14,7 +14,9 @@
14
14
  #include "SkBase64.h"
15
15
  #include "SkImage.h"
16
16
  #include "SkStream.h"
17
- #include <include/codec/SkCodec.h>
17
+ #include "codec/SkEncodedImageFormat.h"
18
+ #include "include/encode/SkJpegEncoder.h"
19
+ #include "include/encode/SkPngEncoder.h"
18
20
 
19
21
  #pragma clang diagnostic pop
20
22
 
@@ -70,7 +72,15 @@ public:
70
72
  auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
71
73
 
72
74
  // Get data
73
- auto data = getObject()->encodeToData(format, quality);
75
+ sk_sp<SkData> data;
76
+ if (format == SkEncodedImageFormat::kJPEG) {
77
+ SkJpegEncoder::Options options;
78
+ options.fQuality = quality;
79
+ data = SkJpegEncoder::Encode(nullptr, getObject().get(), options);
80
+ } else {
81
+ SkPngEncoder::Options options;
82
+ data = SkPngEncoder::Encode(nullptr, getObject().get(), options);
83
+ }
74
84
  auto arrayCtor =
75
85
  runtime.global().getPropertyAsFunction(runtime, "Uint8Array");
76
86
  size_t size = data->size();
@@ -95,8 +105,19 @@ public:
95
105
  : SkEncodedImageFormat::kPNG;
96
106
 
97
107
  auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
98
-
99
- auto data = getObject()->encodeToData(format, quality);
108
+ auto image = getObject();
109
+ if (image->isTextureBacked()) {
110
+ image = image->makeNonTextureImage();
111
+ }
112
+ sk_sp<SkData> data;
113
+ if (format == SkEncodedImageFormat::kJPEG) {
114
+ SkJpegEncoder::Options options;
115
+ options.fQuality = quality;
116
+ data = SkJpegEncoder::Encode(nullptr, image.get(), options);
117
+ } else {
118
+ SkPngEncoder::Options options;
119
+ data = SkPngEncoder::Encode(nullptr, image.get(), options);
120
+ }
100
121
  auto len = SkBase64::Encode(data->bytes(), data->size(), nullptr);
101
122
  auto buffer = std::string(len, 0);
102
123
  SkBase64::Encode(data->bytes(), data->size(),
@@ -18,7 +18,7 @@ class JsiSkImageFactory : public JsiSkHostObject {
18
18
  public:
19
19
  JSI_HOST_FUNCTION(MakeImageFromEncoded) {
20
20
  auto data = JsiSkData::fromValue(runtime, arguments[0]);
21
- auto image = SkImage::MakeFromEncoded(data);
21
+ auto image = SkImages::DeferredFromEncodedData(data);
22
22
  if (image == nullptr) {
23
23
  return jsi::Value::null();
24
24
  }
@@ -30,7 +30,7 @@ public:
30
30
  auto imageInfo = JsiSkImageInfo::fromValue(runtime, arguments[0]);
31
31
  auto pixelData = JsiSkData::fromValue(runtime, arguments[1]);
32
32
  auto bytesPerRow = arguments[2].asNumber();
33
- auto image = SkImage::MakeRasterData(*imageInfo, pixelData, bytesPerRow);
33
+ auto image = SkImages::RasterFromData(*imageInfo, pixelData, bytesPerRow);
34
34
  if (image == nullptr) {
35
35
  return jsi::Value::null();
36
36
  }
@@ -7,6 +7,7 @@
7
7
  #include <jsi/jsi.h>
8
8
 
9
9
  #include "JsiSkHostObjects.h"
10
+ #include "JsiSkMatrix.h"
10
11
  #include "JsiSkPoint.h"
11
12
  #include "JsiSkRRect.h"
12
13
  #include "JsiSkRect.h"
@@ -20,13 +21,12 @@
20
21
  #include "SkPathEffect.h"
21
22
  #include "SkPathOps.h"
22
23
  #include "SkPathTypes.h"
24
+ #include "SkPathUtils.h"
23
25
  #include "SkString.h"
24
26
  #include "SkStrokeRec.h"
25
27
  #include "SkTextUtils.h"
26
28
  #include "SkTrimPathEffect.h"
27
29
 
28
- #include "JsiSkMatrix.h"
29
-
30
30
  #pragma clang diagnostic pop
31
31
 
32
32
  namespace RNSkia {
@@ -284,8 +284,11 @@ public:
284
284
 
285
285
  auto jsiPrecision = opts.getProperty(runtime, "precision");
286
286
  auto precision = jsiPrecision.isUndefined() ? 1 : jsiPrecision.asNumber();
287
- auto result = p.getFillPath(path, &path, nullptr, precision);
288
- getObject()->swap(path);
287
+ auto result =
288
+ skpathutils::FillPathWithPaint(path, p, &path, nullptr, precision);
289
+ if (result) {
290
+ getObject()->swap(path);
291
+ }
289
292
  return result ? thisValue.getObject(runtime) : jsi::Value::null();
290
293
  }
291
294
 
@@ -320,8 +323,7 @@ public:
320
323
 
321
324
  JSI_HOST_FUNCTION(toSVGString) {
322
325
  SkPath path = *getObject();
323
- SkString s;
324
- SkParsePath::ToSVGString(path, &s);
326
+ auto s = SkParsePath::ToSVGString(path);
325
327
  return jsi::String::createFromUtf8(runtime, s.c_str());
326
328
  }
327
329
 
@@ -24,17 +24,15 @@ public:
24
24
  void push(T el) { _elements.push(el); }
25
25
 
26
26
  // Clears and returns all elements
27
- std::vector<T> popAll() { return popMultiple(_elements.size()); }
28
-
29
- // Pops the number of items up to limit
30
- std::vector<T> popMultiple(size_t limit) {
31
- auto size = std::min(limit, _elements.size());
27
+ std::vector<T> popAll() {
28
+ auto size = _elements.size();
32
29
  std::vector<T> tmp;
33
30
  tmp.reserve(size);
34
31
  for (size_t i = 0; i < size; ++i) {
35
32
  tmp.push_back(_elements.top());
36
33
  _elements.pop();
37
34
  }
35
+ std::reverse(std::begin(tmp), std::end(tmp));
38
36
  return tmp;
39
37
  }
40
38
 
@@ -50,7 +48,7 @@ public:
50
48
  // Clears and returns through reducer function in reversed order
51
49
  T popAsOne(std::function<T(T inner, T outer)> composer) {
52
50
  auto tmp = popAll();
53
- // std::reverse(std::begin(tmp), std::end(tmp));
51
+ std::reverse(std::begin(tmp), std::end(tmp));
54
52
  return std::accumulate(std::begin(tmp), std::end(tmp),
55
53
  static_cast<T>(nullptr), [=](T inner, T outer) {
56
54
  if (inner == nullptr) {
@@ -63,7 +61,7 @@ public:
63
61
  // Returns the size of the elements
64
62
  size_t size() { return _elements.size(); }
65
63
 
66
- protected:
64
+ private:
67
65
  std::stack<T> _elements;
68
66
  };
69
67
 
@@ -30,7 +30,9 @@ protected:
30
30
  #endif
31
31
  // Save paint if the paint property is set
32
32
  if (_paintProp->isSet()) {
33
- draw(_paintProp->getUnsafeDerivedValue().get());
33
+ auto localCtx = _paintProp->getUnsafeDerivedValue().get();
34
+ localCtx->setCanvas(context->getCanvas());
35
+ draw(localCtx);
34
36
  } else {
35
37
  // Call abstract draw method
36
38
  draw(context);
@@ -10,6 +10,7 @@
10
10
  #pragma clang diagnostic push
11
11
  #pragma clang diagnostic ignored "-Wdocumentation"
12
12
 
13
+ #include "SkBlurTypes.h"
13
14
  #include "SkMaskFilter.h"
14
15
 
15
16
  #pragma clang diagnostic pop
@@ -108,8 +108,8 @@ protected:
108
108
  // _path is const so we can't mutate it directly, let's replace the
109
109
  // path like this:
110
110
  auto p = std::make_shared<SkPath>(*_path.get());
111
- if (!strokePaint.getFillPath(*_path.get(), p.get(), nullptr,
112
- precision)) {
111
+ if (!skpathutils::FillPathWithPaint(*_path.get(), strokePaint,
112
+ p.get(), nullptr, precision)) {
113
113
  _path = nullptr;
114
114
  } else {
115
115
  _path = std::const_pointer_cast<const SkPath>(p);
@@ -5,6 +5,8 @@
5
5
  #include <memory>
6
6
  #include <utility>
7
7
 
8
+ #include "SkBlurTypes.h"
9
+
8
10
  namespace RNSkia {
9
11
 
10
12
  class BoxShadowProps : public DerivedProp<SkPaint> {
@@ -27,7 +27,7 @@ class SkShader;
27
27
  class SkAndroidFrameworkUtils {
28
28
  public:
29
29
 
30
- #if SK_SUPPORT_GPU
30
+ #if defined(SK_GANESH)
31
31
  /**
32
32
  * clipWithStencil draws the current clip into a stencil buffer with reference value and mask
33
33
  * set to 0x1. This function works only on a GPU canvas.
@@ -37,7 +37,7 @@ public:
37
37
  * @return true on success or false if clip is empty or not a GPU canvas.
38
38
  */
39
39
  static bool clipWithStencil(SkCanvas* canvas);
40
- #endif //SK_SUPPORT_GPU
40
+ #endif //defined(SK_GANESH)
41
41
 
42
42
  static void SafetyNetLog(const char*);
43
43
 
@@ -58,12 +58,6 @@ public:
58
58
  */
59
59
  static SkCanvas* getBaseWrappedCanvas(SkCanvas* canvas);
60
60
 
61
- /**
62
- * Skia will change the order in which local matrices concatenate. In order to not break Android
63
- * apps targeting older API levels we offer this function to use the legacy concatenation order.
64
- */
65
- static void UseLegacyLocalMatrixConcatenation();
66
-
67
61
  /**
68
62
  * If the shader represents a linear gradient ShaderAsALinearGradient
69
63
  * returns true and if info is not null, ShaderAsALinearGradient populates
@@ -0,0 +1,101 @@
1
+ /*
2
+ * Copyright 2023 Google LLC
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #ifndef SkImageAndroid_DEFINED
9
+ #define SkImageAndroid_DEFINED
10
+
11
+ #include "include/core/SkImage.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/gpu/GrTypes.h"
14
+
15
+ class SkColorSpace;
16
+ class GrDirectContext;
17
+ class SkPixmap;
18
+ struct AHardwareBuffer;
19
+
20
+ namespace SkImages {
21
+
22
+ /** (See Skia bug 7447)
23
+ Creates SkImage from Android hardware buffer.
24
+ Returned SkImage takes a reference on the buffer.
25
+ Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
26
+ @param hardwareBuffer AHardwareBuffer Android hardware buffer
27
+ @param colorSpace range of colors; may be nullptr
28
+ @return created SkImage, or nullptr
29
+ */
30
+ SK_API sk_sp<SkImage> DeferredFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
31
+ SkAlphaType alphaType = kPremul_SkAlphaType);
32
+ SK_API sk_sp<SkImage> DeferredFromAHardwareBuffer(
33
+ AHardwareBuffer* hardwareBuffer,
34
+ SkAlphaType alphaType,
35
+ sk_sp<SkColorSpace> colorSpace,
36
+ GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
37
+
38
+ /** Creates SkImage from Android hardware buffer and uploads the data from the SkPixmap to it.
39
+ Returned SkImage takes a reference on the buffer.
40
+ Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
41
+ @param context GPU context
42
+ @param pixmap SkPixmap that contains data to be uploaded to the AHardwareBuffer
43
+ @param hardwareBuffer AHardwareBuffer Android hardware buffer
44
+ @param surfaceOrigin surface origin for resulting image
45
+ @return created SkImage, or nullptr
46
+ */
47
+ SK_API sk_sp<SkImage> TextureFromAHardwareBufferWithData(
48
+ GrDirectContext* context,
49
+ const SkPixmap& pixmap,
50
+ AHardwareBuffer* hardwareBuffer,
51
+ GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
52
+
53
+ /**
54
+ * Like SkImagePriv::SkMakeImageFromRasterBitmap, except this can be pinned using
55
+ * skgpu::ganesh::PinAsTexture and CopyPixelMode is never.
56
+ */
57
+ SK_API sk_sp<SkImage> PinnableRasterFromBitmap(const SkBitmap&);
58
+
59
+ } // namespace SkImages
60
+
61
+ // TODO(kjlubick) remove this after Android has been ported.
62
+ namespace sk_image_factory {
63
+ inline sk_sp<SkImage> MakePinnableFromRasterBitmap(const SkBitmap& b) {
64
+ return SkImages::PinnableRasterFromBitmap(b);
65
+ }
66
+ } // namespace sk_image_factory
67
+
68
+ namespace skgpu::ganesh {
69
+ /**
70
+ * Will attempt to upload and lock the contents of the image as a texture, so that subsequent
71
+ * draws to a gpu-target will come from that texture (and not by looking at the original image
72
+ * src). In particular this is intended to use the texture even if the image's original content
73
+ * changes subsequent to this call (i.e. the src is mutable!).
74
+ *
75
+ * Only compatible with SkImages created from SkImages::PinnableRasterFromBitmap.
76
+ *
77
+ * All successful calls must be balanced by an equal number of calls to UnpinTexture().
78
+ *
79
+ * Once in this "pinned" state, the image has all of the same thread restrictions that exist
80
+ * for a natively created gpu image (e.g. SkImage::MakeFromTexture)
81
+ * - all drawing, pinning, unpinning must happen in the same thread as the GrContext.
82
+ *
83
+ * @return true if the image was successfully uploaded and locked into a texture
84
+ */
85
+ bool PinAsTexture(GrRecordingContext*, SkImage*);
86
+
87
+ /**
88
+ * The balancing call to a successful invocation of PinAsTexture. When a balanced
89
+ * number of calls have been made, then the "pinned" texture is free to be purged, etc. This
90
+ * also means that a subsequent "pin" call will look at the original content again, and if
91
+ * its uniqueID/generationID has changed, then a newer texture will be uploaded/pinned.
92
+ *
93
+ * Only compatible with SkImages created from SkImages::PinnableRasterFromBitmap.
94
+ *
95
+ * The context passed to unpin must match the one passed to pin.
96
+ */
97
+ void UnpinTexture(GrRecordingContext*, SkImage*);
98
+
99
+ } // namespace skgpu::ganesh
100
+
101
+ #endif
@@ -9,24 +9,27 @@
9
9
  #define SkAndroidCodec_DEFINED
10
10
 
11
11
  #include "include/codec/SkCodec.h"
12
- #include "include/core/SkAlphaType.h"
13
12
  #include "include/core/SkColorSpace.h"
14
- #include "include/core/SkColorType.h"
15
- #include "include/core/SkEncodedImageFormat.h"
16
13
  #include "include/core/SkImageInfo.h"
17
14
  #include "include/core/SkRefCnt.h"
18
15
  #include "include/core/SkSize.h"
19
16
  #include "include/core/SkTypes.h"
20
17
  #include "include/private/SkEncodedInfo.h"
21
- #include "include/private/SkNoncopyable.h"
18
+ #include "include/private/base/SkNoncopyable.h"
22
19
  #include "modules/skcms/skcms.h"
23
20
 
21
+ // TODO(kjlubick, bungeman) Replace these includes with forward declares
22
+ #include "include/codec/SkEncodedImageFormat.h" // IWYU pragma: keep
23
+ #include "include/core/SkAlphaType.h" // IWYU pragma: keep
24
+ #include "include/core/SkColorType.h" // IWYU pragma: keep
25
+
24
26
  #include <cstddef>
25
27
  #include <memory>
26
28
 
27
29
  class SkData;
28
30
  class SkPngChunkReader;
29
31
  class SkStream;
32
+ struct SkGainmapInfo;
30
33
  struct SkIRect;
31
34
 
32
35
  /**
@@ -118,10 +121,8 @@ public:
118
121
  /**
119
122
  * @param outputColorType Color type that the client will decode to.
120
123
  * @param prefColorSpace Preferred color space to decode to.
121
- * This may not return |prefColorSpace| for a couple reasons.
122
- * (1) Android Principles: 565 must be sRGB, F16 must be
123
- * linear sRGB, transfer function must be parametric.
124
- * (2) Codec Limitations: F16 requires a linear color space.
124
+ * This may not return |prefColorSpace| for
125
+ * specific color types.
125
126
  *
126
127
  * Returns the appropriate color space to decode to.
127
128
  */
@@ -262,6 +263,23 @@ public:
262
263
 
263
264
  SkCodec* codec() const { return fCodec.get(); }
264
265
 
266
+ /**
267
+ * Retrieve the gainmap for an image.
268
+ *
269
+ * @param outInfo On success, this is populated with the parameters for
270
+ * rendering this gainmap. This parameter must be non-nullptr.
271
+ *
272
+ * @param outGainmapImageStream On success, this is populated with a stream from which the
273
+ * gainmap image may be decoded. This parameter is optional, and
274
+ * may be set to nullptr.
275
+ *
276
+ * @return If this has a gainmap image and that gainmap image was
277
+ * successfully extracted then return true. Otherwise return
278
+ * false.
279
+ */
280
+ bool getAndroidGainmap(SkGainmapInfo* outInfo,
281
+ std::unique_ptr<SkStream>* outGainmapImageStream);
282
+
265
283
  protected:
266
284
  SkAndroidCodec(SkCodec*);
267
285