@shopify/react-native-skia 2.0.5 → 2.0.7

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 (180) hide show
  1. package/android/CMakeLists.txt +10 -0
  2. package/android/build.gradle +2 -1
  3. package/apple/SkiaCVPixelBufferUtils.mm +8 -4
  4. package/cpp/api/JsiSkCanvas.h +10 -8
  5. package/cpp/api/JsiSkFont.h +14 -18
  6. package/cpp/api/JsiSkPath.h +6 -3
  7. package/cpp/api/JsiSkPathEffectFactory.h +2 -2
  8. package/cpp/api/JsiSkPathFactory.h +1 -1
  9. package/cpp/api/JsiSkTextBlobFactory.h +5 -3
  10. package/cpp/api/JsiSkTypeface.h +5 -4
  11. package/cpp/api/recorder/Drawings.h +26 -20
  12. package/cpp/api/recorder/PathEffects.h +3 -2
  13. package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
  14. package/cpp/skia/include/android/SkImageAndroid.h +1 -8
  15. package/cpp/skia/include/config/SkUserConfig.h +9 -0
  16. package/cpp/skia/include/core/SkCPUContext.h +31 -0
  17. package/cpp/skia/include/core/SkCPURecorder.h +69 -0
  18. package/cpp/skia/include/core/SkCanvas.h +57 -13
  19. package/cpp/skia/include/core/SkContourMeasure.h +1 -1
  20. package/cpp/skia/include/core/SkData.h +63 -37
  21. package/cpp/skia/include/core/SkFont.h +94 -65
  22. package/cpp/skia/include/core/SkImage.h +10 -9
  23. package/cpp/skia/include/core/SkImageGenerator.h +3 -0
  24. package/cpp/skia/include/core/SkMatrix.h +102 -116
  25. package/cpp/skia/include/core/SkMilestone.h +1 -1
  26. package/cpp/skia/include/core/SkPath.h +163 -60
  27. package/cpp/skia/include/core/SkPathBuilder.h +713 -30
  28. package/cpp/skia/include/core/SkPathTypes.h +5 -1
  29. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  30. package/cpp/skia/include/core/SkRecorder.h +35 -0
  31. package/cpp/skia/include/core/SkRect.h +57 -27
  32. package/cpp/skia/include/core/SkRegion.h +1 -1
  33. package/cpp/skia/include/core/SkSurface.h +8 -1
  34. package/cpp/skia/include/core/SkTextBlob.h +50 -6
  35. package/cpp/skia/include/core/SkTraceMemoryDump.h +7 -0
  36. package/cpp/skia/include/core/SkTypeface.h +53 -26
  37. package/cpp/skia/include/core/SkTypes.h +6 -0
  38. package/cpp/skia/include/effects/SkDashPathEffect.h +9 -3
  39. package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -1
  40. package/cpp/skia/include/encode/SkEncoder.h +1 -1
  41. package/cpp/skia/include/encode/SkICC.h +1 -1
  42. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +23 -0
  43. package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +12 -0
  44. package/cpp/skia/include/gpu/graphite/Context.h +32 -8
  45. package/cpp/skia/include/gpu/graphite/ContextOptions.h +22 -4
  46. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -4
  47. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +16 -2
  48. package/cpp/skia/include/gpu/graphite/Recorder.h +30 -10
  49. package/cpp/skia/include/gpu/graphite/Recording.h +7 -3
  50. package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -3
  51. package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +15 -0
  52. package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +89 -13
  53. package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
  54. package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
  55. package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +214 -0
  56. package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +3 -0
  57. package/cpp/skia/include/private/SkGainmapShader.h +10 -4
  58. package/cpp/skia/include/private/SkPathRef.h +6 -2
  59. package/cpp/skia/include/private/base/SkAlign.h +11 -0
  60. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  61. package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +255 -0
  62. package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +203 -0
  63. package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +1 -2
  64. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +390 -0
  65. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +106 -0
  66. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +140 -0
  67. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +1 -1
  68. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +1 -1
  69. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +144 -0
  70. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +1 -1
  71. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +1 -1
  72. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +158 -0
  73. package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
  74. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +1 -1
  75. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +1 -1
  76. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +242 -0
  77. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10094 -5707
  78. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +55 -0
  79. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +288 -0
  80. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +59 -0
  81. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +1 -1
  82. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +1 -1
  83. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +238 -0
  84. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +110 -0
  85. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +47 -0
  86. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +55 -0
  87. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +1 -1
  88. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +1 -1
  89. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
  90. package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +46 -0
  91. package/cpp/skia/modules/skcms/src/skcms_internals.h +10 -2
  92. package/cpp/skia/modules/skcms/src/skcms_public.h +39 -10
  93. package/libs/android/arm64-v8a/libpathops.a +0 -0
  94. package/libs/android/arm64-v8a/libskia.a +0 -0
  95. package/libs/android/arm64-v8a/libskottie.a +0 -0
  96. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  97. package/libs/android/arm64-v8a/libsksg.a +0 -0
  98. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  99. package/libs/android/arm64-v8a/libskunicode_icu.a +0 -0
  100. package/libs/android/arm64-v8a/libsvg.a +0 -0
  101. package/libs/android/armeabi-v7a/libpathops.a +0 -0
  102. package/libs/android/armeabi-v7a/libskia.a +0 -0
  103. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  104. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  105. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  106. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  107. package/libs/android/armeabi-v7a/libskunicode_icu.a +0 -0
  108. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  109. package/libs/android/x86/libpathops.a +0 -0
  110. package/libs/android/x86/libskia.a +0 -0
  111. package/libs/android/x86/libskottie.a +0 -0
  112. package/libs/android/x86/libskparagraph.a +0 -0
  113. package/libs/android/x86/libsksg.a +0 -0
  114. package/libs/android/x86/libskshaper.a +0 -0
  115. package/libs/android/x86/libskunicode_icu.a +0 -0
  116. package/libs/android/x86/libsvg.a +0 -0
  117. package/libs/android/x86_64/libpathops.a +0 -0
  118. package/libs/android/x86_64/libskia.a +0 -0
  119. package/libs/android/x86_64/libskottie.a +0 -0
  120. package/libs/android/x86_64/libskparagraph.a +0 -0
  121. package/libs/android/x86_64/libsksg.a +0 -0
  122. package/libs/android/x86_64/libskshaper.a +0 -0
  123. package/libs/android/x86_64/libskunicode_icu.a +0 -0
  124. package/libs/android/x86_64/libsvg.a +0 -0
  125. package/libs/apple/libpathops.xcframework/Info.plist +94 -0
  126. package/libs/apple/libpathops.xcframework/ios-arm64_arm64e/libpathops.a +0 -0
  127. package/libs/apple/libpathops.xcframework/ios-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
  128. package/libs/apple/libpathops.xcframework/macos-arm64_x86_64/libpathops.a +0 -0
  129. package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e/libpathops.a +0 -0
  130. package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
  131. package/libs/apple/libskia.xcframework/Info.plist +14 -14
  132. package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  133. package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  134. package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
  135. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
  136. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  137. package/libs/apple/libskottie.xcframework/Info.plist +8 -8
  138. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  139. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  140. package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
  141. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
  142. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  143. package/libs/apple/libskparagraph.xcframework/Info.plist +14 -14
  144. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  145. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  146. package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
  147. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
  148. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  149. package/libs/apple/libsksg.xcframework/Info.plist +8 -8
  150. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  151. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  152. package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
  153. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
  154. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  155. package/libs/apple/libskshaper.xcframework/Info.plist +14 -14
  156. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  157. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  158. package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
  159. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
  160. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  161. package/libs/apple/libskunicode_core.xcframework/Info.plist +12 -12
  162. package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  163. package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
  164. package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  165. package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
  166. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  167. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  168. package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
  169. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  170. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  171. package/libs/apple/libsvg.xcframework/Info.plist +12 -12
  172. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  173. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  174. package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
  175. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
  176. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  177. package/package.json +1 -1
  178. package/react-native-skia.podspec +2 -1
  179. package/src/renderer/__tests__/e2e/BackdropFilters.spec.tsx +23 -0
  180. /package/cpp/skia/{include/pathops → modules/pathops/include}/SkPathOps.h +0 -0
