@shopify/react-native-skia 2.0.4 → 2.0.6
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.
- package/android/CMakeLists.txt +10 -0
- package/android/build.gradle +2 -1
- package/apple/SkiaCVPixelBufferUtils.mm +8 -4
- package/cpp/api/JsiSkCanvas.h +10 -8
- package/cpp/api/JsiSkFont.h +14 -18
- package/cpp/api/JsiSkPath.h +4 -2
- package/cpp/api/JsiSkPathEffectFactory.h +2 -2
- package/cpp/api/JsiSkTextBlobFactory.h +5 -3
- package/cpp/api/JsiSkTypeface.h +5 -4
- package/cpp/api/recorder/Drawings.h +26 -20
- package/cpp/api/recorder/PathEffects.h +3 -2
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
- package/cpp/skia/include/android/SkImageAndroid.h +1 -8
- package/cpp/skia/include/config/SkUserConfig.h +9 -0
- package/cpp/skia/include/core/SkCPUContext.h +31 -0
- package/cpp/skia/include/core/SkCPURecorder.h +69 -0
- package/cpp/skia/include/core/SkCanvas.h +57 -13
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkData.h +63 -37
- package/cpp/skia/include/core/SkFont.h +94 -65
- package/cpp/skia/include/core/SkImage.h +10 -9
- package/cpp/skia/include/core/SkImageGenerator.h +3 -0
- package/cpp/skia/include/core/SkMatrix.h +102 -116
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +163 -60
- package/cpp/skia/include/core/SkPathBuilder.h +713 -30
- package/cpp/skia/include/core/SkPathTypes.h +5 -1
- package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
- package/cpp/skia/include/core/SkRecorder.h +35 -0
- package/cpp/skia/include/core/SkRect.h +57 -27
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +8 -1
- package/cpp/skia/include/core/SkTextBlob.h +50 -6
- package/cpp/skia/include/core/SkTraceMemoryDump.h +7 -0
- package/cpp/skia/include/core/SkTypeface.h +53 -26
- package/cpp/skia/include/core/SkTypes.h +6 -0
- package/cpp/skia/include/effects/SkDashPathEffect.h +9 -3
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -1
- package/cpp/skia/include/encode/SkEncoder.h +1 -1
- package/cpp/skia/include/encode/SkICC.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +23 -0
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +12 -0
- package/cpp/skia/include/gpu/graphite/Context.h +32 -8
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +22 -4
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +21 -4
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +16 -2
- package/cpp/skia/include/gpu/graphite/Recorder.h +30 -10
- package/cpp/skia/include/gpu/graphite/Recording.h +7 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -3
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +15 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +89 -13
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +39 -0
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +214 -0
- package/cpp/skia/include/pathops/SkPathOps.h +7 -111
- package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +3 -0
- package/cpp/skia/include/private/SkGainmapShader.h +10 -4
- package/cpp/skia/include/private/SkPathRef.h +6 -2
- package/cpp/skia/include/private/base/SkAlign.h +11 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +255 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +203 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +1 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +390 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +106 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +140 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +144 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +158 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +242 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10094 -5707
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +288 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +59 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +238 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +110 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +47 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +55 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +60 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +46 -0
- package/cpp/skia/modules/pathops/include/SkPathOps.h +121 -0
- package/cpp/skia/modules/skcms/src/skcms_internals.h +10 -2
- package/cpp/skia/modules/skcms/src/skcms_public.h +39 -10
- package/lib/commonjs/sksg/Container.d.ts +1 -0
- package/lib/commonjs/sksg/Container.js +3 -0
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.js +1 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -0
- package/lib/module/sksg/Container.js +3 -0
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Reconciler.js +1 -0
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/lib/module/sksg/Container.d.ts +2 -1
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -3
- package/lib/typescript/src/sksg/Container.d.ts +1 -0
- package/libs/android/arm64-v8a/libpathops.a +0 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode_icu.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libpathops.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode_icu.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libpathops.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode_icu.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libpathops.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode_icu.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +94 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/ios-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/macos-arm64_x86_64/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e/libpathops.a +0 -0
- package/libs/apple/libpathops.xcframework/tvos-arm64_arm64e_x86_64-simulator/libpathops.a +0 -0
- package/libs/apple/libskia.xcframework/Info.plist +7 -7
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +10 -10
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskparagraph.xcframework/Info.plist +13 -13
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libsksg.xcframework/Info.plist +11 -11
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libskshaper.xcframework/Info.plist +12 -12
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/Info.plist +14 -14
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libsvg.xcframework/Info.plist +17 -17
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +2 -1
- package/src/renderer/__tests__/e2e/BackdropFilters.spec.tsx +23 -0
- package/src/sksg/Container.ts +4 -0
- package/src/sksg/Reconciler.ts +1 -0
package/android/CMakeLists.txt
CHANGED
@@ -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()
|
package/android/build.gradle
CHANGED
@@ -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[]){
|
34
|
-
|
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[]){
|
38
|
-
|
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
|
package/cpp/api/JsiSkCanvas.h
CHANGED
@@ -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,
|
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
|
-
|
407
|
-
|
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
|
-
|
601
|
-
|
602
|
-
|
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
|
}
|
package/cpp/api/JsiSkFont.h
CHANGED
@@ -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(
|
46
|
-
static_cast<SkScalar *>(widthPtrs.data()),
|
47
|
-
nullptr, paint.get());
|
47
|
+
getObject()->getWidthsBounds(g, widths, {}, paint.get());
|
48
48
|
} else {
|
49
|
-
getObject()->getWidthsBounds(
|
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
|
-
|
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(
|
79
|
-
static_cast<SkScalar *>(widthPtrs.data()),
|
80
|
-
nullptr, paint.get());
|
77
|
+
getObject()->getWidthsBounds(g, widths, {}, paint.get());
|
81
78
|
} else {
|
82
|
-
getObject()->getWidthsBounds(
|
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
|
-
|
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
|
166
|
-
|
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,
|
package/cpp/api/JsiSkPath.h
CHANGED
@@ -96,7 +96,8 @@ public:
|
|
96
96
|
runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime));
|
97
97
|
points.push_back(*point.get());
|
98
98
|
}
|
99
|
-
|
99
|
+
auto p = SkSpan(points.data(), points.size());
|
100
|
+
getObject()->addPoly(p, close);
|
100
101
|
return thisValue.getObject(runtime);
|
101
102
|
}
|
102
103
|
|
@@ -213,7 +214,8 @@ public:
|
|
213
214
|
SkScalar off = arguments[1].asNumber();
|
214
215
|
auto phase = arguments[2].asNumber();
|
215
216
|
SkScalar intervals[] = {on, off};
|
216
|
-
auto
|
217
|
+
auto i = SkSpan(intervals, 2);
|
218
|
+
auto pe = SkDashPathEffect::Make(i, phase);
|
217
219
|
if (!pe) {
|
218
220
|
// TODO: SkDebugf("Invalid args to dash()\n");
|
219
221
|
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) {
|
@@ -63,8 +63,9 @@ public:
|
|
63
63
|
runtime, jsiRsxforms.getValueAtIndex(runtime, i));
|
64
64
|
rsxforms.push_back(*rsxform);
|
65
65
|
}
|
66
|
-
auto
|
67
|
-
|
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,
|
95
|
+
glyphs.data(), glyphs.size() * bytesPerGlyph, x, *font,
|
94
96
|
SkTextEncoding::kGlyphID);
|
95
97
|
return jsi::Object::createFromHostObject(
|
96
98
|
runtime,
|
package/cpp/api/JsiSkTypeface.h
CHANGED
@@ -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,
|
41
|
+
SkTextEncoding::kUTF8,
|
42
|
+
SkSpan<SkGlyphID>(nullptr, 0));
|
42
43
|
std::vector<SkGlyphID> glyphIDs;
|
43
44
|
glyphIDs.resize(numGlyphIDs);
|
44
|
-
getObject()->textToGlyphs(
|
45
|
-
|
46
|
-
|
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(
|
256
|
-
|
257
|
-
|
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 =
|
300
|
-
|
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
|
-
|
536
|
-
|
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
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
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
|
-
|
944
|
-
|
945
|
-
|
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
|
58
|
-
|
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
|
-
|
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
|
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
|