@shopify/react-native-skia 2.6.2 → 2.6.3-next.2

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 (346) hide show
  1. package/android/CMakeLists.txt +8 -4
  2. package/android/build.gradle +22 -3
  3. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +62 -0
  4. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +35 -0
  5. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +17 -0
  6. package/apple/RNSkApplePlatformContext.h +2 -0
  7. package/apple/RNSkApplePlatformContext.mm +71 -0
  8. package/apple/RNWebGPUAppleNativeBuffer.mm +33 -0
  9. package/cpp/api/JsiNativeBuffer.h +9 -1
  10. package/cpp/api/JsiSkAnimatedImage.h +1 -1
  11. package/cpp/api/JsiSkAnimatedImageFactory.h +1 -1
  12. package/cpp/api/JsiSkApi.h +3 -3
  13. package/cpp/api/JsiSkCanvas.h +34 -1
  14. package/cpp/api/JsiSkColor.h +1 -1
  15. package/cpp/api/JsiSkDataFactory.h +2 -2
  16. package/cpp/api/JsiSkFont.h +1 -1
  17. package/cpp/api/JsiSkFontMgr.h +1 -1
  18. package/cpp/api/JsiSkHostObjects.h +3 -3
  19. package/cpp/api/JsiSkImage.h +15 -7
  20. package/cpp/api/JsiSkImageFactory.h +2 -2
  21. package/cpp/api/JsiSkPath.h +1 -1
  22. package/cpp/api/JsiSkPathFactory.h +1 -1
  23. package/cpp/api/JsiSkSkottie.h +1 -1
  24. package/cpp/api/JsiSkSurface.h +18 -6
  25. package/cpp/api/JsiSkTypeface.h +1 -1
  26. package/cpp/api/JsiSkTypefaceFontProvider.h +1 -1
  27. package/cpp/api/JsiSkiaContext.h +2 -2
  28. package/cpp/api/JsiTextureInfo.h +1 -1
  29. package/cpp/api/JsiVideo.h +2 -2
  30. package/cpp/api/recorder/Convertor.h +1 -1
  31. package/cpp/api/recorder/Drawings.h +1 -1
  32. package/cpp/api/recorder/JsiRecorder.h +4 -4
  33. package/cpp/api/recorder/RNRecorder.h +1 -1
  34. package/cpp/api/third_party/SkottieUtils.cpp +1 -1
  35. package/cpp/api/third_party/base64.cpp +1 -1
  36. package/cpp/jsi/JsiHostObject.cpp +5 -7
  37. package/cpp/jsi/JsiPromises.h +1 -1
  38. package/cpp/jsi/ViewProperty.h +1 -1
  39. package/cpp/rnskia/RNDawnContext.h +13 -0
  40. package/cpp/rnskia/RNDawnUtils.h +11 -1
  41. package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
  42. package/cpp/rnskia/RNSkManager.cpp +88 -2
  43. package/cpp/rnskia/RNSkPictureView.h +4 -4
  44. package/cpp/rnskia/RNSkPlatformContext.h +7 -0
  45. package/cpp/rnskia/RNSkView.h +9 -6
  46. package/cpp/rnwgpu/ArrayBuffer.h +51 -7
  47. package/cpp/rnwgpu/api/AppleNativeBuffer.h +22 -0
  48. package/cpp/rnwgpu/api/Convertors.h +33 -11
  49. package/cpp/rnwgpu/api/GPU.cpp +0 -3
  50. package/cpp/rnwgpu/api/GPUAdapter.cpp +37 -7
  51. package/cpp/rnwgpu/api/GPUBuffer.h +1 -1
  52. package/cpp/rnwgpu/api/GPUDevice.cpp +84 -6
  53. package/cpp/rnwgpu/api/GPUDevice.h +12 -0
  54. package/cpp/rnwgpu/api/GPUExternalTexture.cpp +139 -0
  55. package/cpp/rnwgpu/api/GPUExternalTexture.h +52 -2
  56. package/cpp/rnwgpu/api/GPUQueue.cpp +50 -45
  57. package/cpp/rnwgpu/api/GPUShaderModule.cpp +1 -1
  58. package/cpp/rnwgpu/api/GPUSharedFence.cpp +80 -0
  59. package/cpp/rnwgpu/api/GPUSharedFence.h +53 -0
  60. package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +135 -0
  61. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +75 -0
  62. package/cpp/rnwgpu/api/ImageBitmap.h +62 -0
  63. package/cpp/rnwgpu/api/NativeBufferUtils.h +87 -0
  64. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +4 -1
  65. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
  66. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +56 -0
  67. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +10 -0
  68. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -24
  69. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +9 -9
  70. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
  71. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +2 -2
  72. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +58 -0
  73. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +51 -0
  74. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +73 -0
  75. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
  76. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
  77. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +1 -1
  78. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
  79. package/cpp/skia/include/android/SkAnimatedImage.h +1 -1
  80. package/cpp/skia/include/codec/SkCodec.h +0 -8
  81. package/cpp/skia/include/codec/SkEncodedOrigin.h +1 -1
  82. package/cpp/skia/include/codec/SkPngRustDecoder.h +1 -1
  83. package/cpp/skia/include/core/SkBitmap.h +2 -8
  84. package/cpp/skia/include/core/SkCPURecorder.h +3 -1
  85. package/cpp/skia/include/core/SkCanvasVirtualEnforcer.h +1 -1
  86. package/cpp/skia/include/core/SkColorType.h +5 -3
  87. package/cpp/skia/include/core/SkContourMeasure.h +1 -1
  88. package/cpp/skia/include/core/SkCoverageMode.h +1 -1
  89. package/cpp/skia/include/core/SkCubicMap.h +1 -1
  90. package/cpp/skia/include/core/SkExecutor.h +1 -1
  91. package/cpp/skia/include/core/SkFont.h +15 -0
  92. package/cpp/skia/include/core/SkFontArguments.h +6 -1
  93. package/cpp/skia/include/core/SkFontMetrics.h +1 -1
  94. package/cpp/skia/include/core/SkFontMgr.h +36 -1
  95. package/cpp/skia/include/core/SkFontParameters.h +1 -1
  96. package/cpp/skia/include/core/SkFontScanner.h +1 -1
  97. package/cpp/skia/include/core/SkFontTypes.h +1 -1
  98. package/cpp/skia/include/core/SkM44.h +1 -1
  99. package/cpp/skia/include/core/SkMilestone.h +1 -1
  100. package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +1 -1
  101. package/cpp/skia/include/core/SkPathBuilder.h +10 -4
  102. package/cpp/skia/include/core/SkPathIter.h +1 -1
  103. package/cpp/skia/include/core/SkPathTypes.h +1 -1
  104. package/cpp/skia/include/core/SkPixelRef.h +4 -1
  105. package/cpp/skia/include/core/SkRecorder.h +2 -1
  106. package/cpp/skia/include/core/SkRegion.h +17 -6
  107. package/cpp/skia/include/core/SkSamplingOptions.h +1 -1
  108. package/cpp/skia/include/core/SkSerialProcs.h +8 -1
  109. package/cpp/skia/include/core/SkShader.h +3 -5
  110. package/cpp/skia/include/core/SkSpan.h +1 -1
  111. package/cpp/skia/include/core/SkStream.h +1 -1
  112. package/cpp/skia/include/core/SkStrikeRef.h +80 -0
  113. package/cpp/skia/include/core/SkTileMode.h +1 -1
  114. package/cpp/skia/include/core/SkVertices.h +1 -1
  115. package/cpp/skia/include/core/SkYUVAPixmaps.h +3 -5
  116. package/cpp/skia/include/docs/SkPDFDocument.h +1 -1
  117. package/cpp/skia/include/docs/SkXPSDocument.h +1 -1
  118. package/cpp/skia/include/effects/SkGradient.h +1 -1
  119. package/cpp/skia/include/effects/SkHighContrastFilter.h +1 -1
  120. package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -2
  121. package/cpp/skia/include/effects/SkShaderMaskFilter.h +1 -1
  122. package/cpp/skia/include/effects/SkTrimPathEffect.h +1 -1
  123. package/cpp/skia/include/encode/SkEncoder.h +1 -1
  124. package/cpp/skia/include/encode/SkJpegEncoder.h +1 -1
  125. package/cpp/skia/include/encode/SkPngEncoder.h +1 -1
  126. package/cpp/skia/include/encode/SkPngRustEncoder.h +1 -1
  127. package/cpp/skia/include/encode/SkWebpEncoder.h +1 -1
  128. package/cpp/skia/include/gpu/GpuTypes.h +2 -0
  129. package/cpp/skia/include/gpu/MutableTextureState.h +1 -1
  130. package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +1 -1
  131. package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +6 -62
  132. package/cpp/skia/include/gpu/ganesh/GrContextThreadSafeProxy.h +1 -1
  133. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +1 -1
  134. package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +1 -1
  135. package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +2 -1
  136. package/cpp/skia/include/gpu/ganesh/mock/GrMockBackendSurface.h +59 -0
  137. package/cpp/skia/include/gpu/ganesh/mock/GrMockTypes.h +1 -1
  138. package/cpp/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h +1 -1
  139. package/cpp/skia/include/gpu/ganesh/mtl/GrMtlTypes.h +1 -1
  140. package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +1 -1
  141. package/cpp/skia/include/gpu/graphite/Context.h +12 -5
  142. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +6 -0
  143. package/cpp/skia/include/gpu/graphite/Image.h +82 -9
  144. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +7 -2
  145. package/cpp/skia/include/gpu/graphite/Recorder.h +6 -4
  146. package/cpp/skia/include/gpu/graphite/precompile/PrecompileColorFilter.h +11 -1
  147. package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +1 -0
  148. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +1 -1
  149. package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +1 -1
  150. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
  151. package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +1 -1
  152. package/cpp/skia/include/gpu/vk/VulkanTypes.h +1 -1
  153. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  154. package/cpp/skia/include/ports/SkFontMgr_Fontations.h +1 -1
  155. package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +1 -1
  156. package/cpp/skia/include/ports/SkFontMgr_data.h +1 -1
  157. package/cpp/skia/include/ports/SkFontMgr_fuchsia.h +1 -1
  158. package/cpp/skia/include/ports/SkFontMgr_mac_ct.h +1 -1
  159. package/cpp/skia/include/ports/SkFontScanner_Fontations.h +1 -1
  160. package/cpp/skia/include/ports/SkFontScanner_FreeType.h +1 -1
  161. package/cpp/skia/include/ports/SkTypeface_fontations.h +1 -1
  162. package/cpp/skia/include/private/SkExif.h +1 -1
  163. package/cpp/skia/include/private/SkGainmapInfo.h +1 -1
  164. package/cpp/skia/include/private/SkGainmapShader.h +1 -1
  165. package/cpp/skia/include/private/SkHdrMetadata.h +21 -0
  166. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -1
  167. package/cpp/skia/include/private/SkPixelStorage.h +37 -0
  168. package/cpp/skia/include/private/SkXmp.h +1 -1
  169. package/cpp/skia/include/private/base/SkAssert.h +6 -5
  170. package/cpp/skia/include/private/base/SkContainers.h +1 -1
  171. package/cpp/skia/include/private/base/SkFeatures.h +30 -30
  172. package/cpp/skia/include/private/base/SkLog.h +1 -7
  173. package/cpp/skia/include/private/base/SkLogPriority.h +4 -5
  174. package/cpp/skia/include/private/base/SkMacros.h +1 -1
  175. package/cpp/skia/include/private/base/SkMalloc.h +1 -1
  176. package/cpp/skia/include/private/base/SkSafe32.h +1 -1
  177. package/cpp/skia/include/private/base/SkSpan_impl.h +1 -1
  178. package/cpp/skia/include/private/base/SkTDArray.h +13 -1
  179. package/cpp/skia/include/private/base/SkTPin.h +1 -1
  180. package/cpp/skia/include/private/base/SkTo.h +1 -1
  181. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +1 -1
  182. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +1 -1
  183. package/cpp/skia/include/private/chromium/SkCodecsICCProfileChromium.h +52 -0
  184. package/cpp/skia/include/private/chromium/SkExifChromium.h +26 -0
  185. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
  186. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
  187. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +2 -1
  188. package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +1 -1
  189. package/cpp/skia/include/sksl/SkSLDebugTrace.h +1 -1
  190. package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +41 -51
  191. package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +42 -53
  192. package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -1
  193. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +158 -154
  194. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +68 -65
  195. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +90 -87
  196. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +9 -9
  197. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +2 -2
  198. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +82 -79
  199. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +24 -24
  200. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +2 -2
  201. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +95 -96
  202. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std.h +151 -0
  203. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std_decode.h +68 -0
  204. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
  205. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +5 -1
  206. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +7 -1
  207. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +291 -158
  208. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +13174 -10113
  209. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +23 -19
  210. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +159 -165
  211. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +22 -19
  212. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +3 -1
  213. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +3 -1
  214. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +94 -88
  215. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ohos.h +120 -0
  216. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +55 -51
  217. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +18 -15
  218. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +23 -19
  219. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +31 -1
  220. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +5 -1
  221. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +27 -27
  222. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +20 -16
  223. package/cpp/skia/include/utils/SkEventTracer.h +6 -1
  224. package/cpp/skia/include/utils/SkOrderedFontMgr.h +1 -1
  225. package/cpp/skia/include/utils/SkShadowUtils.h +1 -1
  226. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  227. package/cpp/skia/modules/jsonreader/SkJSONReader.cpp +20 -4
  228. package/cpp/skia/modules/skcms/src/Transform_inl.h +11 -15
  229. package/cpp/skia/modules/skcms/src/skcms_public.h +2 -0
  230. package/cpp/skia/modules/skottie/include/ExternalLayer.h +1 -1
  231. package/cpp/skia/modules/skottie/include/Skottie.h +1 -1
  232. package/cpp/skia/modules/skottie/include/SkottieProperty.h +1 -1
  233. package/cpp/skia/modules/skottie/include/SlotManager.h +1 -1
  234. package/cpp/skia/modules/skottie/include/TextShaper.h +1 -1
  235. package/cpp/skia/modules/skottie/src/SkottieValue.h +1 -1
  236. package/cpp/skia/modules/skottie/src/animator/Animator.h +1 -1
  237. package/cpp/skia/modules/skottie/src/text/Font.h +1 -1
  238. package/cpp/skia/modules/skottie/src/text/TextAdapter.h +1 -1
  239. package/cpp/skia/modules/skottie/src/text/TextAnimator.h +3 -2
  240. package/cpp/skia/modules/skottie/src/text/TextValue.h +1 -1
  241. package/cpp/skia/modules/skparagraph/include/DartTypes.h +1 -1
  242. package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
  243. package/cpp/skia/modules/skparagraph/include/FontCollection.h +5 -1
  244. package/cpp/skia/modules/skparagraph/include/Metrics.h +1 -1
  245. package/cpp/skia/modules/skparagraph/include/Paragraph.h +1 -1
  246. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +1 -1
  247. package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -1
  248. package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +1 -1
  249. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +12 -5
  250. package/cpp/skia/modules/skparagraph/include/TextShadow.h +1 -1
  251. package/cpp/skia/modules/skparagraph/include/TextStyle.h +1 -1
  252. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -1
  253. package/cpp/skia/modules/sksg/include/SkSGClipEffect.h +1 -1
  254. package/cpp/skia/modules/sksg/include/SkSGColorFilter.h +1 -1
  255. package/cpp/skia/modules/sksg/include/SkSGDraw.h +1 -1
  256. package/cpp/skia/modules/sksg/include/SkSGEffectNode.h +1 -1
  257. package/cpp/skia/modules/sksg/include/SkSGGeometryEffect.h +1 -1
  258. package/cpp/skia/modules/sksg/include/SkSGGeometryNode.h +1 -1
  259. package/cpp/skia/modules/sksg/include/SkSGGradient.h +1 -1
  260. package/cpp/skia/modules/sksg/include/SkSGGroup.h +1 -1
  261. package/cpp/skia/modules/sksg/include/SkSGImage.h +1 -1
  262. package/cpp/skia/modules/sksg/include/SkSGInvalidationController.h +1 -1
  263. package/cpp/skia/modules/sksg/include/SkSGMaskEffect.h +1 -1
  264. package/cpp/skia/modules/sksg/include/SkSGMerge.h +1 -1
  265. package/cpp/skia/modules/sksg/include/SkSGNode.h +1 -1
  266. package/cpp/skia/modules/sksg/include/SkSGOpacityEffect.h +1 -1
  267. package/cpp/skia/modules/sksg/include/SkSGPaint.h +1 -1
  268. package/cpp/skia/modules/sksg/include/SkSGPath.h +1 -1
  269. package/cpp/skia/modules/sksg/include/SkSGPlane.h +1 -1
  270. package/cpp/skia/modules/sksg/include/SkSGRect.h +1 -1
  271. package/cpp/skia/modules/sksg/include/SkSGRenderEffect.h +1 -1
  272. package/cpp/skia/modules/sksg/include/SkSGRenderNode.h +1 -1
  273. package/cpp/skia/modules/sksg/include/SkSGScene.h +1 -1
  274. package/cpp/skia/modules/sksg/include/SkSGText.h +1 -1
  275. package/cpp/skia/modules/sksg/include/SkSGTransform.h +1 -1
  276. package/cpp/skia/modules/skshaper/include/SkShaper_coretext.h +8 -1
  277. package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
  278. package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
  279. package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
  280. package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +1 -1
  281. package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
  282. package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
  283. package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
  284. package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
  285. package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
  286. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  287. package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
  288. package/cpp/skia/modules/svg/include/SkSVGFeMerge.h +1 -1
  289. package/cpp/skia/modules/svg/include/SkSVGFeMorphology.h +1 -1
  290. package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
  291. package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
  292. package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
  293. package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +1 -1
  294. package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
  295. package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
  296. package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
  297. package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +1 -1
  298. package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
  299. package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
  300. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  301. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  302. package/cpp/skia/src/base/SkAutoLocaleSetter.h +94 -0
  303. package/cpp/skia/src/base/SkUTF.h +1 -1
  304. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
  305. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  306. package/lib/commonjs/skia/types/WebGPU.d.ts +153 -0
  307. package/lib/commonjs/skia/types/WebGPU.js +6 -0
  308. package/lib/commonjs/skia/types/WebGPU.js.map +1 -0
  309. package/lib/commonjs/skia/types/index.d.ts +1 -0
  310. package/lib/commonjs/skia/types/index.js +11 -0
  311. package/lib/commonjs/skia/types/index.js.map +1 -1
  312. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
  313. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +19 -0
  314. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
  315. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  316. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
  317. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  318. package/lib/module/skia/types/WebGPU.d.ts +153 -0
  319. package/lib/module/skia/types/WebGPU.js +2 -0
  320. package/lib/module/skia/types/WebGPU.js.map +1 -0
  321. package/lib/module/skia/types/index.d.ts +1 -0
  322. package/lib/module/skia/types/index.js +1 -0
  323. package/lib/module/skia/types/index.js.map +1 -1
  324. package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
  325. package/lib/module/skia/web/JsiSkNativeBufferFactory.js +19 -0
  326. package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
  327. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  328. package/lib/module/web/LoadSkiaWeb.js +1 -2
  329. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  330. package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +1 -0
  331. package/lib/typescript/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
  332. package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +1 -0
  333. package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
  334. package/lib/typescript/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
  335. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
  336. package/lib/typescript/src/skia/types/WebGPU.d.ts +153 -0
  337. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  338. package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
  339. package/package.json +18 -15
  340. package/react-native-skia.podspec +59 -7
  341. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +10 -1
  342. package/src/skia/types/WebGPU.ts +186 -0
  343. package/src/skia/types/index.ts +1 -0
  344. package/src/skia/web/JsiSkNativeBufferFactory.ts +20 -0
  345. package/src/skia/web/JsiSkPath.ts +8 -2
  346. package/scripts/install-libs.js +0 -133