@@ -58,6 +58,7 @@ set (SKIA_SKSHAPER_LIB "skshaper")
58
58
  set (SKIA_SKPARAGRAPH_LIB "skparagraph")
59
59
  set (SKIA_SKUNICODE_CORE_LIB "skunicode_core")
60
60
  set (SKIA_SKUNICODE_ICU_LIB "skunicode_icu")
61
+ set (SKIA_PATHOPS_LIB "pathops")
61
62
 
62
63
 
63
64
  # Clear some variables
@@ -169,6 +170,8 @@ set_property(TARGET skunicode_core PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}
169
170
  add_library(skunicode_icu STATIC IMPORTED)
170
171
  set_property(TARGET skunicode_icu PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libskunicode_icu.a")
171
172
 
173
+ add_library(pathops STATIC IMPORTED)
174
+ set_property(TARGET pathops PROPERTY IMPORTED_LOCATION "${SKIA_LIBS_PATH}/libpathops.a")
172
175
 
173
176
  find_library(
174
177
  LOG_LIB
@@ -296,6 +299,7 @@ if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
296
299
  ${SKIA_SKPARAGRAPH_LIB}
297
300
  ${SKIA_SKUNICODE_CORE_LIB}
298
301
  ${SKIA_SKUNICODE_ICU_LIB}
302
+ ${SKIA_PATHOPS_LIB}
299
303
  ${SKIA_LIB}
300
304
  -ljnigraphics
301
305
  -lGLESv2
@@ -316,6 +320,7 @@ else()
316
320
  ${SKIA_SKPARAGRAPH_LIB}
317
321
  ${SKIA_SKUNICODE_CORE_LIB}
318
322
  ${SKIA_SKUNICODE_ICU_LIB}
323
+ ${SKIA_PATHOPS_LIB}
319
324
  ${SKIA_LIB}
320
325
  -ljnigraphics
321
326
  -lGLESv2
@@ -335,3 +340,8 @@ else()
335
340
  -lEGL
336
341
  )
337
342
  endif()
343
+
344
+ # Enable Android 16kb native library alignment
345
+ if(CMAKE_ANDROID_NDK_VERSION VERSION_LESS "27")
346
+ target_link_options(${PACKAGE_NAME} PRIVATE "-Wl,-z,max-page-size=16384")
347
+ endif()
@@ -156,7 +156,8 @@ android {
156
156
  arguments '-DANDROID_STL=c++_shared',
157
157
  "-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
158
158
  "-DNODE_MODULES_DIR=${nodeModules}",
159
- "-DPREBUILT_DIR=${prebuiltDir}"
159
+ "-DPREBUILT_DIR=${prebuiltDir}",
160
+ "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
160
161
 
161
162
  }
162
163
  }
