@shopify/react-native-skia 2.4.7 → 2.4.14
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/cpp/jni/JniPlatformContext.cpp +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +11 -1
- package/apple/RNSkApplePlatformContext.h +4 -0
- package/apple/RNSkApplePlatformContext.mm +69 -0
- package/apple/SkiaCVPixelBufferUtils.mm +8 -4
- package/cpp/api/JsiSkFontMgr.h +30 -6
- package/cpp/api/JsiSkImageFilterFactory.h +4 -2
- package/cpp/api/JsiSkPictureFactory.h +9 -6
- package/cpp/api/recorder/RNRecorder.h +33 -55
- package/cpp/rnskia/RNSkPlatformContext.h +16 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +3 -2
- package/cpp/skia/include/codec/SkAvifDecoder.h +2 -2
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +2 -8
- package/cpp/skia/include/codec/SkEncodedOrigin.h +17 -0
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
- package/cpp/skia/include/codec/SkJpegDecoder.h +8 -1
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
- package/cpp/skia/include/codec/SkPngDecoder.h +8 -1
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWebpDecoder.h +8 -1
- package/cpp/skia/include/core/SkCPURecorder.h +1 -0
- package/cpp/skia/include/core/SkCanvas.h +3 -2
- package/cpp/skia/include/core/SkColorTable.h +1 -1
- package/cpp/skia/include/core/SkColorType.h +4 -0
- package/cpp/skia/include/core/SkDocument.h +1 -1
- package/cpp/skia/include/core/SkGraphics.h +7 -2
- package/cpp/skia/include/core/SkImage.h +5 -1
- package/cpp/skia/include/core/SkImageGenerator.h +5 -3
- package/cpp/skia/include/core/SkM44.h +3 -3
- package/cpp/skia/include/core/SkMatrix.h +0 -23
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +1 -1
- package/cpp/skia/include/core/SkPath.h +216 -185
- package/cpp/skia/include/core/SkPathBuilder.h +97 -47
- package/cpp/skia/include/core/SkPathTypes.h +7 -1
- package/cpp/skia/include/core/SkPixmap.h +8 -8
- package/cpp/skia/include/core/SkRRect.h +24 -3
- package/cpp/skia/include/core/SkRecorder.h +3 -1
- package/cpp/skia/include/core/SkScalar.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +8 -4
- package/cpp/skia/include/core/SkStream.h +16 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkYUVAInfo.h +3 -0
- package/cpp/skia/include/docs/SkPDFDocument.h +1 -1
- package/cpp/skia/include/docs/SkPDFJpegHelpers.h +1 -1
- package/cpp/skia/include/docs/SkXPSDocument.h +18 -2
- package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -1
- package/cpp/skia/include/encode/SkPngRustEncoder.h +18 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +7 -6
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +6 -0
- package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +2 -4
- package/cpp/skia/include/gpu/graphite/Context.h +15 -1
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +52 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +44 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +1 -1
- package/cpp/skia/include/gpu/graphite/PersistentPipelineStorage.h +45 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +14 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +13 -5
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +1 -4
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -4
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +2 -8
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +124 -9
- package/cpp/skia/include/ports/SkFontMgr_fuchsia.h +3 -1
- package/cpp/skia/include/ports/SkImageGeneratorCG.h +1 -1
- package/cpp/skia/include/ports/SkImageGeneratorNDK.h +1 -1
- package/cpp/skia/include/ports/SkImageGeneratorWIC.h +1 -1
- package/cpp/skia/include/ports/SkTypeface_fontations.h +1 -1
- package/cpp/skia/include/private/SkEncodedInfo.h +38 -29
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +18 -13
- package/cpp/skia/include/private/SkPathRef.h +3 -6
- package/cpp/skia/include/private/base/SkAlign.h +3 -7
- package/cpp/skia/include/private/base/SkContainers.h +1 -1
- package/cpp/skia/include/private/base/SkSpan_impl.h +29 -0
- package/cpp/skia/include/private/base/SkTArray.h +7 -8
- package/cpp/skia/include/private/base/SkTDArray.h +4 -4
- package/cpp/skia/include/private/base/SkTemplates.h +5 -5
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -5
- package/cpp/skia/include/svg/SkSVGCanvas.h +21 -1
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +1 -1
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -1
- package/cpp/skia/modules/skcms/src/skcms_public.h +29 -4
- package/cpp/skia/modules/skottie/include/Skottie.h +11 -0
- package/cpp/skia/modules/skottie/include/SlotManager.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Metrics.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGMerge.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGPath.h +1 -1
- package/cpp/skia/modules/skshaper/include/SkShaper.h +2 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +4 -4
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/lib/commonjs/skia/core/Font.js +7 -1
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/module/skia/core/Font.js +7 -1
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/core/Font.d.ts +1 -1
- package/lib/typescript/lib/module/mock/index.d.ts +1 -1
- package/lib/typescript/lib/module/skia/core/Font.d.ts +1 -1
- package/package.json +8 -8
- package/scripts/install-skia.mjs +74 -1
- package/src/skia/core/Font.ts +9 -4
package/scripts/install-skia.mjs
CHANGED
|
@@ -59,10 +59,11 @@ console.log(
|
|
|
59
59
|
`📦 Downloading Skia prebuilt binaries for ${releaseTag}`
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
const runCommand = (command, args) => {
|
|
62
|
+
const runCommand = (command, args, options = {}) => {
|
|
63
63
|
return new Promise((resolve, reject) => {
|
|
64
64
|
const child = spawn(command, args, {
|
|
65
65
|
stdio: ["ignore", "inherit", "inherit"],
|
|
66
|
+
...options,
|
|
66
67
|
});
|
|
67
68
|
child.on("error", (error) => {
|
|
68
69
|
reject(error);
|
|
@@ -77,6 +78,75 @@ const runCommand = (command, args) => {
|
|
|
77
78
|
});
|
|
78
79
|
};
|
|
79
80
|
|
|
81
|
+
const runCommandWithOutput = (command, args, options = {}) => {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const child = spawn(command, args, {
|
|
84
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
85
|
+
...options,
|
|
86
|
+
});
|
|
87
|
+
let stdout = "";
|
|
88
|
+
let stderr = "";
|
|
89
|
+
child.stdout.on("data", (data) => {
|
|
90
|
+
stdout += data.toString();
|
|
91
|
+
});
|
|
92
|
+
child.stderr.on("data", (data) => {
|
|
93
|
+
stderr += data.toString();
|
|
94
|
+
});
|
|
95
|
+
child.on("error", (error) => {
|
|
96
|
+
reject(error);
|
|
97
|
+
});
|
|
98
|
+
child.on("close", (code) => {
|
|
99
|
+
if (code === 0) {
|
|
100
|
+
resolve(stdout.trim());
|
|
101
|
+
} else {
|
|
102
|
+
reject(new Error(`Command ${command} exited with code ${code}: ${stderr}`));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const skiaDir = path.resolve(__dirname, "../../../externals/skia");
|
|
109
|
+
|
|
110
|
+
const checkoutSkiaBranch = async (version) => {
|
|
111
|
+
const branchName = `chrome/${version}`;
|
|
112
|
+
|
|
113
|
+
// Check if the skia directory exists and is a git repo
|
|
114
|
+
// (won't exist when installed via npm - submodule is not included in the package)
|
|
115
|
+
if (!fs.existsSync(skiaDir) || !fs.existsSync(path.join(skiaDir, ".git"))) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log(`🔀 Checking out Skia branch: ${branchName}`);
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
// Get current branch/commit
|
|
123
|
+
const currentRef = await runCommandWithOutput("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: skiaDir });
|
|
124
|
+
|
|
125
|
+
if (currentRef === branchName) {
|
|
126
|
+
console.log(` ✓ Already on branch ${branchName}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Fetch the branch from origin
|
|
131
|
+
console.log(` Fetching branch ${branchName} from origin...`);
|
|
132
|
+
try {
|
|
133
|
+
await runCommand("git", ["fetch", "origin", `${branchName}:${branchName}`], { cwd: skiaDir });
|
|
134
|
+
} catch (e) {
|
|
135
|
+
// Branch might already exist locally, try to update it
|
|
136
|
+
await runCommand("git", ["fetch", "origin", branchName], { cwd: skiaDir });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Checkout the branch (use -f to discard local changes in the submodule)
|
|
140
|
+
console.log(` Checking out ${branchName}...`);
|
|
141
|
+
await runCommand("git", ["checkout", "-f", branchName], { cwd: skiaDir });
|
|
142
|
+
|
|
143
|
+
console.log(` ✓ Successfully checked out ${branchName}`);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error(` ⚠️ Failed to checkout branch ${branchName}: ${error.message}`);
|
|
146
|
+
console.error(" Headers may not match the prebuilt binaries!");
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
80
150
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
81
151
|
|
|
82
152
|
const downloadToFile = (url, destPath, maxRetries = 5) => {
|
|
@@ -359,6 +429,9 @@ const clearDirectory = (directory) => {
|
|
|
359
429
|
};
|
|
360
430
|
|
|
361
431
|
const main = async () => {
|
|
432
|
+
// Ensure the skia submodule is on the correct branch for copying headers
|
|
433
|
+
await checkoutSkiaBranch(skiaVersion);
|
|
434
|
+
|
|
362
435
|
// Check if binaries are installed and checksums match
|
|
363
436
|
if (areBinariesInstalled() && verifyChecksums()) {
|
|
364
437
|
console.log("✅ Prebuilt binaries already installed with matching checksums, skipping download");
|
package/src/skia/core/Font.ts
CHANGED
|
@@ -95,10 +95,15 @@ export const matchFont = (
|
|
|
95
95
|
return Skia.Font(typeface, fontStyle.fontSize);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
export const listFontFamilies = (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
export const listFontFamilies = (
|
|
99
|
+
fontMgr: SkFontMgr = Skia.FontMgr.System()
|
|
100
|
+
) => {
|
|
101
|
+
const families = new Set<string>();
|
|
102
|
+
for (let i = 0; i < fontMgr.countFamilies(); i++) {
|
|
103
|
+
families.add(fontMgr.getFamilyName(i));
|
|
104
|
+
}
|
|
105
|
+
return Array.from(families);
|
|
106
|
+
};
|
|
102
107
|
|
|
103
108
|
const loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {
|
|
104
109
|
const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {
|