@@ -1,26 +1,36 @@
1
1
  #pragma once
2
2
 
3
+ #include <cstdint>
3
4
  #include <memory>
4
5
  #include <optional>
5
6
  #include <string>
6
- #include <variant>
7
7
 
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
10
- #include "Convertors.h"
11
-
12
10
  #include "jsi2/JSIConverter.h"
13
11
 
14
12
  namespace jsi = facebook::jsi;
15
13
 
16
14
  namespace rnwgpu {
17
15
 
16
+ // Mirror of GPUExternalTextureDescriptor from the WebGPU spec, adapted to
17
+ // Skia's binding. Skia has no VideoFrame; instead `source` is a native buffer
18
+ // pointer (the BigInt returned by Skia.NativeBuffer.MakeFromImage): a
19
+ // CVPixelBufferRef on Apple, an AHardwareBuffer* on Android. The pointer's
20
+ // lifetime is owned by the caller (Skia.NativeBuffer.Release); the imported
21
+ // texture must not outlive it.
22
+ //
23
+ // We don't expose colorSpace yet; the C++ side picks dst-sRGB and identity
24
+ // gamut, the right default for "render this BGRA frame to an sRGB framebuffer".
25
+ //
26
+ // `rotation` / `mirrored` are a non-spec extension baked into Dawn's sampling
27
+ // transform. `rotation` is in degrees and must be one of 0 / 90 / 180 / 270.
18
28
  struct GPUExternalTextureDescriptor {
19
- // std::variant<std::shared_ptr<HTMLVideoElement>,
20
- // std::shared_ptr<VideoFrame>>
21
- // source; // | HTMLVideoElement | VideoFrame
22
- // std::optional<wgpu::DefinedColorSpace> colorSpace; // PredefinedColorSpace
23
- std::optional<std::string> label; // string
29
+ // native buffer pointer (CVPixelBufferRef / AHardwareBuffer*)
30
+ uint64_t source = 0;
31
+ std::optional<std::string> label;
32
+ std::optional<double> rotation;
33
+ std::optional<bool> mirrored;
24
34
  };
25
35
 
26
36
  } // namespace rnwgpu
