@shopify/react-native-skia 0.1.197 → 0.1.199

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 (187) hide show
  1. package/android/CMakeLists.txt +32 -31
  2. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
  4. package/cpp/api/JsiSkShaderFactory.h +4 -4
  5. package/cpp/api/JsiSkSurfaceFactory.h +2 -1
  6. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
  7. package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
  8. package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
  9. package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
  10. package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
  11. package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
  12. package/cpp/skia/include/codec/SkCodec.h +25 -1
  13. package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
  14. package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
  15. package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
  16. package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
  17. package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
  18. package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
  19. package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
  20. package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
  21. package/cpp/skia/include/core/SkBBHFactory.h +5 -1
  22. package/cpp/skia/include/core/SkBlender.h +0 -2
  23. package/cpp/skia/include/core/SkCanvas.h +4 -23
  24. package/cpp/skia/include/core/SkColorFilter.h +14 -1
  25. package/cpp/skia/include/core/SkColorTable.h +59 -0
  26. package/cpp/skia/include/core/SkContourMeasure.h +3 -0
  27. package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
  28. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
  29. package/cpp/skia/include/core/SkDrawable.h +5 -2
  30. package/cpp/skia/include/core/SkGraphics.h +7 -19
  31. package/cpp/skia/include/core/SkImage.h +157 -249
  32. package/cpp/skia/include/core/SkImageGenerator.h +0 -31
  33. package/cpp/skia/include/core/SkMilestone.h +1 -1
  34. package/cpp/skia/include/core/SkPathMeasure.h +3 -3
  35. package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
  36. package/cpp/skia/include/core/SkPoint.h +5 -563
  37. package/cpp/skia/include/core/SkPoint3.h +1 -0
  38. package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
  39. package/cpp/skia/include/core/SkRect.h +8 -8
  40. package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
  41. package/cpp/skia/include/core/SkScalar.h +1 -1
  42. package/cpp/skia/include/core/SkSerialProcs.h +5 -1
  43. package/cpp/skia/include/core/SkShader.h +14 -21
  44. package/cpp/skia/include/core/SkString.h +2 -0
  45. package/cpp/skia/include/core/SkSurface.h +169 -701
  46. package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
  47. package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
  48. package/cpp/skia/include/core/SkTypes.h +4 -2
  49. package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
  50. package/cpp/skia/include/effects/SkGradientShader.h +10 -1
  51. package/cpp/skia/include/effects/SkImageFilters.h +62 -37
  52. package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
  53. package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
  54. package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
  55. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
  56. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
  57. package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
  58. package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
  59. package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
  60. package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
  61. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
  62. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
  63. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
  64. package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
  65. package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
  66. package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
  67. package/cpp/skia/include/gpu/graphite/Image.h +277 -0
  68. package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
  69. package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
  70. package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
  71. package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
  72. package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
  73. package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
  74. package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
  75. package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
  76. package/cpp/skia/include/private/SkGainmapShader.h +1 -0
  77. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
  78. package/cpp/skia/include/private/SkPathRef.h +13 -15
  79. package/cpp/skia/include/private/SkXmp.h +53 -0
  80. package/cpp/skia/include/private/base/SkFeatures.h +0 -4
  81. package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
  82. package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
  83. package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
  84. package/cpp/skia/include/private/base/SkTArray.h +11 -11
  85. package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
  86. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
  87. package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
  88. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
  89. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
  90. package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
  91. package/cpp/skia/include/private/chromium/Slug.h +7 -3
  92. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
  93. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
  94. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
  95. package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
  96. package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
  97. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  98. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
  99. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
  100. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
  101. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
  102. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
  103. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
  104. package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
  105. package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
  106. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
  107. package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
  108. package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
  109. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  110. package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
  111. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  112. package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
  113. package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
  114. package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
  115. package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
  116. package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
  117. package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
  118. package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
  119. package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
  120. package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
  121. package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
  122. package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
  123. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  124. package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
  125. package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
  126. package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
  127. package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
  128. package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
  129. package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
  130. package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
  131. package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
  132. package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
  133. package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
  134. package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
  135. package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
  136. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  137. package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
  138. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  139. package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
  140. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  141. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
  142. package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
  143. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
  144. package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
  145. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  146. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
  147. package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
  148. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  149. package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
  150. package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
  151. package/cpp/skia/src/core/SkTHash.h +1 -1
  152. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  153. package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
  154. package/libs/android/arm64-v8a/libskia.a +0 -0
  155. package/libs/android/arm64-v8a/libskottie.a +0 -0
  156. package/libs/android/arm64-v8a/libsksg.a +0 -0
  157. package/libs/android/arm64-v8a/libsvg.a +0 -0
  158. package/libs/android/armeabi-v7a/libskia.a +0 -0
  159. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  160. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  161. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  162. package/libs/android/x86/libskia.a +0 -0
  163. package/libs/android/x86/libskottie.a +0 -0
  164. package/libs/android/x86/libsksg.a +0 -0
  165. package/libs/android/x86/libsvg.a +0 -0
  166. package/libs/android/x86_64/libskia.a +0 -0
  167. package/libs/android/x86_64/libskottie.a +0 -0
  168. package/libs/android/x86_64/libsksg.a +0 -0
  169. package/libs/android/x86_64/libsvg.a +0 -0
  170. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  171. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  172. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  173. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  174. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  175. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  176. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  177. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  178. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  179. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  180. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  181. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  182. package/package.json +3 -4
  183. package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
  184. package/cpp/skia/include/private/SkOpts_spi.h +0 -23
  185. package/cpp/skia/include/private/SkSpinlock.h +0 -57
  186. package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
  187. package/scripts/install-npm.js +0 -33
