react-native-skia 3.0.0 → 3.0.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 (261) hide show
  1. package/Package.swift +14 -13
  2. package/android/CMakeLists.txt +13 -42
  3. package/android/build.gradle +55 -47
  4. package/android/cpp/jni/JniLoad.cpp +2 -4
  5. package/android/cpp/jni/include/JniSkiaView.h +123 -0
  6. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.cpp → RNSkAndroidCanvasProvider.cpp} +45 -100
  7. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.h → RNSkAndroidCanvasProvider.h} +24 -22
  8. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -83
  9. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +0 -8
  10. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +1 -2
  11. package/android/src/main/java/com/reactnative/skia/SkiaSurfaceView.java +1 -3
  12. package/android/src/main/java/com/reactnative/skia/SkiaTextureView.java +1 -17
  13. package/android/src/main/java/com/reactnative/skia/{SkiaBaseView.java → SkiaView.java} +78 -16
  14. package/android/src/main/java/com/reactnative/skia/SkiaViewManager.java +85 -0
  15. package/apple/MetalLayerColorSpace.mm +0 -4
  16. package/apple/RNSkApplePlatformContext.h +0 -14
  17. package/apple/RNSkApplePlatformContext.mm +2 -112
  18. package/apple/RNSkMetalCanvasProvider.h +14 -19
  19. package/apple/RNSkMetalCanvasProvider.mm +35 -68
  20. package/apple/SkiaView.h +20 -0
  21. package/apple/SkiaView.mm +210 -0
  22. package/cpp/api/JsiSkApi.h +2 -13
  23. package/cpp/api/JsiSkCanvas.h +4 -18
  24. package/cpp/api/JsiSkGraphiteContext.h +1 -5
  25. package/cpp/api/JsiSkGraphiteRecording.h +1 -5
  26. package/cpp/api/JsiSkImage.h +7 -41
  27. package/cpp/api/JsiSkImageFactory.h +0 -14
  28. package/cpp/api/JsiSkSurface.h +2 -16
  29. package/cpp/api/JsiSkSurfaceFactory.h +0 -8
  30. package/cpp/rnskia/RNDawnContext.h +6 -0
  31. package/cpp/rnskia/RNDawnInterop.cpp +0 -4
  32. package/cpp/rnskia/RNDawnUtils.h +0 -1
  33. package/cpp/rnskia/RNDawnWindowContext.cpp +10 -0
  34. package/cpp/rnskia/RNDawnWindowContext.h +4 -0
  35. package/cpp/rnskia/RNSkCanvasProvider.h +221 -0
  36. package/cpp/rnskia/RNSkGraphiteProducer.cpp +36 -14
  37. package/cpp/rnskia/RNSkGraphiteProducer.h +23 -8
  38. package/cpp/rnskia/RNSkGraphiteTarget.h +383 -0
  39. package/cpp/rnskia/RNSkJsiViewApi.h +9 -18
  40. package/cpp/rnskia/RNSkPlatformContext.h +9 -15
  41. package/cpp/rnskia/RNSkView.h +340 -245
  42. package/jestSetup.js +1 -3
  43. package/lib/commonjs/Platform/Platform.web.js +1 -1
  44. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  45. package/lib/commonjs/index.d.ts +1 -3
  46. package/lib/commonjs/index.js +3 -12
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/mock/index.js +0 -1
  49. package/lib/commonjs/mock/index.js.map +1 -1
  50. package/lib/commonjs/renderer/Canvas.d.ts +15 -12
  51. package/lib/commonjs/renderer/Canvas.js +24 -20
  52. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  53. package/lib/commonjs/skia/types/Graphite.d.ts +3 -3
  54. package/lib/commonjs/skia/types/Graphite.js.map +1 -1
  55. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +2 -2
  56. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  57. package/lib/commonjs/skia/types/Skia.d.ts +1 -2
  58. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  59. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  60. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  61. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +5 -4
  62. package/lib/commonjs/specs/NativeSkiaModule.web.js +5 -9
  63. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  64. package/lib/{typescript/src/specs/SkiaPictureViewNativeComponent.d.ts → commonjs/specs/SkiaViewNativeComponent.d.ts} +0 -3
  65. package/lib/commonjs/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  66. package/lib/commonjs/specs/SkiaViewNativeComponent.js.map +1 -0
  67. package/lib/commonjs/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  68. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js +27 -0
  69. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js.map +1 -0
  70. package/lib/commonjs/views/SkiaGraphiteView.d.ts +3 -4
  71. package/lib/commonjs/views/SkiaGraphiteView.js +23 -12
  72. package/lib/commonjs/views/SkiaGraphiteView.js.map +1 -1
  73. package/lib/commonjs/views/SkiaPictureView.d.ts +4 -1
  74. package/lib/commonjs/views/SkiaPictureView.js +12 -10
  75. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  76. package/lib/commonjs/views/SkiaView.web.d.ts +12 -0
  77. package/lib/commonjs/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +82 -38
  78. package/lib/commonjs/views/SkiaView.web.js.map +1 -0
  79. package/lib/commonjs/views/SkiaWebRenderer.js +1 -1
  80. package/lib/commonjs/views/SkiaWebRenderer.js.map +1 -1
  81. package/lib/commonjs/views/android.d.ts +6 -0
  82. package/lib/commonjs/views/android.js +17 -0
  83. package/lib/commonjs/views/android.js.map +1 -0
  84. package/lib/commonjs/views/types.d.ts +3 -12
  85. package/lib/commonjs/views/types.js.map +1 -1
  86. package/lib/module/Platform/Platform.web.js +1 -1
  87. package/lib/module/Platform/Platform.web.js.map +1 -1
  88. package/lib/module/index.d.ts +1 -3
  89. package/lib/module/index.js +1 -3
  90. package/lib/module/index.js.map +1 -1
  91. package/lib/module/mock/index.js +0 -1
  92. package/lib/module/mock/index.js.map +1 -1
  93. package/lib/module/renderer/Canvas.d.ts +15 -12
  94. package/lib/module/renderer/Canvas.js +24 -19
  95. package/lib/module/renderer/Canvas.js.map +1 -1
  96. package/lib/module/skia/types/Graphite.d.ts +3 -3
  97. package/lib/module/skia/types/Graphite.js.map +1 -1
  98. package/lib/module/skia/types/Image/ImageFactory.d.ts +2 -2
  99. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  100. package/lib/module/skia/types/Skia.d.ts +1 -2
  101. package/lib/module/skia/types/Skia.js.map +1 -1
  102. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  103. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  104. package/lib/module/specs/NativeSkiaModule.web.d.ts +5 -4
  105. package/lib/module/specs/NativeSkiaModule.web.js +5 -9
  106. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  107. package/lib/{commonjs/specs/SkiaPictureViewNativeComponent.d.ts → module/specs/SkiaViewNativeComponent.d.ts} +0 -3
  108. package/lib/module/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  109. package/lib/module/specs/SkiaViewNativeComponent.js.map +1 -0
  110. package/lib/module/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  111. package/lib/module/specs/SkiaViewNativeComponent.web.js +21 -0
  112. package/lib/module/specs/SkiaViewNativeComponent.web.js.map +1 -0
  113. package/lib/module/views/SkiaGraphiteView.d.ts +3 -4
  114. package/lib/module/views/SkiaGraphiteView.js +23 -12
  115. package/lib/module/views/SkiaGraphiteView.js.map +1 -1
  116. package/lib/module/views/SkiaPictureView.d.ts +4 -1
  117. package/lib/module/views/SkiaPictureView.js +12 -10
  118. package/lib/module/views/SkiaPictureView.js.map +1 -1
  119. package/lib/module/views/SkiaView.web.d.ts +12 -0
  120. package/lib/module/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +80 -36
  121. package/lib/module/views/SkiaView.web.js.map +1 -0
  122. package/lib/module/views/SkiaWebRenderer.js +1 -1
  123. package/lib/module/views/SkiaWebRenderer.js.map +1 -1
  124. package/lib/module/views/android.d.ts +6 -0
  125. package/lib/module/views/android.js +10 -0
  126. package/lib/module/views/android.js.map +1 -0
  127. package/lib/module/views/types.d.ts +3 -12
  128. package/lib/module/views/types.js.map +1 -1
  129. package/lib/typescript/src/index.d.ts +1 -3
  130. package/lib/typescript/src/renderer/Canvas.d.ts +15 -12
  131. package/lib/typescript/src/skia/types/Graphite.d.ts +3 -3
  132. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +2 -2
  133. package/lib/typescript/src/skia/types/Skia.d.ts +1 -2
  134. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  135. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +5 -4
  136. package/lib/{module/specs/SkiaPictureViewNativeComponent.d.ts → typescript/src/specs/SkiaViewNativeComponent.d.ts} +0 -3
  137. package/lib/typescript/src/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  138. package/lib/typescript/src/views/SkiaGraphiteView.d.ts +3 -4
  139. package/lib/typescript/src/views/SkiaPictureView.d.ts +4 -1
  140. package/lib/typescript/src/views/SkiaView.web.d.ts +12 -0
  141. package/lib/typescript/src/views/android.d.ts +6 -0
  142. package/lib/typescript/src/views/types.d.ts +3 -12
  143. package/package.json +8 -16
  144. package/react-native-skia.podspec +50 -57
  145. package/src/Platform/Platform.web.tsx +1 -1
  146. package/src/index.ts +1 -3
  147. package/src/mock/index.ts +0 -1
  148. package/src/renderer/Canvas.tsx +23 -27
  149. package/src/skia/types/Graphite.ts +3 -3
  150. package/src/skia/types/Image/ImageFactory.ts +2 -2
  151. package/src/skia/types/Skia.ts +1 -2
  152. package/src/skia/types/Surface/SurfaceFactory.ts +1 -1
  153. package/src/specs/NativeSkiaModule.web.ts +9 -21
  154. package/src/specs/{SkiaPictureViewNativeComponent.ts → SkiaViewNativeComponent.ts} +1 -4
  155. package/src/specs/{SkiaPictureViewNativeComponent.web.ts → SkiaViewNativeComponent.web.ts} +8 -10
  156. package/src/views/SkiaGraphiteView.tsx +27 -16
  157. package/src/views/SkiaPictureView.tsx +11 -10
  158. package/src/views/{SkiaGraphiteView.web.tsx → SkiaView.web.tsx} +100 -53
  159. package/src/views/SkiaWebRenderer.ts +1 -1
  160. package/src/views/android.ts +16 -0
  161. package/src/views/types.ts +3 -14
  162. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -92
  163. package/android/cpp/jni/include/JniSkiaGraphiteView.h +0 -176
  164. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -172
  165. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +0 -245
  166. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +0 -33
  167. package/android/cpp/rnskia-android/OpenGLContext.h +0 -248
  168. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -67
  169. package/android/cpp/rnskia-android/OpenGLWindowContext.h +0 -75
  170. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -67
  171. package/android/cpp/rnskia-android/gl/Context.h +0 -80
  172. package/android/cpp/rnskia-android/gl/Display.h +0 -123
  173. package/android/cpp/rnskia-android/gl/Error.cpp +0 -45
  174. package/android/cpp/rnskia-android/gl/Error.h +0 -8
  175. package/android/cpp/rnskia-android/gl/Surface.h +0 -43
  176. package/android/src/main/java/com/reactnative/skia/SkiaBaseViewManager.java +0 -65
  177. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteView.java +0 -78
  178. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteViewManager.java +0 -32
  179. package/android/src/main/java/com/reactnative/skia/SkiaPictureView.java +0 -105
  180. package/android/src/main/java/com/reactnative/skia/SkiaPictureViewManager.java +0 -44
  181. package/apple/MetalContext.h +0 -116
  182. package/apple/MetalContext.mm +0 -38
  183. package/apple/MetalWindowContext.h +0 -42
  184. package/apple/MetalWindowContext.mm +0 -95
  185. package/apple/RNSkAppleView.h +0 -49
  186. package/apple/RNSkAppleView.mm +0 -35
  187. package/apple/SkiaCVPixelBufferUtils.h +0 -122
  188. package/apple/SkiaCVPixelBufferUtils.mm +0 -535
  189. package/apple/SkiaGraphiteView.h +0 -26
  190. package/apple/SkiaGraphiteView.mm +0 -180
  191. package/apple/SkiaPictureView.h +0 -7
  192. package/apple/SkiaPictureView.mm +0 -70
  193. package/apple/SkiaUIView.h +0 -31
  194. package/apple/SkiaUIView.mm +0 -164
  195. package/cpp/rnskia/RNSkGraphiteView.h +0 -708
  196. package/cpp/rnskia/RNSkPictureView.cpp +0 -69
  197. package/cpp/rnskia/RNSkPictureView.h +0 -211
  198. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1162
  199. package/lib/commonjs/renderer/DefaultCanvas.d.ts +0 -8
  200. package/lib/commonjs/renderer/DefaultCanvas.js +0 -42
  201. package/lib/commonjs/renderer/DefaultCanvas.js.map +0 -1
  202. package/lib/commonjs/renderer/GraphiteCanvas.d.ts +0 -22
  203. package/lib/commonjs/renderer/GraphiteCanvas.js +0 -64
  204. package/lib/commonjs/renderer/GraphiteCanvas.js.map +0 -1
  205. package/lib/commonjs/renderer/GraphiteCanvas.web.d.ts +0 -1
  206. package/lib/commonjs/renderer/GraphiteCanvas.web.js +0 -13
  207. package/lib/commonjs/renderer/GraphiteCanvas.web.js.map +0 -1
  208. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  209. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js +0 -12
  210. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  211. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  212. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js +0 -28
  213. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  214. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  215. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  216. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +0 -29
  217. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  218. package/lib/commonjs/views/SkiaGraphiteView.web.d.ts +0 -14
  219. package/lib/commonjs/views/SkiaGraphiteView.web.js.map +0 -1
  220. package/lib/commonjs/views/SkiaPictureView.web.d.ts +0 -11
  221. package/lib/commonjs/views/SkiaPictureView.web.js +0 -165
  222. package/lib/commonjs/views/SkiaPictureView.web.js.map +0 -1
  223. package/lib/module/renderer/DefaultCanvas.d.ts +0 -8
  224. package/lib/module/renderer/DefaultCanvas.js +0 -34
  225. package/lib/module/renderer/DefaultCanvas.js.map +0 -1
  226. package/lib/module/renderer/GraphiteCanvas.d.ts +0 -22
  227. package/lib/module/renderer/GraphiteCanvas.js +0 -57
  228. package/lib/module/renderer/GraphiteCanvas.js.map +0 -1
  229. package/lib/module/renderer/GraphiteCanvas.web.d.ts +0 -1
  230. package/lib/module/renderer/GraphiteCanvas.web.js +0 -4
  231. package/lib/module/renderer/GraphiteCanvas.web.js.map +0 -1
  232. package/lib/module/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  233. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js +0 -8
  234. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  235. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  236. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js +0 -22
  237. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  238. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  239. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  240. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +0 -23
  241. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  242. package/lib/module/views/SkiaGraphiteView.web.d.ts +0 -14
  243. package/lib/module/views/SkiaGraphiteView.web.js.map +0 -1
  244. package/lib/module/views/SkiaPictureView.web.d.ts +0 -11
  245. package/lib/module/views/SkiaPictureView.web.js +0 -156
  246. package/lib/module/views/SkiaPictureView.web.js.map +0 -1
  247. package/lib/typescript/src/renderer/DefaultCanvas.d.ts +0 -8
  248. package/lib/typescript/src/renderer/GraphiteCanvas.d.ts +0 -22
  249. package/lib/typescript/src/renderer/GraphiteCanvas.web.d.ts +0 -1
  250. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  251. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  252. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  253. package/lib/typescript/src/views/SkiaGraphiteView.web.d.ts +0 -14
  254. package/lib/typescript/src/views/SkiaPictureView.web.d.ts +0 -11
  255. package/libs/.graphite +0 -1
  256. package/src/renderer/DefaultCanvas.tsx +0 -41
  257. package/src/renderer/GraphiteCanvas.tsx +0 -61
  258. package/src/renderer/GraphiteCanvas.web.tsx +0 -3
  259. package/src/specs/SkiaGraphiteViewNativeComponent.ts +0 -17
  260. package/src/specs/SkiaGraphiteViewNativeComponent.web.ts +0 -31
  261. package/src/views/SkiaPictureView.web.tsx +0 -224