@@ -31,23 +41,21 @@ template <>
31
41
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
32
42
  static std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>
33
43
  fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
34
- auto result = std::make_unique<rnwgpu::GPUExternalTextureDescriptor>();
44
+ auto result = std::make_shared<rnwgpu::GPUExternalTextureDescriptor>();
35
45
  if (!outOfBounds && arg.isObject()) {
36
46
  auto value = arg.getObject(runtime);
37
47
  if (value.hasProperty(runtime, "source")) {
38
48
  auto prop = value.getProperty(runtime, "source");
39
- // result->source = JSIConverter<
40
- // std::variant<std::shared_ptr<HTMLVideoElement>,
41
- // std::shared_ptr<VideoFrame>>>::fromJSI(runtime,
42
- // prop,
43
- // false);
44
- }
45
- if (value.hasProperty(runtime, "colorSpace")) {
46
- auto prop = value.getProperty(runtime, "colorSpace");
47
- if (!prop.isUndefined()) {
48
- // result->colorSpace =
49
- // JSIConverter<std::optional<wgpu::definedColorSpace>>::fromJSI(
50
- // runtime, prop, false);
49
+ // The native buffer pointer arrives as a BigInt (uintptr_t value). It
50
+ // must be a BigInt: a JS number can't represent a 64-bit pointer
51
+ // without truncation, so we reject it rather than corrupt the address.
52
+ if (prop.isBigInt()) {
53
+ result->source = prop.asBigInt(runtime).asUint64(runtime);
54
+ } else if (!prop.isUndefined() && !prop.isNull()) {
55
+ throw jsi::JSError(
56
+ runtime, "GPUExternalTextureDescriptor.source must be a "
57
+ "NativeBuffer (BigInt) from "
58
+ "Skia.NativeBuffer.MakeFromImage / MakeTestBuffer");
51
59
  }
52
60
  }
53
61
  if (value.hasProperty(runtime, "label")) {
@@ -57,13 +65,24 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
57
65
  runtime, prop, false);
58
66
  }
59
67
  }