@@ -30,12 +30,16 @@
30
30
  #include <TargetConditionals.h>
31
31
  #if TARGET_RT_BIG_ENDIAN
32
32
  #define FourCC2Str(fourcc) \
33
- (const char[]){*((char *)&fourcc), *(((char *)&fourcc) + 1), \
34
- *(((char *)&fourcc) + 2), *(((char *)&fourcc) + 3), 0}
33
+ (const char[]) { \
34
+ *((char *)&fourcc), *(((char *)&fourcc) + 1), *(((char *)&fourcc) + 2), \
35
+ *(((char *)&fourcc) + 3), 0 \
36
+ }
35
37
  #else
36
38
  #define FourCC2Str(fourcc) \
37
- (const char[]){*(((char *)&fourcc) + 3), *(((char *)&fourcc) + 2), \
38
- *(((char *)&fourcc) + 1), *(((char *)&fourcc) + 0), 0}
39
+ (const char[]) { \
40
+ *(((char *)&fourcc) + 3), *(((char *)&fourcc) + 2), \
41
+ *(((char *)&fourcc) + 1), *(((char *)&fourcc) + 0), 0 \
42
+ }
39
43
  #endif
40
44
 
41
45
  // pragma MARK: TextureHolder
@@ -258,9 +258,8 @@ public:
258
258
  }
259
259
 
260
260
  auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
261
-
262
- _canvas->drawPoints((SkCanvas::PointMode)pointMode, pointsSize,
263
- points.data(), *paint);
261
+ auto p = SkSpan(points.data(), points.size());
262
+ _canvas->drawPoints((SkCanvas::PointMode)pointMode, p, *paint);
264
263
 
265
264
  return jsi::Value::undefined();
266
265
  }
@@ -403,8 +402,9 @@ public:
403
402
  glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber());
404
403
  }
405
404
 
406
- _canvas->drawGlyphs(glyphsSize, glyphs.data(), positions.data(), origin,
407
- *font, *paint);
405
+ auto g = SkSpan(glyphs.data(), glyphs.size());
406
+ auto p = SkSpan(positions.data(), positions.size());
407
+ _canvas->drawGlyphs(g, p, origin, *font, *paint);
408
408
 