@@ -1,535 +0,0 @@
1
- //
2
- // SkiaCVPixelBufferUtils.mm
3
- // react-native-skia
4
- //
5
- // Created by Marc Rousavy on 10.04.24.
6
- //
7
-
8
- #import "SkiaCVPixelBufferUtils.h"
9
-
10
- #pragma clang diagnostic push
11
- #pragma clang diagnostic ignored "-Wdocumentation"
12
-
13
- #import "include/core/SkCanvas.h"
14
- #import "include/core/SkColorSpace.h"
15
-
16
- #import <CoreVideo/CVImageBuffer.h>
17
- #import <CoreVideo/CVMetalTextureCache.h>
18
-
19
- #import <include/gpu/ganesh/GrBackendSurface.h>
20
- #import <include/gpu/ganesh/GrDirectContext.h>
21
- #import <include/gpu/ganesh/SkImageGanesh.h>
22
- #import <include/gpu/ganesh/SkSurfaceGanesh.h>
23
- #import <include/gpu/ganesh/mtl/GrMtlBackendContext.h>
24
- #import <include/gpu/ganesh/mtl/GrMtlBackendSurface.h>
25
- #import <include/gpu/ganesh/mtl/GrMtlDirectContext.h>
26
- #import <include/gpu/ganesh/mtl/SkSurfaceMetal.h>
27
-
28
- #pragma clang diagnostic pop
29
-
30
- #include <TargetConditionals.h>
31
- #include <cmath>
32
- #if TARGET_RT_BIG_ENDIAN
33
- #define FourCC2Str(fourcc) \
34
- (const char[]){*((char *)&fourcc), *(((char *)&fourcc) + 1), \
35
- *(((char *)&fourcc) + 2), *(((char *)&fourcc) + 3), 0}
36
- #else
37
- #define FourCC2Str(fourcc) \
38
- (const char[]){*(((char *)&fourcc) + 3), *(((char *)&fourcc) + 2), \
39
- *(((char *)&fourcc) + 1), *(((char *)&fourcc) + 0), 0}
40
- #endif
41
-
42
- // pragma MARK: TextureHolder
43
-
44
- TextureHolder::TextureHolder(CVMetalTextureRef texture) : _texture(texture) {}
45
- TextureHolder::~TextureHolder() {
46
- // ARC will now automatically release _texture.
47
- CFRelease(_texture);
48
- }
49
-
50
- GrBackendTexture TextureHolder::toGrBackendTexture() {
51
- // Unwrap the underlying MTLTexture
52
- id<MTLTexture> mtlTexture = CVMetalTextureGetTexture(_texture);
53
- if (mtlTexture == nil) [[unlikely]] {
54
- throw std::runtime_error(
55
- "Failed to get MTLTexture from CVMetalTextureRef!");
56
- }
57
-
58
- // Wrap MTLTexture in Skia's GrBackendTexture
59
- GrMtlTextureInfo textureInfo;
60
- textureInfo.fTexture.retain((__bridge void *)mtlTexture);
61
- GrBackendTexture texture =
62
- GrBackendTextures::MakeMtl((int)mtlTexture.width, (int)mtlTexture.height,
63
- skgpu::Mipmapped::kNo, textureInfo);
64
- return texture;
65
- }
66
-
67
- MultiTexturesHolder::~MultiTexturesHolder() {
68
- for (TextureHolder *texture : _textures) {
69
- delete texture;
70
- }
71
- }
72
-
73
- void MultiTexturesHolder::addTexture(TextureHolder *texture) {
74
- _textures.push_back(texture);
75
- }
76
-
77
- // pragma MARK: Base
78
-
79
- SkiaCVPixelBufferUtils::CVPixelBufferBaseFormat
80
- SkiaCVPixelBufferUtils::getCVPixelBufferBaseFormat(
81
- CVPixelBufferRef pixelBuffer) {
82
- OSType format = CVPixelBufferGetPixelFormatType(pixelBuffer);
83
-
84
- switch (format) {
85
- // 8-bit YUV formats
86
- case kCVPixelFormatType_420YpCbCr8Planar:
87
- case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
88
- case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
89
- case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
90
- case kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange:
91
- case kCVPixelFormatType_422YpCbCr8BiPlanarFullRange:
92
- case kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange:
93
- case kCVPixelFormatType_444YpCbCr8BiPlanarFullRange:
94
- // 10-bit YUV formats
95
- case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
96
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
97
- case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
98
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
99
- case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
100
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
101
- return CVPixelBufferBaseFormat::yuv;
102
- case kCVPixelFormatType_24RGB:
103
- case kCVPixelFormatType_24BGR:
104
- case kCVPixelFormatType_32ARGB:
105
- case kCVPixelFormatType_32BGRA:
106
- case kCVPixelFormatType_32ABGR:
107
- case kCVPixelFormatType_32RGBA:
108
- // 16-bit half-float RGBA
109
- case kCVPixelFormatType_64RGBAHalf:
110
- return CVPixelBufferBaseFormat::rgb;
111
- default:
112
- [[unlikely]] throw std::runtime_error(
113
- "CVPixelBuffer has unknown pixel format! " +
114
- std::string("Expected: any RGB or YUV format, Received: ") +
115
- std::string(FourCC2Str(format)));
116
- }
117
- }
118
-
119
- // pragma MARK: RGB
120
-
121
- SkColorType SkiaCVPixelBufferUtils::RGB::getCVPixelBufferColorType(
122
- CVPixelBufferRef pixelBuffer) {
123
- OSType format = CVPixelBufferGetPixelFormatType(pixelBuffer);
124
-
125
- switch (format) {
126
- case kCVPixelFormatType_32BGRA:
127
- [[likely]] return kBGRA_8888_SkColorType;
128
- case kCVPixelFormatType_32RGBA:
129
- return kRGBA_8888_SkColorType;
130
- case kCVPixelFormatType_64RGBAHalf:
131
- return kRGBA_F16_SkColorType;
132
- // This can be extended with branches for specific RGB formats if Apple
133
- // uses new formats.
134
- default:
135
- [[unlikely]] throw std::runtime_error(
136
- "CVPixelBuffer has unknown RGB format! " +
137
- std::string(FourCC2Str(format)));
138
- }
139
- }
140
-
141
- sk_sp<SkImage> SkiaCVPixelBufferUtils::RGB::makeSkImageFromCVPixelBuffer(
142
- id<MTLDevice> device, GrDirectContext *context,
143
- CVPixelBufferRef pixelBuffer) {
144
- // 1. Get Skia color type for RGB buffer
145
- SkColorType colorType = getCVPixelBufferColorType(pixelBuffer);
146
-
147
- // 2. Get texture, RGB buffers only have one plane
148
- TextureHolder *texture = getSkiaTextureForCVPixelBufferPlane(
149
- device, pixelBuffer, /* planeIndex */ 0);
150
-
151
- // 3. Convert to image with manual memory cleanup
152
- return SkImages::BorrowTextureFrom(
153
- context, texture->toGrBackendTexture(), kTopLeft_GrSurfaceOrigin,
154
- colorType, kOpaque_SkAlphaType, nullptr,
155
- [](void *texture) { delete (TextureHolder *)texture; }, (void *)texture);
156
- }
157
-
158
- // pragma MARK: YUV
159
-
160
- sk_sp<SkImage> SkiaCVPixelBufferUtils::YUV::makeSkImageFromCVPixelBuffer(
161
- id<MTLDevice> device, GrDirectContext *context,
162
- CVPixelBufferRef pixelBuffer) {
163
- // 1. Get all planes (YUV, Y_UV, Y_U_V or Y_U_V_A)
164
- const size_t planesCount = CVPixelBufferGetPlaneCount(pixelBuffer);
165
- if (planesCount > SkYUVAInfo::kMaxPlanes) [[unlikely]] {
166
- throw std::runtime_error(
167
- "CVPixelBuffer has " + std::to_string(planesCount) +
168
- " textures, but the platform only supports a maximum of " +
169
- std::to_string(SkYUVAInfo::kMaxPlanes) + " textures!");
170
- }
171
- MultiTexturesHolder *texturesHolder = new MultiTexturesHolder();
172
- GrBackendTexture textures[SkYUVAInfo::kMaxPlanes];
173
-
174
- for (size_t planeIndex = 0; planeIndex < planesCount; planeIndex++) {
175
- TextureHolder *textureHolder =
176
- getSkiaTextureForCVPixelBufferPlane(device, pixelBuffer, planeIndex);
177
- textures[planeIndex] = textureHolder->toGrBackendTexture();
178
- texturesHolder->addTexture(textureHolder);
179
- }
180
-
181
- // 2. Wrap info about buffer
182
- SkYUVAInfo info = getYUVAInfoForCVPixelBuffer(pixelBuffer);
183
-
184
- // 3. Wrap as YUVA textures type
185
- GrYUVABackendTextures yuvaTextures(info, textures, kTopLeft_GrSurfaceOrigin);
186
-
187
- // 4. Wrap into SkImage type with manualy memory cleanup
188
- return SkImages::TextureFromYUVATextures(
189
- context, yuvaTextures, nullptr,
190
- [](void *textureHolders) {
191
- delete (MultiTexturesHolder *)textureHolders;
192
- },
193
- (void *)texturesHolder);
194
- }
195
-
196
- SkYUVAInfo SkiaCVPixelBufferUtils::YUV::getYUVAInfoForCVPixelBuffer(
197
- CVPixelBufferRef pixelBuffer) {
198
- size_t width = CVPixelBufferGetWidth(pixelBuffer);
199
- size_t height = CVPixelBufferGetHeight(pixelBuffer);
200
- SkISize size =
201
- SkISize::Make(static_cast<int>(width), static_cast<int>(height));
202
-
203
- OSType format = CVPixelBufferGetPixelFormatType(pixelBuffer);
204
- SkYUVAInfo::PlaneConfig planeConfig = getPlaneConfig(format);
205
- SkYUVAInfo::Subsampling subsampling = getSubsampling(format);
206
- SkYUVColorSpace colorspace = getColorspace(pixelBuffer);
207
-
208
- return SkYUVAInfo(size, planeConfig, subsampling, colorspace);
209
- }
210
-
211
- // pragma MARK: YUV getPlaneConfig()
212
-
213
- SkYUVAInfo::PlaneConfig
214
- SkiaCVPixelBufferUtils::YUV::getPlaneConfig(OSType pixelFormat) {
215
- switch (pixelFormat) {
216
- case kCVPixelFormatType_420YpCbCr8Planar:
217
- case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
218
- return SkYUVAInfo::PlaneConfig::kY_U_V;
219
- case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
220
- case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
221
- case kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange:
222
- case kCVPixelFormatType_422YpCbCr8BiPlanarFullRange:
223
- case kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange:
224
- case kCVPixelFormatType_444YpCbCr8BiPlanarFullRange:
225
- case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
226
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
227
- case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
228
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
229
- case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
230
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
231
- [[likely]] return SkYUVAInfo::PlaneConfig::kY_UV;
232
-
233
- // This can be extended with branches for specific YUV formats if Apple
234
- // uses new formats.
235
- default:
236
- [[unlikely]] throw std::runtime_error("Invalid pixel format! " +
237
- std::string(FourCC2Str(pixelFormat)));
238
- }
239
- }
240
-
241
- // pragma MARK: YUV getSubsampling()
242
-
243
- SkYUVAInfo::Subsampling
244
- SkiaCVPixelBufferUtils::YUV::getSubsampling(OSType pixelFormat) {
245
- switch (pixelFormat) {
246
- case kCVPixelFormatType_420YpCbCr8Planar:
247
- case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
248
- case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
249
- case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
250
- case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
251
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
252
- [[likely]] return SkYUVAInfo::Subsampling::k420;
253
- case kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange:
254
- case kCVPixelFormatType_422YpCbCr8BiPlanarFullRange:
255
- case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
256
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
257
- return SkYUVAInfo::Subsampling::k422;
258
- case kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange:
259
- case kCVPixelFormatType_444YpCbCr8BiPlanarFullRange:
260
- case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
261
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
262
- return SkYUVAInfo::Subsampling::k444;
263
- // This can be extended with branches for specific YUV formats if Apple
264
- // uses new formats.
265
- default:
266
- [[unlikely]] throw std::runtime_error("Invalid pixel format! " +
267
- std::string(FourCC2Str(pixelFormat)));
268
- }
269
- }
270
-
271
- // pragma MARK: YUV getColorspace()
272
-
273
- SkYUVColorSpace
274
- SkiaCVPixelBufferUtils::YUV::getColorspace(CVPixelBufferRef pixelBuffer) {
275
- const OSType pixelFormat = CVPixelBufferGetPixelFormatType(pixelBuffer);
276
-
277
- CFTypeRef matrixAttachment = CVBufferCopyAttachment(
278
- pixelBuffer, kCVImageBufferYCbCrMatrixKey, nullptr);
279
- CFStringRef matrix = nullptr;
280
- if (matrixAttachment != nullptr &&
281
- CFGetTypeID(matrixAttachment) == CFStringGetTypeID()) {
282
- matrix = reinterpret_cast<CFStringRef>(matrixAttachment);
283
- }
284
-
285
- SkYUVColorSpace colorspace =
286
- getSkYUVColorSpaceFromMatrix(matrix, pixelFormat);
287
- if (matrixAttachment != nullptr) {
288
- CFRelease(matrixAttachment);
289
- }
290
- return colorspace;
291
- }
292
-
293
- // pragma MARK: YUV helpers
294
-
295
- bool SkiaCVPixelBufferUtils::YUV::isFullRangeYUVFormat(OSType pixelFormat) {
296
- switch (pixelFormat) {
297
- case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
298
- case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
299
- case kCVPixelFormatType_422YpCbCr8BiPlanarFullRange:
300
- case kCVPixelFormatType_444YpCbCr8BiPlanarFullRange:
301
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
302
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
303
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
304
- return true;
305
- default:
306
- return false;
307
- }
308
- }
309
-
310
- bool SkiaCVPixelBufferUtils::YUV::isTenBitYUVFormat(OSType pixelFormat) {
311
- switch (pixelFormat) {
312
- case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
313
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
314
- case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
315
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
316
- case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
317
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
318
- return true;
319
- default:
320
- return false;
321
- }
322
- }
323
-
324
- SkYUVColorSpace
325
- SkiaCVPixelBufferUtils::YUV::getSkYUVColorSpaceFromMatrix(CFStringRef matrix,
326
- OSType pixelFormat) {
327
- const bool isFullRange = isFullRangeYUVFormat(pixelFormat);
328
- const bool isTenBit = isTenBitYUVFormat(pixelFormat);
329
-
330
- if (matrix != nullptr) {
331
- if (CFEqual(matrix, kCVImageBufferYCbCrMatrix_ITU_R_2020)) {
332
- if (isTenBit) {
333
- return isFullRange ? kBT2020_10bit_Full_SkYUVColorSpace
334
- : kBT2020_10bit_Limited_SkYUVColorSpace;
335
- }
336
- return isFullRange ? kBT2020_8bit_Full_SkYUVColorSpace
337
- : kBT2020_8bit_Limited_SkYUVColorSpace;
338
- }
339
- if (CFEqual(matrix, kCVImageBufferYCbCrMatrix_ITU_R_601_4)) {
340
- return isFullRange ? kJPEG_Full_SkYUVColorSpace
341
- : kRec601_Limited_SkYUVColorSpace;
342
- }
343
- if (CFEqual(matrix, kCVImageBufferYCbCrMatrix_SMPTE_240M_1995)) {
344
- return isFullRange ? kSMPTE240_Full_SkYUVColorSpace
345
- : kSMPTE240_Limited_SkYUVColorSpace;
346
- }
347
- if (CFEqual(matrix, kCVImageBufferYCbCrMatrix_ITU_R_709_2)) {
348
- return isFullRange ? kRec709_Full_SkYUVColorSpace
349
- : kRec709_Limited_SkYUVColorSpace;
350
- }
351
- }
352
-
353
- if (pixelFormat == kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange ||
354
- pixelFormat == kCVPixelFormatType_422YpCbCr8BiPlanarFullRange) {
355
- return isFullRange ? kJPEG_Full_SkYUVColorSpace
356
- : kRec601_Limited_SkYUVColorSpace;
357
- }
358
-
359
- // Fallback for buffers that don't provide matrix metadata.
360
- if (isTenBit) {
361
- return isFullRange ? kBT2020_10bit_Full_SkYUVColorSpace
362
- : kBT2020_10bit_Limited_SkYUVColorSpace;
363
- }
364
- return isFullRange ? kRec709_Full_SkYUVColorSpace
365
- : kRec709_Limited_SkYUVColorSpace;
366
- }
367
-
368
- // pragma MARK: CVPixelBuffer -> Skia Texture
369
-
370
- TextureHolder *SkiaCVPixelBufferUtils::getSkiaTextureForCVPixelBufferPlane(
371
- id<MTLDevice> device, CVPixelBufferRef pixelBuffer, size_t planeIndex) {
372
- // 1. Get cache
373
- CVMetalTextureCacheRef textureCache = getTextureCache(device);
374
-
375
- // 2. Get MetalTexture from CVPixelBuffer
376
- const size_t planesCount = CVPixelBufferGetPlaneCount(pixelBuffer);
377
- if (planesCount == 0 && planeIndex != 0) [[unlikely]] {
378
- throw std::runtime_error("Pixel buffer is not planar, but plane index " +
379
- std::to_string(planeIndex) + " was requested.");
380
- }
381
- if (planesCount > 0 && planeIndex >= planesCount) [[unlikely]] {
382
- throw std::runtime_error(
383
- "Requested out-of-bounds plane index " + std::to_string(planeIndex) +
384
- " for pixel buffer with " + std::to_string(planesCount) + " planes.");
385
- }
386
- size_t width = planesCount > 0
387
- ? CVPixelBufferGetWidthOfPlane(pixelBuffer, planeIndex)
388
- : CVPixelBufferGetWidth(pixelBuffer);
389
- size_t height = planesCount > 0
390
- ? CVPixelBufferGetHeightOfPlane(pixelBuffer, planeIndex)
391
- : CVPixelBufferGetHeight(pixelBuffer);
392
- MTLPixelFormat pixelFormat =
393
- getMTLPixelFormatForCVPixelBufferPlane(pixelBuffer, planeIndex);
394
-
395
- CVMetalTextureRef textureHolder;
396
- CVReturn result = CVMetalTextureCacheCreateTextureFromImage(
397
- kCFAllocatorDefault, textureCache, pixelBuffer, nil, pixelFormat, width,
398
- height, planeIndex, &textureHolder);
399
-
400
- if (result != kCVReturnSuccess) [[unlikely]] {
401
- throw std::runtime_error(
402
- "Failed to create Metal Texture from CVPixelBuffer! Result: " +
403
- std::to_string(result));
404
- }
405
-
406
- return new TextureHolder(textureHolder);
407
- }
408
-
409
- // pragma MARK: getTextureCache()
410
-
411
- CVMetalTextureCacheRef
412
- SkiaCVPixelBufferUtils::getTextureCache(id<MTLDevice> device) {
413
- static CVMetalTextureCacheRef textureCache = nil;
414
- if (textureCache == nil) {
415
- // Create a new Texture Cache
416
- auto result = CVMetalTextureCacheCreate(kCFAllocatorDefault, nil, device,
417
- nil, &textureCache);
418
- if (result != kCVReturnSuccess || textureCache == nil) {
419
- throw std::runtime_error("Failed to create Metal Texture Cache!");
420
- }
421
- }
422
- return textureCache;
423
- }
424
-
425
- // pragma MARK: Get CVPixelBuffer MTLPixelFormat
426
-
427
- MTLPixelFormat SkiaCVPixelBufferUtils::getMTLPixelFormatForCVPixelBufferPlane(
428
- CVPixelBufferRef pixelBuffer, size_t planeIndex) {
429
- const OSType format = CVPixelBufferGetPixelFormatType(pixelBuffer);
430
- auto throwInvalidPlaneIndexForFormat =
431
- [&](size_t expectedPlanes) -> MTLPixelFormat {
432
- throw std::runtime_error(
433
- "Invalid plane index " + std::to_string(planeIndex) +
434
- " for pixel format " + std::string(FourCC2Str(format)) +
435
- " (expected 0.." + std::to_string(expectedPlanes - 1) + ").");
436
- };
437
-
438
- switch (format) {
439
- case kCVPixelFormatType_32BGRA:
440
- // 1 plane, 8-bit interleaved BGRA.
441
- if (planeIndex != 0) {
442
- return throwInvalidPlaneIndexForFormat(1);
443
- }
444
- return MTLPixelFormatBGRA8Unorm;
445
- case kCVPixelFormatType_32RGBA:
446
- // 1 plane, 8-bit interleaved RGBA.
447
- if (planeIndex != 0) {
448
- return throwInvalidPlaneIndexForFormat(1);
449
- }
450
- return MTLPixelFormatRGBA8Unorm;
451
- case kCVPixelFormatType_64RGBAHalf:
452
- // 1 plane, 16-bit half-float interleaved RGBA.
453
- if (planeIndex != 0) {
454
- return throwInvalidPlaneIndexForFormat(1);
455
- }
456
- return MTLPixelFormatRGBA16Float;
457
- case kCVPixelFormatType_420YpCbCr8Planar:
458
- case kCVPixelFormatType_420YpCbCr8PlanarFullRange:
459
- // 3 planes, 8-bit 4:2:0 planar (Y, U, V), each plane is single channel.
460
- switch (planeIndex) {
461
- case 0:
462
- case 1:
463
- case 2:
464
- return MTLPixelFormatR8Unorm;
465
- default:
466
- return throwInvalidPlaneIndexForFormat(3);
467
- }
468
- case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
469
- case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
470
- case kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange:
471
- case kCVPixelFormatType_422YpCbCr8BiPlanarFullRange:
472
- case kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange:
473
- case kCVPixelFormatType_444YpCbCr8BiPlanarFullRange:
474
- // 2 planes, 8-bit bi-planar (plane 0 = Y, plane 1 = interleaved CbCr).
475
- switch (planeIndex) {
476
- case 0:
477
- return MTLPixelFormatR8Unorm;
478
- case 1:
479
- return MTLPixelFormatRG8Unorm;
480
- default:
481
- return throwInvalidPlaneIndexForFormat(2);
482
- }
483
- case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
484
- case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange:
485
- case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
486
- case kCVPixelFormatType_422YpCbCr10BiPlanarFullRange:
487
- case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
488
- case kCVPixelFormatType_444YpCbCr10BiPlanarFullRange:
489
- // 2 planes, 10-bit bi-planar stored in 16-bit lanes (Y + interleaved CbCr).
490
- switch (planeIndex) {
491
- case 0:
492
- return MTLPixelFormatR16Unorm;
493
- case 1:
494
- return MTLPixelFormatRG16Unorm;
495
- default:
496
- return throwInvalidPlaneIndexForFormat(2);
497
- }
498
- default:
499
- break;
500
- }
501
-
502
- const size_t planesCount = CVPixelBufferGetPlaneCount(pixelBuffer);
503
- const size_t width =
504
- planesCount > 0 ? CVPixelBufferGetWidthOfPlane(pixelBuffer, planeIndex)
505
- : CVPixelBufferGetWidth(pixelBuffer);
506
- const size_t bytesPerRow =
507
- planesCount > 0
508
- ? CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, planeIndex)
509
- : CVPixelBufferGetBytesPerRow(pixelBuffer);
510
- if (width == 0) [[unlikely]] {
511
- throw std::runtime_error("Invalid plane width for pixel format " +
512
- std::string(FourCC2Str(format)) + "!");
513
- }
514
- if (bytesPerRow % width != 0) [[unlikely]] {
515
- throw std::runtime_error("Invalid bytes per row! Bytes per row must be "
516
- "evenly divisible by width "
517
- "for pixel format " +
518
- std::string(FourCC2Str(format)) + "!");
519
- }
520
- const size_t bytesPerPixel = bytesPerRow / width;
521
- if (bytesPerPixel == 1) {
522
- return MTLPixelFormatR8Unorm;
523
- }
524
- if (bytesPerPixel == 2) {
525
- return MTLPixelFormatRG8Unorm;
526
- }
527
- if (bytesPerPixel == 4) {
528
- return MTLPixelFormatBGRA8Unorm;
529
- }
530
-
531
- [[unlikely]] throw std::runtime_error(
532
- "Invalid bytes per row! Expected 1 (R), 2 (RG) or 4 (RGBA), but "
533
- "received " +
534
- std::to_string(bytesPerPixel));
535
- }
@@ -1,26 +0,0 @@
1
- #pragma once
2
-
3
- #if defined(SK_GRAPHITE)
4
-
5
- #import "SkiaUIView.h"
6
-
7
- /**
8
- * A Fabric component presenting Graphite recordings: JS records frames
9
- * through the context returned by SkiaViewApi.makeGraphiteContext, the view
10
- * replays them on its display link.
11
- */
12
- @interface SkiaGraphiteView : SkiaUIView
13
-
14
- @end
15
-
16
- #else
17
-
18
- #import <React/RCTViewComponentView.h>
19
-
20
- // Placeholder for builds without the Graphite backend: the component exists
21
- // so that the app links, but it renders nothing.
22
- @interface SkiaGraphiteView : RCTViewComponentView
23
-
24
- @end
25
-
26
- #endif // SK_GRAPHITE