68
+ if (value.hasProperty(runtime, "rotation")) {
69
+ auto prop = value.getProperty(runtime, "rotation");
70
+ if (prop.isNumber()) {
71
+ result->rotation = prop.asNumber();
72
+ }
73
+ }
74
+ if (value.hasProperty(runtime, "mirrored")) {
75
+ auto prop = value.getProperty(runtime, "mirrored");
76
+ if (prop.isBool()) {
77
+ result->mirrored = prop.getBool();
78
+ }
79
+ }
60
80
  }
61
-
62
81
  return result;
63
82
  }
64
83
  static jsi::Value
65
- toJSI(jsi::Runtime &runtime,
66
- std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> arg) {
84
+ toJSI(jsi::Runtime & /*runtime*/,
85
+ std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> /*arg*/) {
67
86
  throw std::runtime_error("Invalid GPUExternalTextureDescriptor::toJSI()");
68
87
  }
69
88
  };
@@ -7,17 +7,18 @@
7
7
 
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
10
- #include "Convertors.h"
10
+ #include "rnwgpu/api/Convertors.h"
11
11
  #include "jsi2/JSIConverter.h"
12
12
 
13
- #include "GPUOrigin2D.h"
13
+ #include "rnwgpu/api/GPUOrigin2D.h"
14
+ #include "rnwgpu/api/ImageBitmap.h"
14
15
 