409
409
  return jsi::Value::undefined();
410
410
  }
@@ -597,9 +597,11 @@ public:
597
597
  if (count > 6) {
598
598
  sampling = SamplingOptionsFromValue(runtime, arguments[6]);
599
599
  }
600
- _canvas->drawAtlas(atlas.get(), xforms.data(), skRects.data(),
601
- colors.empty() ? nullptr : colors.data(), skRects.size(),
602
- blendMode, sampling, nullptr, paint.get());
600
+ auto x = SkSpan(xforms.data(), xforms.size());
601
+ auto t = SkSpan(skRects.data(), skRects.size());
602
+ auto c = SkSpan(colors.data(), colors.size());
603
+ _canvas->drawAtlas(atlas.get(), x, t, c, blendMode, sampling, nullptr,
604
+ paint.get());
603
605
 
604
606
  return jsi::Value::undefined();
605
607
  }
@@ -40,15 +40,13 @@ public:
40
40
  for (int i = 0; i < glyphsSize; i++) {
41
41
  glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber());
42
42
  }
43
+ auto widths = SkSpan(static_cast<SkScalar *>(widthPtrs.data()), glyphsSize);
44
+ auto g = SkSpan(glyphs.data(), glyphs.size());
43
45
  if (count > 1) {
44
46
  auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
45
- getObject()->getWidthsBounds(glyphs.data(), glyphsSize,
46
- static_cast<SkScalar *>(widthPtrs.data()),
47
- nullptr, paint.get());
47
+ getObject()->getWidthsBounds(g, widths, {}, paint.get());
48
48
  } else {
49
- getObject()->getWidthsBounds(glyphs.data(), glyphsSize,
50
- static_cast<SkScalar *>(widthPtrs.data()),
51
- nullptr, nullptr);
49
+ getObject()->getWidthsBounds(g, widths, {}, nullptr);
52
50
  }
53
51
  auto jsiWidths = jsi::Array(runtime, glyphsSize);
54
52
  for (int i = 0; i < glyphsSize; i++) {
@@ -68,20 +66,17 @@ public:
68
66
  std::vector<SkGlyphID> glyphs;
69
67
  glyphs.resize(numGlyphIDs);
70
68
  int glyphsSize = static_cast<int>(numGlyphIDs);
69
+ auto g = SkSpan(glyphs.data(), glyphs.size());
71
70
  getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
72
- static_cast<SkGlyphID *>(glyphs.data()),
73
- glyphsSize);
71
+ g);
74
72
  std::vector<SkScalar> widthPtrs;
75
73
  widthPtrs.resize(numGlyphIDs);
74
+ auto widths = SkSpan(widthPtrs.data(), widthPtrs.size());
76
75
  if (count > 1) {
77
76
  auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
78
- getObject()->getWidthsBounds(glyphs.data(), glyphsSize,
79
- static_cast<SkScalar *>(widthPtrs.data()),
80
- nullptr, paint.get());
77
+ getObject()->getWidthsBounds(g, widths, {}, paint.get());
81
78
  } else {
82
- getObject()->getWidthsBounds(glyphs.data(), glyphsSize,
83
- static_cast<SkScalar *>(widthPtrs.data()),
84
- nullptr, nullptr);
79
+ getObject()->getWidthsBounds(g, widths, {}, nullptr);
85
80
  }
86
81
  return jsi::Value(std::accumulate(widthPtrs.begin(), widthPtrs.end(), 0));
87
82
  }
@@ -126,9 +121,9 @@ public:
126
121
  SkTextEncoding::kUTF8);
127
122
  std::vector<SkGlyphID> glyphIDs;
128
123
  glyphIDs.resize(numGlyphIDs);
124
+ auto g = SkSpan(static_cast<SkGlyphID *>(glyphIDs.data()), glyphIDs.size());
129
125
  getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
130
- static_cast<SkGlyphID *>(glyphIDs.data()),
131
- numGlyphIDs);
126
+ g);
132
127
  auto jsiGlyphIDs = jsi::Array(runtime, numGlyphIDs);