@@ -47,21 +47,21 @@ add_library(
47
47
  "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp"
48
48
  "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/SkiaOpenGLRenderer.cpp"
49
49
 
50
- "${PROJECT_SOURCE_DIR}/cpp/jsi/JsiHostObject.cpp"
51
- "${PROJECT_SOURCE_DIR}/cpp/jsi/JsiValue.cpp"
52
- "${PROJECT_SOURCE_DIR}/cpp/jsi/RuntimeLifecycleMonitor.cpp"
53
- "${PROJECT_SOURCE_DIR}/cpp/jsi/RuntimeAwareCache.cpp"
54
- "${PROJECT_SOURCE_DIR}/cpp/jsi/JsiPromises.cpp"
50
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiHostObject.cpp"
51
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiValue.cpp"
52
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeLifecycleMonitor.cpp"
53
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeAwareCache.cpp"
54
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiPromises.cpp"
55
55
 
56
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/RNSkManager.cpp"
57
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/RNSkJsView.cpp"
58
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/RNSkDomView.cpp"
59
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/RNSkDispatchQueue.cpp"
56
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkManager.cpp"
57
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkJsView.cpp"
58
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDomView.cpp"
59
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDispatchQueue.cpp"
60
60
 
61
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/dom/base/DrawingContext.cpp"
62
- "${PROJECT_SOURCE_DIR}/cpp/rnskia/dom/base/ConcatablePaint.cpp"
61
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/dom/base/DrawingContext.cpp"
62
+ "${PROJECT_SOURCE_DIR}/../cpp/rnskia/dom/base/ConcatablePaint.cpp"
63
63
 
64
- "${PROJECT_SOURCE_DIR}/cpp/api/third_party/CSSColorParser.cpp"
64
+ "${PROJECT_SOURCE_DIR}/../cpp/api/third_party/CSSColorParser.cpp"
65
65
 
66
66
  )
67
67
 