15
16
  namespace jsi = facebook::jsi;
16
17
 
17
18
  namespace rnwgpu {
18
19
 
19
20
  struct GPUImageCopyExternalImage {
20
- // std::shared_ptr<ImageBitmap> source; // GPUImageCopyExternalImageSource
21
+ std::shared_ptr<ImageBitmap> source; // GPUImageCopyExternalImageSource
21
22
  std::optional<std::shared_ptr<GPUOrigin2D>> origin; // GPUOrigin2DStrict
22
23
  std::optional<bool> flipY; // boolean
23
24
  };
@@ -33,12 +34,11 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUImageCopyExternalImage>> {
33
34
  auto result = std::make_unique<rnwgpu::GPUImageCopyExternalImage>();
34
35
  if (!outOfBounds && arg.isObject()) {
35
36
  auto obj = arg.getObject(runtime);
36
- // if (obj.hasProperty(runtime, "source")) {
37
- // auto prop = obj.getProperty(runtime, "source");
38
- // result->source =
39
- // JSIConverter<std::shared_ptr<ImageBitmap>>::fromJSI(
40
- // runtime, prop, false);
41
- // }
37
+ if (obj.hasProperty(runtime, "source")) {
38
+ auto prop = obj.getProperty(runtime, "source");
39
+ result->source = JSIConverter<std::shared_ptr<ImageBitmap>>::fromJSI(
40
+ runtime, prop, false);
41
+ }
42
42
  if (obj.hasProperty(runtime, "origin")) {
43
43
  auto prop = obj.getProperty(runtime, "origin");
44
44
  result->origin = JSIConverter<std::shared_ptr<GPUOrigin2D>>::fromJSI(
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "jsi2/JSIConverter.h"
8
8
 
9
- #include "GPUOrigin3D.h"
9
+ #include "rnwgpu/api/GPUOrigin3D.h"
10
10
  #include "rnwgpu/api/GPUTexture.h"
11
11
 
12
12
  namespace jsi = facebook::jsi;
@@ -6,8 +6,8 @@
6
6
 
7
7
  #include "jsi2/JSIConverter.h"
8
8
 
9
- #include "External.h"
10
- #include "GPUOrigin3D.h"
9
+ #include "rnwgpu/api/External.h"
10
+ #include "rnwgpu/api/GPUOrigin3D.h"
11
11
  #include "rnwgpu/api/GPUTexture.h"
12
12
 
13
13
  namespace jsi = facebook::jsi;
@@ -0,0 +1,58 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <optional>
5
+ #include <string>
6
+
7
+ #include "webgpu/webgpu_cpp.h"
8
+
9
+ #include "jsi2/JSIConverter.h"
10
+
11
+ namespace jsi = facebook::jsi;
12
+
13
+ namespace rnwgpu {
14
+
15
+ // Descriptor for GPUDevice.importSharedFence. `handle` is the native handle
16
+ // (an id<MTLSharedEvent> pointer on Apple, an OS file descriptor on Android),
17
+ // passed from JS as a BigInt.
18
+ struct GPUSharedFenceDescriptor {
19
+ std::string type;
20
+ void *handle = nullptr;
21
+ std::optional<std::string> label;
22
+ };
23
+
24
+ } // namespace rnwgpu
25
+
26
+ namespace rnwgpu {
27
+
28
+ template <>
29
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUSharedFenceDescriptor>> {
30
+ static std::shared_ptr<rnwgpu::GPUSharedFenceDescriptor>
31
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
32
+ auto result = std::make_unique<rnwgpu::GPUSharedFenceDescriptor>();
33
+ if (!outOfBounds && arg.isObject()) {
34
+ auto value = arg.getObject(runtime);
35
+ if (value.hasProperty(runtime, "type")) {
36
+ result->type =
37
+ value.getProperty(runtime, "type").asString(runtime).utf8(runtime);
38
+ }
39
+ if (value.hasProperty(runtime, "handle")) {
40
+ auto prop = value.getProperty(runtime, "handle");
41
+ result->handle = JSIConverter<void *>::fromJSI(runtime, prop, false);
42
+ }
43
+ if (value.hasProperty(runtime, "label")) {
44
+ auto prop = value.getProperty(runtime, "label");
45
+ result->label = JSIConverter<std::optional<std::string>>::fromJSI(
46
+ runtime, prop, false);
47
+ }
48
+ }
49
+ return result;
50
+ }
51
+ static jsi::Value
52
+ toJSI(jsi::Runtime & /*runtime*/,
53
+ std::shared_ptr<rnwgpu::GPUSharedFenceDescriptor> /*arg*/) {
54
+ throw std::runtime_error("Invalid GPUSharedFenceDescriptor::toJSI()");
55
+ }
56
+ };
57
+
58
+ } // namespace rnwgpu
@@ -0,0 +1,51 @@
1
+ #pragma once
2
+
3
+ #include <cstdint>
4
+ #include <memory>
5
+
6
+ #include "webgpu/webgpu_cpp.h"
7
+
8
+ #include "jsi2/JSIConverter.h"
9
+
10
+ #include "rnwgpu/api/GPUSharedFence.h"
11
+
12
+ namespace jsi = facebook::jsi;
13
+
14
+ namespace rnwgpu {
15
+
16
+ // A fence and the timeline value to wait for / signal at.
17
+ struct GPUSharedFenceState {
18
+ std::shared_ptr<GPUSharedFence> fence;
19
+ uint64_t signaledValue = 0;
20
+ };
21
+
22
+ } // namespace rnwgpu
23
+
24
+ namespace rnwgpu {
25
+
26
+ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUSharedFenceState>> {
27
+ static std::shared_ptr<rnwgpu::GPUSharedFenceState>
28
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
29
+ auto result = std::make_unique<rnwgpu::GPUSharedFenceState>();
30
+ if (!outOfBounds && arg.isObject()) {
31
+ auto value = arg.getObject(runtime);
32
+ if (value.hasProperty(runtime, "fence")) {
33
+ auto prop = value.getProperty(runtime, "fence");
34
+ result->fence = JSIConverter<std::shared_ptr<GPUSharedFence>>::fromJSI(
35
+ runtime, prop, false);
36
+ }
37
+ if (value.hasProperty(runtime, "signaledValue")) {
38
+ auto prop = value.getProperty(runtime, "signaledValue");
39
+ result->signaledValue =
40
+ JSIConverter<uint64_t>::fromJSI(runtime, prop, false);
41
+ }
42
+ }
43
+ return result;
44
+ }
45
+ static jsi::Value toJSI(jsi::Runtime &runtime,
46
+ std::shared_ptr<rnwgpu::GPUSharedFenceState> arg) {
47
+ throw std::runtime_error("Invalid GPUSharedFenceState::toJSI()");
48
+ }
49
+ };
50
+
51
+ } // namespace rnwgpu
@@ -0,0 +1,73 @@
1
+ #pragma once
2
+
3
+ #include <cstdint>
4
+ #include <memory>
5
+ #include <optional>
6
+ #include <string>
7
+
8
+ #include "webgpu/webgpu_cpp.h"
9
+
10
+ #include "jsi2/JSIConverter.h"
11
+
12
+ namespace jsi = facebook::jsi;
13
+
14
+ namespace rnwgpu {
15
+
16
+ // Descriptor for GPUDevice.importSharedTextureMemory.
17
+ //
18
+ // `handle` is a native buffer pointer as a uintptr_t (passed as a BigInt from
19
+ // JS), i.e. the value returned by Skia.NativeBuffer.MakeFromImage:
20
+ // - Apple platforms: CVPixelBufferRef (its backing IOSurface is imported)
21
+ // - Android: AHardwareBuffer*
22
+ //
23
+ // Lifetime: the caller is responsible for keeping the underlying object alive
24
+ // (via Skia.NativeBuffer.Release) for as long as this shared memory is in use.
25
+ struct GPUSharedTextureMemoryDescriptor {
26
+ uint64_t handle = 0;
27
+ std::optional<std::string> label;
28
+ };
29
+
30
+ } // namespace rnwgpu
31
+
32
+ namespace rnwgpu {
33
+
34
+ template <>
35
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>> {
36
+ static std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>
37
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
38
+ auto result = std::make_shared<rnwgpu::GPUSharedTextureMemoryDescriptor>();
39
+ if (!outOfBounds && arg.isObject()) {
40
+ auto value = arg.getObject(runtime);
41
+ if (value.hasProperty(runtime, "handle")) {
42
+ auto prop = value.getProperty(runtime, "handle");
43
+ // The native buffer pointer arrives as a BigInt (uintptr_t value). It
44
+ // must be a BigInt: a JS number can't represent a 64-bit pointer
45
+ // without truncation, so we reject it rather than corrupt the address.
46
+ if (prop.isBigInt()) {
47
+ result->handle = prop.asBigInt(runtime).asUint64(runtime);
48
+ } else if (!prop.isUndefined() && !prop.isNull()) {
49
+ throw jsi::JSError(
50
+ runtime, "GPUSharedTextureMemoryDescriptor.handle must be a "
51
+ "NativeBuffer (BigInt) from "
52
+ "Skia.NativeBuffer.MakeFromImage / MakeTestBuffer");
53
+ }
54
+ }
55
+ if (value.hasProperty(runtime, "label")) {
56
+ auto prop = value.getProperty(runtime, "label");
57
+ if (!prop.isUndefined()) {
58
+ result->label = JSIConverter<std::optional<std::string>>::fromJSI(
59
+ runtime, prop, false);
60
+ }
61
+ }
62
+ }
63
+ return result;
64
+ }
65
+ static jsi::Value
66
+ toJSI(jsi::Runtime & /*runtime*/,
67
+ std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor> /*arg*/) {
68
+ throw std::runtime_error(
69
+ "Invalid GPUSharedTextureMemoryDescriptor::toJSI()");
70
+ }
71
+ };
72
+
73
+ } // namespace rnwgpu
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include "jsi2/JSIConverter.h"
10
10
 
11
- #include "GPUExtent3D.h"
11
+ #include "rnwgpu/api/GPUExtent3D.h"
12
12
 
13
13
  namespace jsi = facebook::jsi;
14
14
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include "jsi2/JSIConverter.h"
8
8
 
9
- #include "GPUError.h"
9
+ #include "rnwgpu/api/GPUError.h"
10
10
 
11
11
  namespace jsi = facebook::jsi;
12
12
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2019 Google Inc.
2
+ * Copyright 2019 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2017 Google Inc.
2
+ * Copyright 2017 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -834,14 +834,6 @@ public:
834
834
  };
835
835
  IsAnimated isAnimated() { return this->onIsAnimated(); }
836
836
 
837
- // Register a decoder at runtime by passing two function pointers:
838
- // - peek() to return true if the span of bytes appears to be your encoded format;
839
- // - make() to attempt to create an SkCodec from the given stream.
840
- // Not thread safe.
841
- static void Register(
842
- bool (*peek)(const void*, size_t),
843
- std::unique_ptr<SkCodec> (*make)(std::unique_ptr<SkStream>, SkCodec::Result*));
844
-
845
837
  protected:
846
838
  const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; }