133
128
  for (int i = 0; i < numGlyphIDs; i++) {
134
129
  jsiGlyphIDs.setValueAtIndex(runtime, i,
@@ -162,8 +157,9 @@ public:
162
157
  throw jsi::JSError(runtime, "Not enough x,y position pairs for glyphs");
163
158
  return jsi::Value::null();
164
159
  }
165
- auto sects = getObject()->getIntercepts(
166
- glyphs.data(), SkToInt(glyphs.size()), positions.data(), top, bottom);
160
+ auto g = SkSpan(glyphs.data(), glyphs.size());
161
+ auto p = SkSpan(positions.data(), positions.size());
162
+ auto sects = getObject()->getIntercepts(g, p, top, bottom);
167
163
  auto jsiSects = jsi::Array(runtime, sects.size());
168
164
  for (int i = 0; i < sects.size(); i++) {
169
165
  jsiSects.setValueAtIndex(runtime, i,
@@ -24,10 +24,11 @@
24
24
  #include "include/core/SkStrokeRec.h"
25
25
  #include "include/effects/SkDashPathEffect.h"
26
26
  #include "include/effects/SkTrimPathEffect.h"
27
- #include "include/pathops/SkPathOps.h"
28
27
  #include "include/utils/SkParsePath.h"
29
28
  #include "include/utils/SkTextUtils.h"
30
29
 
30
+ #include "modules/pathops/include/SkPathOps.h"
31
+
31
32
  #pragma clang diagnostic pop
32
33
 
33
34
  namespace RNSkia {
@@ -96,7 +97,8 @@ public:
96
97
  runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime));
97
98
  points.push_back(*point.get());
98
99
  }
99
- getObject()->addPoly(points.data(), static_cast<int>(points.size()), close);
100
+ auto p = SkSpan(points.data(), points.size());
101
+ getObject()->addPoly(p, close);
100
102
  return thisValue.getObject(runtime);
101
103
  }
102
104
 
@@ -213,7 +215,8 @@ public:
213
215
  SkScalar off = arguments[1].asNumber();
214
216
  auto phase = arguments[2].asNumber();
215
217
  SkScalar intervals[] = {on, off};
216
- auto pe = SkDashPathEffect::Make(intervals, 2, phase);
218
+ auto i = SkSpan(intervals, 2);
219
+ auto pe = SkDashPathEffect::Make(i, phase);
217
220
  if (!pe) {
218
221
  // TODO: SkDebugf("Invalid args to dash()\n");
219
222
  return jsi::Value(false);
@@ -47,10 +47,10 @@ public:
47
47
  count >= 2 && !arguments[1].isUndefined() && !arguments[1].isNull()
48
48
  ? arguments[1].asNumber()
49
49
  : 0;
50
+ auto i = SkSpan(intervals.data(), intervals.size());
50
51
  return jsi::Object::createFromHostObject(
51
52
  runtime, std::make_shared<JsiSkPathEffect>(
52
- getContext(),
53
- SkDashPathEffect::Make(intervals.data(), size, phase)));
53
+ getContext(), SkDashPathEffect::Make(i, phase)));
54
54
  }
55
55
 
56
56
  JSI_HOST_FUNCTION(MakeDiscrete) {
@@ -13,7 +13,7 @@
13
13
 
14
14
  #include "RNSkLog.h"
15
15
  #include "include/core/SkPath.h"
16
- #include "include/pathops/SkPathOps.h"
16
+ #include "modules/pathops/include/SkPathOps.h"
17
17
 
18
18
  #pragma clang diagnostic pop
19
19
 
@@ -63,8 +63,9 @@ public:
63
63
  runtime, jsiRsxforms.getValueAtIndex(runtime, i));
64
64
  rsxforms.push_back(*rsxform);
65
65
  }
66
- auto textBlob = SkTextBlob::MakeFromRSXform(str.c_str(), str.length(),
67
- rsxforms.data(), *font);
66
+ auto x = SkSpan(rsxforms.data(), rsxforms.size());
67
+ auto textBlob =
68
+ SkTextBlob::MakeFromRSXform(str.c_str(), str.length(), x, *font);
68
69
  return jsi::Object::createFromHostObject(
69
70
  runtime,
70
71
  std::make_shared<JsiSkTextBlob>(getContext(), std::move(textBlob)));
@@ -89,8 +90,9 @@ public:
89
90
  runtime, jsiRsxforms.getValueAtIndex(runtime, i));
90
91
  rsxforms.push_back(*rsxform);
91
92
  }