@@ -75,27 +75,28 @@ target_include_directories(
75
75
  "${NODE_MODULES_DIR}/react-native/ReactCommon/react/nativemodule/core"
76
76
  "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
77
77
 
78
- cpp/skia/include/config/
79
- cpp/skia/include/core/
80
- cpp/skia/include/effects/
81
- cpp/skia/include/utils/
82
- cpp/skia/include/pathops/
83
- cpp/skia/modules/
84
- #cpp/skia/modules/skparagraph/include/
85
- cpp/skia/include/
86
- cpp/skia
87
-
88
- cpp/api
89
- cpp/jsi
90
78
  cpp/jni/include
91
79
  cpp/rnskia-android
92
- cpp/rnskia
93
- cpp/rnskia/values
94
- cpp/rnskia/dom
95
- cpp/rnskia/dom/base
96
- cpp/rnskia/dom/nodes
97
- cpp/rnskia/dom/props
98
- cpp/utils
80
+
81
+ ../cpp/skia/include/config/
82
+ ../cpp/skia/include/core/
83
+ ../cpp/skia/include/effects/
84
+ ../cpp/skia/include/utils/
85
+ ../cpp/skia/include/pathops/
86
+ ../cpp/skia/modules/
87
+ #cpp/skia/modules/skparagraph/include/
88
+ ../cpp/skia/include/
89
+ ../cpp/skia
90
+
91
+ ../cpp/api
92
+ ../cpp/jsi
93
+ ../cpp/rnskia
94
+ ../cpp/rnskia/values
95
+ ../cpp/rnskia/dom
96
+ ../cpp/rnskia/dom/base
97
+ ../cpp/rnskia/dom/nodes
98
+ ../cpp/rnskia/dom/props
99
+ ../cpp/utils
99
100
 
100
101
  ${libfbjni_include_DIRS}
101
102
  )
@@ -4,6 +4,8 @@
4
4
  #include <android/native_window.h>
5
5
  #include <android/native_window_jni.h>
6
6
 
7
+ #pragma clang diagnostic push
8
+
7
9
  #define STENCIL_BUFFER_SIZE 8
8
10
 