847
839
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2017 Google Inc.
2
+ * Copyright 2017 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2024 Google LLC.
2
+ * Copyright 2024 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -27,7 +27,6 @@
27
27
  class SkColorSpace;
28
28
  class SkImage;
29
29
  class SkMatrix;
30
- class SkMipmap;
31
30
  class SkPaint;
32
31
  class SkPixelRef;
33
32
  class SkShader;
@@ -1241,13 +1240,8 @@ public:
1241
1240
  };
1242
1241
 
1243
1242
  private:
1244
- sk_sp<SkPixelRef> fPixelRef;
1245
- SkPixmap fPixmap;
1246
- sk_sp<SkMipmap> fMips;
1247
-
1248
- friend class SkImage_Raster;
1249
- friend class SkReadBuffer; // unflatten
1250
- friend class GrProxyProvider; // fMips
1243
+ sk_sp<SkPixelRef> fPixelRef;
1244
+ SkPixmap fPixmap;
1251
1245
  };
1252
1246
 
1253
1247
  ///////////////////////////////////////////////////////////////////////////////
@@ -8,11 +8,13 @@
8
8
  #ifndef skcpu_Recorder_DEFINED
9
9
  #define skcpu_Recorder_DEFINED
10
10
 
11
+ #include <cstdint>
11
12
  #include "include/core/SkRecorder.h"