93
+ auto x = SkSpan(rsxforms.data(), rsxforms.size());
92
94
  auto textBlob = SkTextBlob::MakeFromRSXform(
93
- glyphs.data(), glyphs.size() * bytesPerGlyph, rsxforms.data(), *font,
95
+ glyphs.data(), glyphs.size() * bytesPerGlyph, x, *font,
94
96
  SkTextEncoding::kGlyphID);
95
97
  return jsi::Object::createFromHostObject(
96
98
  runtime,
@@ -38,12 +38,13 @@ public:
38
38
  count > 1 && !arguments[1].isNull() && !arguments[1].isUndefined()
39
39
  ? static_cast<int>(arguments[1].asNumber())
40
40
  : getObject()->textToGlyphs(str.c_str(), str.length(),
41
- SkTextEncoding::kUTF8, nullptr, 0);
41
+ SkTextEncoding::kUTF8,
42
+ SkSpan<SkGlyphID>(nullptr, 0));
42
43
  std::vector<SkGlyphID> glyphIDs;
43
44
  glyphIDs.resize(numGlyphIDs);
44
- getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
45
- static_cast<SkGlyphID *>(glyphIDs.data()),
46
- numGlyphIDs);
45
+ getObject()->textToGlyphs(
46
+ str.c_str(), str.length(), SkTextEncoding::kUTF8,
47
+ SkSpan(static_cast<SkGlyphID *>(glyphIDs.data()), numGlyphIDs));
47
48
  auto jsiGlyphIDs = jsi::Array(runtime, numGlyphIDs);
48
49
  for (int i = 0; i < numGlyphIDs; i++) {
49
50
  jsiGlyphIDs.setValueAtIndex(runtime, i,
@@ -246,15 +246,17 @@ public:
246
246
  glyphIds.reserve(numGlyphIds);
247
247
  auto ids = font->textToGlyphs(
248
248
  text.c_str(), text.length(), SkTextEncoding::kUTF8,
249
- static_cast<SkGlyphID *>(glyphIds.data()), numGlyphIds);
249
+ SkSpan(static_cast<SkGlyphID *>(glyphIds.data()), numGlyphIds));
250
250
 
251
251
  // Get glyph widths
252
252
  int glyphsSize = static_cast<int>(ids);
253
253
  std::vector<SkScalar> widthPtrs;
254
254
  widthPtrs.resize(glyphsSize);
255
- font->getWidthsBounds(glyphIds.data(), numGlyphIds,
256
- static_cast<SkScalar *>(widthPtrs.data()), nullptr,
257
- nullptr); // TODO: Should we use paint somehow here?
255
+ font->getWidthsBounds(
256
+ SkSpan(glyphIds.data(), numGlyphIds),
257
+ SkSpan(static_cast<SkScalar *>(widthPtrs.data()), widthPtrs.size()),
258
+ {},
259
+ nullptr); // TODO: Should we use paint somehow here?
258
260
 
259
261
  std::vector<SkRSXform> rsx;
260
262
  SkContourMeasureIter meas(path, false, 1);
@@ -295,9 +297,9 @@ public:
295
297
  rsx.push_back(SkRSXform::Make(tx, ty, adjustedX, adjustedY));
296
298
  dist += width / 2;
297
299
  }
298
-
299
- auto blob = SkTextBlob::MakeFromRSXform(text.c_str(), text.length(),
300
- rsx.data(), *font);
300
+ auto x = SkSpan(rsx.data(), rsx.size());
301
+ auto blob =
302
+ SkTextBlob::MakeFromRSXform(text.c_str(), text.length(), x, *font);
301
303
  ctx->canvas->drawTextBlob(blob, 0, 0, ctx->getPaint());
302
304
  }
303
305
  }
@@ -532,8 +534,8 @@ public:
532
534
  }
533
535
 
534
536
  void draw(DrawingCtx *ctx) {
535
- ctx->canvas->drawPoints(props.mode, props.points.size(),
536
- props.points.data(), ctx->getPaint());
537
+ auto points = SkSpan(props.points.data(), props.points.size());
538
+ ctx->canvas->drawPoints(props.mode, points, ctx->getPaint());
537
539
  }
538
540
  };
539
541
 
@@ -780,10 +782,13 @@ public:
780
782
 