9
11
  namespace RNSkia {
@@ -102,7 +104,7 @@ sk_sp<SkSurface> MakeOffscreenGLSurface(int width, int height) {
102
104
  };
103
105
  auto ctx = new OffscreenRenderContext({eglDisplay, eglSurface});
104
106
 
105
- auto surface = SkSurface::MakeFromBackendRenderTarget(
107
+ auto surface = SkSurfaces::WrapBackendRenderTarget(
106
108
  grContext.get(), renderTarget, kBottomLeft_GrSurfaceOrigin,
107
109
  kRGBA_8888_SkColorType, nullptr, nullptr,
108
110
  [](void *addr) {
@@ -170,7 +172,7 @@ bool SkiaOpenGLRenderer::run(const std::function<void(SkCanvas *)> &cb,
170
172
 
171
173
  SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
172
174
 
173
- sk_sp<SkSurface> renderTarget(SkSurface::MakeFromBackendRenderTarget(
175
+ sk_sp<SkSurface> renderTarget(SkSurfaces::WrapBackendRenderTarget(
174
176
  getThreadDrawingContext()->skContext.get(), backendRT,
175
177
  kBottomLeft_GrSurfaceOrigin, colorType, nullptr, &props));
176
178
 
@@ -20,7 +20,10 @@
20
20
  #include "SkColorSpace.h"
21
21
  #include "SkPicture.h"
22
22
  #include "SkSurface.h"
23
+
24
+ #include "include/gpu/GrBackendSurface.h"
23
25
  #include "include/gpu/GrDirectContext.h"
26
+ #include "include/gpu/ganesh/SkSurfaceGanesh.h"
24
27
  #include "include/gpu/gl/GrGLInterface.h"
25
28
 
26
29
  #pragma clang diagnostic pop
@@ -169,8 +169,8 @@ public:
169
169
  auto tileW = arguments[4].asNumber();
170
170
  auto tileH = arguments[5].asNumber();
171
171
  SkISize size = SkISize::Make(tileW, tileH);
172
- sk_sp<SkShader> gradient = SkPerlinNoiseShader::MakeTurbulence(
173
- baseFreqX, baseFreqY, octaves, seed, &size);
172
+ sk_sp<SkShader> gradient =
173
+ SkShaders::MakeTurbulence(baseFreqX, baseFreqY, octaves, seed, &size);
174
174
  return jsi::Object::createFromHostObject(
175
175
  runtime,
176
176
  std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
@@ -184,8 +184,8 @@ public:
184
184
  auto tileW = arguments[4].asNumber();
185
185
  auto tileH = arguments[5].asNumber();
186
186
  SkISize size = SkISize::Make(tileW, tileH);
187
- sk_sp<SkShader> gradient = SkPerlinNoiseShader::MakeFractalNoise(
188
- baseFreqX, baseFreqY, octaves, seed, &size);
187
+ sk_sp<SkShader> gradient =
188
+ SkShaders::MakeFractalNoise(baseFreqX, baseFreqY, octaves, seed, &size);
189
189
  return jsi::Object::createFromHostObject(
190
190
  runtime,
191
191
  std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
@@ -25,7 +25,8 @@ public:
25
25
  JSI_HOST_FUNCTION(Make) {
26
26
  auto width = static_cast<int>(arguments[0].asNumber());
27
27
  auto height = static_cast<int>(arguments[1].asNumber());
28
- auto surface = SkSurface::MakeRasterN32Premul(width, height);
28
+ auto imageInfo = SkImageInfo::MakeN32Premul(width, height);
29
+ auto surface = SkSurfaces::Raster(imageInfo);
29
30
  if (surface == nullptr) {
30
31
  return jsi::Value::null();
31
32
  }
@@ -256,7 +256,7 @@ public:
256
256
  SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
257
257
  _tileHeightProp->value().getAsNumber());
258
258
 
259
- context->getShaders()->push(SkPerlinNoiseShader::MakeTurbulence(
259
+ context->getShaders()->push(SkShaders::MakeTurbulence(
260
260
  _freqXProp->value().getAsNumber(), _freqYProp->value().getAsNumber(),
261
261
  _octavesProp->value().getAsNumber(), _seedProp->value().getAsNumber(),
262
262
  &size));
@@ -274,7 +274,7 @@ public:
274
274
  SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
275
275
  _tileHeightProp->value().getAsNumber());
276
276
 
277
- context->getShaders()->push(SkPerlinNoiseShader::MakeFractalNoise(
277
+ context->getShaders()->push(SkShaders::MakeFractalNoise(
278
278
  _freqXProp->value().getAsNumber(), _freqYProp->value().getAsNumber(),
279
279
  _octavesProp->value().getAsNumber(), _seedProp->value().getAsNumber(),
280
280
  &size));
@@ -0,0 +1,20 @@
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 SkCanvasAndroid_DEFINED
9
+ #define SkCanvasAndroid_DEFINED
10
+
11
+ class SkCanvas;
12
+ struct SkIRect;
13
+ class GrBackendRenderTarget;
14
+
15
+ namespace skgpu::ganesh {
16
+ SkIRect TopLayerBounds(const SkCanvas*);
17
+ GrBackendRenderTarget TopLayerBackendRenderTarget(const SkCanvas*);
18
+ }
19
+
20
+ #endif
@@ -0,0 +1,43 @@
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
+ #ifndef SkHeifDecoder_DEFINED
8
+ #define SkHeifDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkHeifDecoder {
19
+
20
+ /** Returns true if this data claims to be a HEIF image. */
21
+ SK_API bool IsHeif(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a HEIF.
25
+ *
26
+ * If the bytes are not a HEIF, returns nullptr.
27
+ *
28
+ * DecodeContext is treated as a SkCodec::SelectionPolicy*
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "heif", IsHeif, Decode };
39
+ }
40
+
41
+ } // namespace SkHeifDecoder
42
+
43
+ #endif // SkHeifDecoder_DEFINED
@@ -0,0 +1,50 @@
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 SkSurfaceAndroid_DEFINED
9
+ #define SkSurfaceAndroid_DEFINED
10
+
11
+ #include "include/core/SkRefCnt.h"
12
+ #include "include/core/SkSurface.h"
13
+ #include "include/gpu/GrTypes.h"
14
+
15
+ class SkColorSpace;
16
+ class GrDirectContext;
17
+ class SkPixmap;
18
+ struct AHardwareBuffer;
19
+
20
+ namespace SkSurfaces {
21
+
22
+ /** Private; only to be used by Android Framework.
23
+ Creates SkSurface from Android hardware buffer.
24
+ Returned SkSurface takes a reference on the buffer. The ref on the buffer will be released
25
+ when the SkSurface is destroyed and there is no pending work on the GPU involving the
26
+ buffer.
27
+
28
+ Currently this is only supported for buffers that can be textured as well as rendered to.
29
+ In other words that must have both AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT and
30
+ AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE usage bits.
31
+
32
+ @param context GPU context
33
+ @param hardwareBuffer AHardwareBuffer Android hardware buffer
34
+ @param colorSpace range of colors; may be nullptr
35
+ @param surfaceProps LCD striping orientation and setting for device independent
36
+ fonts; may be nullptr
37
+ @param fromWindow Whether or not the AHardwareBuffer is part of an Android Window.
38
+ Currently only used with Vulkan backend.
39
+ @return created SkSurface, or nullptr
40
+ */
41
+ SK_API sk_sp<SkSurface> WrapAndroidHardwareBuffer(GrDirectContext* context,
42
+ AHardwareBuffer* hardwareBuffer,
43
+ GrSurfaceOrigin origin,
44
+ sk_sp<SkColorSpace> colorSpace,
45
+ const SkSurfaceProps* surfaceProps,
46
+ bool fromWindow = false);
47
+
48
+ } // namespace SkSurfaces
49
+
50
+ #endif
@@ -0,0 +1,43 @@
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
+ #ifndef SkAvifDecoder_DEFINED
8
+ #define SkAvifDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkAvifDecoder {
19
+
20
+ /** Returns true if this data claims to be a AVIF image. */
21
+ SK_API bool IsAvif(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a AVIF.
25
+ *
26
+ * If the bytes are not a AVIF, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "avif", IsAvif, Decode };
39
+ }
40
+
41
+ } // namespace SkAvifDecoder
42
+
43
+ #endif // SkAvifDecoder_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkBmpDecoder_DEFINED
8
+ #define SkBmpDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkBmpDecoder {
19
+
20
+ /** Returns true if this data claims to be a BMP image. */
21
+ SK_API bool IsBmp(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a BMP.
25
+ *
26
+ * If the bytes are not a BMP, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "bmp", IsBmp, Decode };
39
+ }
40
+
41
+ } // namespace SkBmpDecoder
42
+
43
+ #endif // SkBmpDecoder_DEFINED
@@ -23,6 +23,7 @@
23
23
  #include <cstddef>
24
24
  #include <functional>
25
25
  #include <memory>
26
+ #include <string>
26
27
  #include <tuple>
27
28
  #include <vector>
28
29
 
@@ -41,7 +42,6 @@ enum class Blend;
41
42
  enum class DisposalMethod;
42
43
  }
43
44
 
44
-
45
45
  namespace DM {
46
46
  class CodecSrc;
47
47
  } // namespace DM
@@ -1012,4 +1012,28 @@ private:
1012
1012
  friend class SkIcoCodec;
1013
1013
  friend class SkAndroidCodec; // for fEncodedInfo
1014
1014
  };
1015
+
1016
+ namespace SkCodecs {
1017
+
1018
+ using DecodeContext = void*;
1019
+ using IsFormatCallback = bool (*)(const void* data, size_t len);
1020
+ using MakeFromStreamCallback = std::unique_ptr<SkCodec> (*)(std::unique_ptr<SkStream>,
1021
+ SkCodec::Result*,
1022
+ DecodeContext);
1023
+
1024
+ struct Decoder {
1025
+ // By convention, we use all lowercase letters and go with the primary filename extension.
1026
+ // For example "png", "jpg", "ico", "webp", etc
1027
+ std::string id;
1028
+ IsFormatCallback isFormat;
1029
+ MakeFromStreamCallback makeFromStream;
1030
+ };
1031
+
1032
+ // Add the decoder to the end of a linked list of decoders, which will be used to identify calls to
1033
+ // SkCodec::MakeFromStream. If a decoder with the same id already exists, this new decoder
1034
+ // will replace the existing one (in the same position). This is not thread-safe, so make sure all
1035
+ // initialization is done before the first call.
1036
+ void Register(Decoder d);
1037
+ }
1038
+
1015
1039
  #endif // SkCodec_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkGifDecoder_DEFINED
8
+ #define SkGifDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkGifDecoder {
19
+
20
+ /** Returns true if this data claims to be a GIF image. */
21
+ SK_API bool IsGif(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a GIF.
25
+ *
26
+ * If the bytes are not a GIF, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "gif", IsGif, Decode };
39
+ }
40
+
41
+ } // namespace SkGifDecoder
42
+
43
+ #endif // SkGifDecoder_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkIcoDecoder_DEFINED
8
+ #define SkIcoDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkIcoDecoder {
19
+
20
+ /** Returns true if this data claims to be a ICO image. */
21
+ SK_API bool IsIco(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a ICO.
25
+ *
26
+ * If the bytes are not a ICO, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "ico", IsIco, Decode };
39
+ }
40
+
41
+ } // namespace SkIcoDecoder
42
+
43
+ #endif // SkIcoDecoder_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkJpegDecoder_DEFINED
8
+ #define SkJpegDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkJpegDecoder {
19
+
20
+ /** Returns true if this data claims to be a JPEG image. */
21
+ SK_API bool IsJpeg(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a JPEG.
25
+ *
26
+ * If the bytes are not a JPEG, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "jpeg", IsJpeg, Decode };
39
+ }
40
+
41
+ } // namespace SkJpegDecoder
42
+
43
+ #endif // SkJpegDecoder_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkJpegxlDecoder_DEFINED
8
+ #define SkJpegxlDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkJpegxlDecoder {
19
+
20
+ /** Returns true if this data claims to be a JPEGXL image. */
21
+ SK_API bool IsJpegxl(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a JPEGXL.
25
+ *
26
+ * If the bytes are not a JPEGXL, returns nullptr.
27
+ *
28
+ * DecodeContext is ignored
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "jpegxl", IsJpegxl, Decode };
39
+ }
40
+
41
+ } // namespace SkJpegxlDecoder
42
+
43
+ #endif // SkJpegxlDecoder_DEFINED
@@ -0,0 +1,43 @@
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
+ #ifndef SkPngDecoder_DEFINED
8
+ #define SkPngDecoder_DEFINED
9
+
10
+ #include "include/codec/SkCodec.h"
11
+ #include "include/core/SkRefCnt.h"
12
+
13
+ class SkData;
14
+ class SkStream;
15
+
16
+ #include <memory>
17
+
18
+ namespace SkPngDecoder {
19
+
20
+ /** Returns true if this data claims to be a PNG image. */
21
+ SK_API bool IsPng(const void*, size_t);
22
+
23
+ /**
24
+ * Attempts to decode the given bytes as a PNG.
25
+ *
26
+ * If the bytes are not a PNG, returns nullptr.
27
+ *
28
+ * DecodeContext, if non-null, is expected to be a SkPngChunkReader*
29
+ */
30
+ SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
31
+ SkCodec::Result*,
32
+ SkCodecs::DecodeContext = nullptr);
33
+ SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
34
+ SkCodec::Result*,
35
+ SkCodecs::DecodeContext = nullptr);
36
+
37
+ inline SkCodecs::Decoder Decoder() {
38
+ return { "png", IsPng, Decode };
39
+ }
40
+
41
+ } // namespace SkPngDecoder
42
+
43
+ #endif // SkPngDecoder_DEFINED