12
13
  #include "include/core/SkRefCnt.h"
13
14
  #include "include/private/base/SkAPI.h"
14
15
 
15
16
  class SkCanvas;
17
+ class SkContentID;
16
18
  class SkSurface;
17
19
  class SkSurfaceProps;
18
20
  struct SkImageInfo;
@@ -57,7 +59,7 @@ public:
57
59
  private:
58
60
  // TODO (b/412351769): Implement this so we can capture from a CPU Recorder.
59
61
  SkCanvas* makeCaptureCanvas(SkCanvas*) final { return nullptr; }
60
- void createCaptureBreakpoint(SkSurface*) final {}
62
+ SkContentID createCaptureBreakpoint(SkSurface*) final;
61
63
  };
62
64
 
63
65
  inline Recorder* AsRecorder(SkRecorder* recorder) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -103,15 +103,17 @@ enum SkColorType : int {
103
103
  // Four channel RGBA data (32-bit float per channel) packed into a LE 128-bit word.
104
104
  // Bits: [A:127..96 B:95..64 G:63..32 R:31..0]
105
105
  kRGBA_F32_SkColorType,
106
-
107
- // The following 8 colortypes are just for reading from - not for rendering to
108
-
109
106
  // Two channel RG data (8 bits per channel). Blue is forced to 0, alpha is forced to opaque.
110
107
  // Bits: [G:15..8 R:7..0]
111
108
  kR8G8_unorm_SkColorType,
112
109
  // Single channel data (16-bit half-float) interpreted as alpha. RGB are 0.
113
110
  // Bits: [A:15..0]
114
111
  kA16_float_SkColorType,
112
+
113
+ // Single channel data (16 bits half-float) interpreted as red. G and B are forced to 0, alpha
114
+ // is forced to opaque.
115
+ // Bits: [R:15..0]
116
+ kR16_float_SkColorType,
115
117
  // Two channel RG data (16-bit half-float per channel) packed into a LE 32-bit word.
116
118
  // Blue is forced to 0, alpha is forced to opaque.
117
119
  // Bits: [G:31..16 R:15..0]
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2017 Google Inc.
2
+ * Copyright 2017 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -26,6 +26,7 @@
26
26
 
27
27
  class SkMatrix;
28
28
  class SkPaint;
29
+ class SkStrikeRef;
29
30
  enum class SkFontHinting;
30
31
  enum class SkTextEncoding;
31
32
  struct SkFontMetrics;
@@ -356,6 +357,20 @@ public:
356
357
  SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding encoding,
357
358
  SkRect* bounds, const SkPaint* paint) const;