781
783
  void draw(DrawingCtx *ctx) {
782
784
  if (props.font.has_value()) {
783
- ctx->canvas->drawGlyphs(
784
- static_cast<int>(props.glyphs.glyphIds.size()),
785
- props.glyphs.glyphIds.data(), props.glyphs.positions.data(),
786
- SkPoint::Make(props.x, props.y), props.font.value(), ctx->getPaint());
785
+ auto glyphs =
786
+ SkSpan(props.glyphs.glyphIds.data(), props.glyphs.glyphIds.size());
787
+ auto positions =
788
+ SkSpan(props.glyphs.positions.data(), props.glyphs.positions.size());
789
+ ctx->canvas->drawGlyphs(glyphs, positions,
790
+ SkPoint::Make(props.x, props.y),
791
+ props.font.value(), ctx->getPaint());
787
792
  }
788
793
  }
789
794
  };
@@ -934,16 +939,17 @@ public:
934
939
  "colors array must have the same length as transforms/sprites");
935
940
  }
936
941
 
937
- auto colors =
938
- props.colors.has_value() ? props.colors.value().data() : nullptr;
942
+ auto colors = SkSpan(
943
+ props.colors.has_value() ? props.colors.value().data() : nullptr,
944
+ props.colors.has_value() ? props.colors.value().size() : 0);
939
945
  auto blendMode = props.blendMode.value_or(SkBlendMode::kDstOver);
940
946
  auto sampling =
941
947
  props.sampling.value_or(SkSamplingOptions(SkFilterMode::kLinear));
942
-
943
- ctx->canvas->drawAtlas(props.image.get(), props.transforms.data(),
944
- props.sprites.data(), colors,
945
- props.transforms.size(), blendMode, sampling,
946
- nullptr, &(ctx->getPaint()));
948
+ auto transforms =
949
+ SkSpan(props.transforms.data(), props.transforms.size());
950
+ auto sprites = SkSpan(props.sprites.data(), props.sprites.size());
951
+ ctx->canvas->drawAtlas(props.image.get(), transforms, sprites, colors,
952
+ blendMode, sampling, nullptr, &(ctx->getPaint()));
947
953
  }
948
954
  }
949
955
  };
@@ -54,8 +54,9 @@ public:
54
54
  }
55
55
 
56
56
  void pushPathEffect(DrawingCtx *ctx) {
57
- auto pe = SkDashPathEffect::Make(props.intervals.data(),
58
- props.intervals.size(), props.phase);
57
+ auto intervals = SkSpan(static_cast<SkScalar *>(props.intervals.data()),
58
+ props.intervals.size());
59
+ auto pe = SkDashPathEffect::Make(intervals, props.phase);
59
60
  ctx->pathEffects.push_back(pe);
60
61
  }
61
62
  };
@@ -74,7 +74,7 @@ public:
74
74
  // of fColors/fColorOffsets on input, and
75
75
  // actual number of colors/offsets on
76
76
  // output.
77
- SkColor* fColors = nullptr; //!< The colors in the gradient.
77
+ SkColor4f* fColors = nullptr; //!< The colors in the gradient.
78
78
  SkScalar* fColorOffsets = nullptr; //!< The unit offset for color transitions.
79
79
  SkPoint fPoints[2]; //!< Type specific, see above.
80
80
  SkTileMode fTileMode;
@@ -19,7 +19,7 @@ struct AHardwareBuffer;
19
19
 
20
20
  namespace SkImages {
21
21
 
22
- /** (See Skia bug 7447)
22
+ /** (See skbug.com/40038695)
23
23
  Creates SkImage from Android hardware buffer.
24
24
  Returned SkImage takes a reference on the buffer.
25
25
  Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
@@ -58,13 +58,6 @@ SK_API sk_sp<SkImage> PinnableRasterFromBitmap(const SkBitmap&);
58
58
 
59
59
  } // namespace SkImages
60
60
 
61
- // TODO(kjlubick) remove this after Android has been ported.
62
- namespace sk_image_factory {
63
- inline sk_sp<SkImage> MakePinnableFromRasterBitmap(const SkBitmap& b) {
64
- return SkImages::PinnableRasterFromBitmap(b);
65
- }
66
- } // namespace sk_image_factory
67
-
68
61
  namespace skgpu::ganesh {
69
62
  /**
70
63
  * Will attempt to upload and lock the contents of the image as a texture, so that subsequent
@@ -88,6 +88,7 @@
88
88
  //#define SK_HISTOGRAM_BOOLEAN(name, sample)
89
89
  //#define SK_HISTOGRAM_ENUMERATION(name, sampleEnum, enumSize)
90
90
  //#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, valueMax)
91
+ //#define SK_HISTOGRAM_CUSTOM_EXACT_LINEAR(name, sample, value_min, value_max, bucket_count)
91
92
  //#define SK_HISTOGRAM_MEMORY_KB(name, sample)
92
93
  //#define SK_HISTOGRAM_CUSTOM_COUNTS(name, sample, countMin, countMax, bucketCount)
93
94
  //#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
@@ -121,4 +122,12 @@
121
122
  */
122
123
  //#define SK_API __declspec(dllexport)
123
124
 
125
+ /*
126
+ * If using DNG support, set the version of the dng_sdk being compiled against here
127
+ * following the versioning scheme of dng_tag_valus.h
128
+ * eg, DNG 1.4 is 0x01040000, DNG 1.7.1 is 0x01070100, etc...
129
+ * If unspecified, DNG SDK 1.4 is assumed
130
+ */
131
+ // #define SK_DNG_VERSION 0x01040000
132
+
124
133
  #endif
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright 2025 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 skcpu_Context_DEFINED
8
+ #define skcpu_Context_DEFINED
9
+
10
+ #include "include/private/base/SkAPI.h"
11
+
12
+ #include <memory>
13
+
14
+ namespace skcpu {
15
+ class Recorder;
16
+
17
+ class SK_API Context {
18
+ public:
19
+ struct Options {};
20
+
21
+ std::unique_ptr<Recorder> makeRecorder() const;
22
+
23
+ static std::unique_ptr<const Context> Make(const Options&);
24
+ static std::unique_ptr<const Context> Make();
25
+
26
+ protected:
27
+ Context() = default;
28
+ };
29
+ } // namespace skcpu
30
+
31
+ #endif
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright 2025 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 skcpu_Recorder_DEFINED
9
+ #define skcpu_Recorder_DEFINED
10
+
11
+ #include "include/core/SkRecorder.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/private/base/SkAPI.h"
14
+
15
+ class SkSurface;
16
+ class SkSurfaceProps;
17
+ struct SkImageInfo;
18
+
19
+ #include <cstddef>
20
+
21
+ namespace skcpu {
22
+
23
+ class SK_API Recorder : public SkRecorder {
24
+ public:
25
+ /** Returns a non-null global context. Can be used as a means of transitioning onto
26
+ * new APIs when a skcpu::Context/Recorder has not been piped down into the code paths
27
+ */
28
+ static Recorder* TODO();
29
+
30
+ SkRecorder::Type type() const final { return SkRecorder::Type::kCPU; }
31
+ skcpu::Recorder* cpuRecorder() final { return this; }
32
+
33
+ /** Allocates a bitmap-backed SkSurface. SkCanvas returned by SkSurface draws directly into
34
+ * those allocated pixels, which are zeroed before use. Pixel memory size is imageInfo.height()
35
+ * times imageInfo.minRowBytes() or rowBytes, if provided and non-zero.
36
+ *
37
+ * Pixel memory is deleted when SkSurface is deleted.
38
+ *
39
+ * Validity constraints include:
40
+ * - info dimensions are greater than zero;
41
+ * - info contains SkColorType and SkAlphaType supported by raster surface.
42
+ *
43
+ * @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace,
44
+ * of raster surface; width and height must be greater than zero
45
+ * @param rowBytes interval from one SkSurface row to the next.
46
+ * @param props LCD striping orientation and setting for device independent fonts;
47
+ * may be nullptr
48
+ * @return SkSurface if parameters are valid and memory was allocated, else nullptr.
49
+ */
50
+ sk_sp<SkSurface> makeBitmapSurface(const SkImageInfo& imageInfo,
51
+ size_t rowBytes,
52
+ const SkSurfaceProps* surfaceProps);
53
+ sk_sp<SkSurface> makeBitmapSurface(const SkImageInfo& imageInfo,
54
+ const SkSurfaceProps* surfaceProps = nullptr);
55
+ };
56
+
57
+ inline Recorder* AsRecorder(SkRecorder* recorder) {
58
+ if (!recorder) {
59
+ return nullptr;
60
+ }
61
+ if (recorder->type() != SkRecorder::Type::kCPU) {
62
+ return nullptr;
63
+ }
64
+ return static_cast<Recorder*>(recorder);
65
+ }
66
+
67
+ } // namespace skcpu
68
+
69
+ #endif