358
359
 
360
+ /** Returns an SkStrikeRef for this font's current settings.
361
+
362
+ An SkStrikeRef caches the resolved strike (font metrics engine), avoiding the overhead
363
+ of descriptor construction, hashing, and global cache lookup on each glyph query.
364
+ This is useful when making many glyph metric calls (e.g. getWidths) with the same
365
+ font configuration.
366
+
367
+ The returned SkStrikeRef is independent of this SkFont; subsequent changes to this
368
+ SkFont do not affect it. Create a new SkStrikeRef after changing font properties.
369
+
370
+ @return an SkStrikeRef for the current font settings
371
+ */
372
+ SkStrikeRef makeStrikeRef() const;
373
+
359
374
  /** Retrieves the advance and bounds for each glyph in glyphs.
360
375
  widths receives min(widths.size(), glyphs.size()) values.
361
376
  bounds receives min(bounds.size(), glyphs.size()) values.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2017 Google Inc.
2
+ * Copyright 2017 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -19,6 +19,11 @@
19
19
  struct SkFontArguments {
20
20
  struct VariationPosition {
21
21
  struct Coordinate {
22
+ static constexpr SkFourByteTag wght = SkSetFourByteTag('w', 'g', 'h', 't');
23
+ static constexpr SkFourByteTag wdth = SkSetFourByteTag('w', 'd', 't', 'h');
24
+ static constexpr SkFourByteTag slnt = SkSetFourByteTag('s', 'l', 'n', 't');
25
+ static constexpr SkFourByteTag ital = SkSetFourByteTag('i', 't', 'a', 'l');
26
+ static constexpr SkFourByteTag opsz = SkSetFourByteTag('o', 'p', 's', 'z');
22
27
  SkFourByteTag axis;
23
28
  float value;
24
29
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2018 Google Inc.
2
+ * Copyright 2018 Google LLC
3
3
  *
4
4
  * Use of this source code is governed by a BSD-style license that can be
5
5
  * found in the LICENSE file.
@@ -8,7 +8,9 @@
8
8
  #ifndef SkFontMgr_DEFINED
9
9
  #define SkFontMgr_DEFINED
10
10
 
11
+ #include "include/core/SkFontArguments.h"
11
12
  #include "include/core/SkRefCnt.h"
13
+ #include "include/core/SkSpan.h"
12
14
  #include "include/core/SkTypes.h"
13
15
 
14
16
  #include <memory>
@@ -18,7 +20,6 @@ class SkFontStyle;
18
20
  class SkStreamAsset;
19
21
  class SkString;
20
22
  class SkTypeface;
21
- struct SkFontArguments;
22
23
 
23
24
  class SK_API SkFontStyleSet : public SkRefCnt {
24
25
  public:
@@ -85,6 +86,38 @@ public:
85
86
  const char* bcp47[], int bcp47Count,
86
87
  SkUnichar character) const;
87
88
 
89
+ struct Request {
90
+ struct CMapEntry {
91
+ SkUnichar character;
92
+ SkUnichar variation; // Zero for default variation.
93
+ };
94
+ SkSpan<const CMapEntry> cmapEntries;
95
+
96
+ /**
97
+ * bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the most significant.
98
+ * If no specified bcp47 codes match any font with the requested character will be matched.
99
+ */
100
+ SkSpan<const char*> bcp47;
101
+
102
+ const char* familyName;
103
+
104
+ SkSpan<const SkFontArguments::VariationPosition::Coordinate> model;
105
+ SkFontStyle fontStyleFromModel() const;
106
+ static void SetModel(SkFontStyle s, SkFontArguments::VariationPosition::Coordinate(&m)[4]);
107
+
108
+ std::optional<bool> syntheticBold;
109
+ std::optional<bool> syntheticOblique;
110
+ };
111
+
112
+ /** The familyName must strongly match, everything else is tie breakers. */
113
+ sk_sp<SkTypeface> match(const Request&) const;
114
+
115
+ /**
116
+ * The first cmapEntry must match. Then matched by bcp47, then familyName,
117
+ * then model (italic, slant, width, weight), with synthetics allowed or not.
118
+ */
119
+ sk_sp<SkTypeface> fallback(const Request&) const;
120
+
88
121
  /**
89
122
  * Create a typeface for the specified data and TTC index (pass 0 for none)
90
123
  * or NULL if the data is not recognized. The caller must call unref() on
@@ -129,6 +162,8 @@ protected:
129
162
  const SkFontStyle&,
130
163
  const char* bcp47[], int bcp47Count,
131
164
  SkUnichar character) const = 0;
165
+ virtual sk_sp<SkTypeface> onMatch(const Request&) const; // TODO: pure virtual
166
+ virtual sk_sp<SkTypeface> onFallback(const Request&) const; // TODO: pure virtual
132
167
 
133
168
  virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const = 0;
134
169
  virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,