@shopify/react-native-skia 1.5.3 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +53 -13
- package/android/build.gradle +3 -0
- package/android/cpp/rnskia-android/OpenGLContext.h +122 -11
- package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +73 -0
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +74 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +18 -1
- package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +12 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +13 -1
- package/android/cpp/rnskia-android/opengl/Context.h +77 -0
- package/android/cpp/rnskia-android/opengl/Display.h +117 -0
- package/android/cpp/rnskia-android/opengl/Error.cpp +9 -0
- package/android/cpp/rnskia-android/opengl/Error.h +44 -0
- package/android/cpp/rnskia-android/opengl/Surface.h +43 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -1
- package/cpp/api/JsiSkImage.h +15 -2
- package/cpp/api/JsiSkSurface.h +18 -3
- package/cpp/rnskia/DawnContext.h +241 -0
- package/cpp/rnskia/DawnUtils.h +127 -0
- package/cpp/rnskia/DawnWindowContext.cpp +19 -0
- package/cpp/rnskia/DawnWindowContext.h +77 -0
- package/cpp/rnskia/ImageProvider.h +100 -0
- package/cpp/rnskia/RNSkView.h +6 -0
- package/cpp/skia/include/android/SkAnimatedImage.h +14 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +39 -3
- package/cpp/skia/include/codec/SkCodec.h +16 -0
- package/cpp/skia/include/config/SkUserConfig.h +3 -2
- package/cpp/skia/include/core/SkCanvas.h +55 -10
- package/cpp/skia/include/core/SkContourMeasure.h +76 -0
- package/cpp/skia/include/core/SkFontScanner.h +48 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +11 -0
- package/cpp/skia/include/core/SkPathEffect.h +0 -23
- package/cpp/skia/include/core/SkRect.h +2 -0
- package/cpp/skia/include/core/SkString.h +4 -0
- package/cpp/skia/include/core/SkTypeface.h +5 -0
- package/cpp/skia/include/core/SkTypes.h +8 -3
- package/cpp/skia/include/docs/SkPDFDocument.h +3 -3
- package/cpp/skia/include/effects/SkOverdrawColorFilter.h +1 -0
- package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -1
- package/cpp/skia/include/encode/SkJpegEncoder.h +4 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +8 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +18 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +11 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +5 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLInterface.h +0 -1
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +8 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
- package/cpp/skia/include/gpu/graphite/precompile/PaintOptions.h +7 -4
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileImageFilter.h +2 -0
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileMaskFilter.h +2 -0
- package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +25 -0
- package/cpp/skia/include/ports/SkFontMgr_fontconfig.h +4 -2
- package/cpp/skia/include/ports/SkFontScanner_Fontations.h +15 -0
- package/cpp/skia/include/ports/SkFontScanner_FreeType.h +15 -0
- package/cpp/skia/include/private/SkExif.h +14 -0
- package/cpp/skia/include/private/SkPathRef.h +36 -0
- package/cpp/skia/include/private/base/SkFeatures.h +4 -0
- package/cpp/skia/include/private/base/SkSpan_impl.h +1 -3
- package/cpp/skia/modules/skcms/src/skcms_internals.h +3 -0
- package/cpp/skia/src/base/SkMathPriv.h +1 -8
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -2
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +25 -19
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +23 -0
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +4 -8
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +26 -8
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -20
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +5 -5
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +35 -9
- package/src/renderer/__tests__/e2e/SVG.spec.tsx +2 -1
- package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +0 -310
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +0 -188
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +0 -100
@@ -39,6 +39,8 @@ extern "C" {
|
|
39
39
|
// - Clang 18 runs into an ICE on armv7/androideabi with [[clang::musttail]].
|
40
40
|
// (http://crbug.com/1504548)
|
41
41
|
// - Android RISC-V also runs into an ICE (b/314692534)
|
42
|
+
// - So does Linux ppc64le (https://github.com/llvm/llvm-project/issues/108014,
|
43
|
+
// https://github.com/llvm/llvm-project/issues/98859)
|
42
44
|
// - LoongArch developers indicate they had to turn it off
|
43
45
|
// - Windows builds generate incorrect code with [[clang::musttail]] and crash mysteriously.
|
44
46
|
// (http://crbug.com/1505442)
|
@@ -47,6 +49,7 @@ extern "C" {
|
|
47
49
|
&& !defined(__EMSCRIPTEN__) \
|
48
50
|
&& !defined(__arm__) \
|
49
51
|
&& !defined(__riscv) \
|
52
|
+
&& !defined(__powerpc__) \
|
50
53
|
&& !defined(__loongarch__) \
|
51
54
|
&& !defined(_WIN32) && !defined(__SYMBIAN32__)
|
52
55
|
#define SKCMS_HAS_MUSTTAIL 1
|
@@ -300,17 +300,10 @@ constexpr int SkPrevPow2_portable(int value) {
|
|
300
300
|
|
301
301
|
///////////////////////////////////////////////////////////////////////////////
|
302
302
|
|
303
|
-
/**
|
304
|
-
* Return the smallest power-of-2 >= n.
|
305
|
-
*/
|
306
|
-
static inline uint32_t GrNextPow2(uint32_t n) {
|
307
|
-
return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
|
308
|
-
}
|
309
|
-
|
310
303
|
/**
|
311
304
|
* Returns the next power of 2 >= n or n if the next power of 2 can't be represented by size_t.
|
312
305
|
*/
|
313
|
-
|
306
|
+
constexpr size_t SkNextSizePow2(size_t n) {
|
314
307
|
constexpr int kNumSizeTBits = 8 * sizeof(size_t);
|
315
308
|
constexpr size_t kHighBitSet = size_t(1) << (kNumSizeTBits - 1);
|
316
309
|
|
@@ -30,8 +30,7 @@ public:
|
|
30
30
|
|
31
31
|
private:
|
32
32
|
std::shared_ptr<RNSkia::RNSkPlatformContext> _context;
|
33
|
-
|
34
|
-
float _height = -1;
|
33
|
+
std::unique_ptr<RNSkia::WindowContext> _ctx = nullptr;
|
35
34
|
#pragma clang diagnostic push
|
36
35
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
37
36
|
CAMetalLayer *_layer;
|
@@ -1,7 +1,13 @@
|
|
1
1
|
#import "RNSkMetalCanvasProvider.h"
|
2
|
-
|
2
|
+
|
3
3
|
#import "RNSkLog.h"
|
4
4
|
|
5
|
+
#if defined(SK_GRAPHITE)
|
6
|
+
#import "DawnContext.h"
|
7
|
+
#else
|
8
|
+
#import "MetalContext.h"
|
9
|
+
#endif
|
10
|
+
|
5
11
|
#pragma clang diagnostic push
|
6
12
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
7
13
|
|
@@ -30,19 +36,23 @@ RNSkMetalCanvasProvider::~RNSkMetalCanvasProvider() {}
|
|
30
36
|
/**
|
31
37
|
Returns the scaled width of the view
|
32
38
|
*/
|
33
|
-
float RNSkMetalCanvasProvider::getScaledWidth() {
|
39
|
+
float RNSkMetalCanvasProvider::getScaledWidth() {
|
40
|
+
return _ctx ? _ctx->getWidth() : -1;
|
41
|
+
};
|
34
42
|
|
35
43
|
/**
|
36
44
|
Returns the scaled height of the view
|
37
45
|
*/
|
38
|
-
float RNSkMetalCanvasProvider::getScaledHeight() {
|
46
|
+
float RNSkMetalCanvasProvider::getScaledHeight() {
|
47
|
+
return _ctx ? _ctx->getHeight() : -1;
|
48
|
+
};
|
39
49
|
|
40
50
|
/**
|
41
51
|
Render to a canvas
|
42
52
|
*/
|
43
53
|
bool RNSkMetalCanvasProvider::renderToCanvas(
|
44
54
|
const std::function<void(SkCanvas *)> &cb) {
|
45
|
-
if (
|
55
|
+
if (!_ctx) {
|
46
56
|
return false;
|
47
57
|
}
|
48
58
|
|
@@ -66,28 +76,24 @@ bool RNSkMetalCanvasProvider::renderToCanvas(
|
|
66
76
|
// rendering and not wait until later - we've seen some example of memory
|
67
77
|
// usage growing very fast in the simulator without this.
|
68
78
|
@autoreleasepool {
|
69
|
-
|
70
|
-
|
71
|
-
return false;
|
72
|
-
}
|
73
|
-
auto ctx = MetalContext::getInstance().MakeWindow(_layer, _width, _height);
|
74
|
-
auto skSurface = ctx->getSurface();
|
75
|
-
SkCanvas *canvas = skSurface->getCanvas();
|
79
|
+
auto surface = _ctx->getSurface();
|
80
|
+
auto canvas = surface->getCanvas();
|
76
81
|
cb(canvas);
|
77
|
-
|
78
|
-
if (auto dContext = GrAsDirectContext(skSurface->recordingContext())) {
|
79
|
-
dContext->flushAndSubmit();
|
80
|
-
}
|
81
|
-
|
82
|
-
ctx->present();
|
82
|
+
_ctx->present();
|
83
83
|
}
|
84
84
|
return true;
|
85
85
|
};
|
86
86
|
|
87
87
|
void RNSkMetalCanvasProvider::setSize(int width, int height) {
|
88
88
|
_layer.frame = CGRectMake(0, 0, width, height);
|
89
|
-
|
90
|
-
|
89
|
+
auto w = width * _context->getPixelDensity();
|
90
|
+
auto h = height * _context->getPixelDensity();
|
91
|
+
#if defined(SK_GRAPHITE)
|
92
|
+
_ctx = RNSkia::DawnContext::getInstance().MakeWindow((__bridge void *)_layer,
|
93
|
+
w, h);
|
94
|
+
#else
|
95
|
+
_ctx = MetalContext::getInstance().MakeWindow(_layer, w, h);
|
96
|
+
#endif
|
91
97
|
_requestRedraw();
|
92
98
|
}
|
93
99
|
|
@@ -5,7 +5,11 @@
|
|
5
5
|
#include <thread>
|
6
6
|
#include <utility>
|
7
7
|
|
8
|
+
#if defined(SK_GRAPHITE)
|
9
|
+
#include "DawnContext.h"
|
10
|
+
#else
|
8
11
|
#include "MetalContext.h"
|
12
|
+
#endif
|
9
13
|
#include "RNSkiOSVideo.h"
|
10
14
|
|
11
15
|
#pragma clang diagnostic push
|
@@ -69,10 +73,17 @@ void RNSkiOSPlatformContext::releaseNativeBuffer(uint64_t pointer) {
|
|
69
73
|
uint64_t RNSkiOSPlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
|
70
74
|
// 0. If Image is not in BGRA, convert to BGRA as only BGRA is supported.
|
71
75
|
if (image->colorType() != kBGRA_8888_SkColorType) {
|
76
|
+
#if defined(SK_GRAPHITE)
|
77
|
+
SkImage::RequiredProperties requiredProps;
|
78
|
+
image = image->makeColorTypeAndColorSpace(
|
79
|
+
DawnContext::getInstance().getRecorder(), kBGRA_8888_SkColorType,
|
80
|
+
SkColorSpace::MakeSRGB(), requiredProps);
|
81
|
+
#else
|
72
82
|
// on iOS, 32_BGRA is the only supported RGB format for CVPixelBuffers.
|
73
83
|
image = image->makeColorTypeAndColorSpace(
|
74
84
|
MetalContext::getInstance()._context.skContext.get(),
|
75
85
|
kBGRA_8888_SkColorType, SkColorSpace::MakeSRGB());
|
86
|
+
#endif
|
76
87
|
if (image == nullptr) {
|
77
88
|
throw std::runtime_error(
|
78
89
|
"Failed to convert image to BGRA_8888 colortype! Only BGRA_8888 "
|
@@ -152,8 +163,12 @@ RNSkiOSPlatformContext::createVideo(const std::string &url) {
|
|
152
163
|
std::shared_ptr<WindowContext>
|
153
164
|
RNSkiOSPlatformContext::makeContextFromNativeSurface(void *surface, int width,
|
154
165
|
int height) {
|
166
|
+
#if defined(SK_GRAPHITE)
|
167
|
+
return DawnContext::getInstance().MakeWindow(surface, width, height);
|
168
|
+
#else
|
155
169
|
return MetalContext::getInstance().MakeWindow((__bridge CALayer *)surface,
|
156
170
|
width, height);
|
171
|
+
#endif
|
157
172
|
}
|
158
173
|
|
159
174
|
void RNSkiOSPlatformContext::raiseError(const std::exception &err) {
|
@@ -162,11 +177,19 @@ void RNSkiOSPlatformContext::raiseError(const std::exception &err) {
|
|
162
177
|
|
163
178
|
sk_sp<SkSurface> RNSkiOSPlatformContext::makeOffscreenSurface(int width,
|
164
179
|
int height) {
|
180
|
+
#if defined(SK_GRAPHITE)
|
181
|
+
return DawnContext::getInstance().MakeOffscreen(width, height);
|
182
|
+
#else
|
165
183
|
return MetalContext::getInstance().MakeOffscreen(width, height);
|
184
|
+
#endif
|
166
185
|
}
|
167
186
|
|
168
187
|
sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeBuffer(void *buffer) {
|
188
|
+
#if defined(SK_GRAPHITE)
|
189
|
+
return DawnContext::getInstance().MakeImageFromBuffer(buffer);
|
190
|
+
#else
|
169
191
|
return MetalContext::getInstance().MakeImageFromBuffer(buffer);
|
192
|
+
#endif
|
170
193
|
}
|
171
194
|
|
172
195
|
sk_sp<SkFontMgr> RNSkiOSPlatformContext::createFontMgr() {
|
@@ -23,16 +23,12 @@
|
|
23
23
|
#include <TargetConditionals.h>
|
24
24
|
#if TARGET_RT_BIG_ENDIAN
|
25
25
|
#define FourCC2Str(fourcc) \
|
26
|
-
(const char[])
|
27
|
-
|
28
|
-
*(((char *)&fourcc) + 3), 0 \
|
29
|
-
}
|
26
|
+
(const char[]){*((char *)&fourcc), *(((char *)&fourcc) + 1), \
|
27
|
+
*(((char *)&fourcc) + 2), *(((char *)&fourcc) + 3), 0}
|
30
28
|
#else
|
31
29
|
#define FourCC2Str(fourcc) \
|
32
|
-
(const char[])
|
33
|
-
|
34
|
-
*(((char *)&fourcc) + 1), *(((char *)&fourcc) + 0), 0 \
|
35
|
-
}
|
30
|
+
(const char[]){*(((char *)&fourcc) + 3), *(((char *)&fourcc) + 2), \
|
31
|
+
*(((char *)&fourcc) + 1), *(((char *)&fourcc) + 0), 0}
|
36
32
|
#endif
|
37
33
|
|
38
34
|
// pragma MARK: TextureHolder
|
@@ -11,9 +11,19 @@
|
|
11
11
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
12
12
|
|
13
13
|
#import "include/core/SkCanvas.h"
|
14
|
+
#import "include/core/SkColorSpace.h"
|
15
|
+
|
14
16
|
#import <CoreMedia/CMSampleBuffer.h>
|
15
17
|
#import <CoreVideo/CVMetalTextureCache.h>
|
18
|
+
|
19
|
+
#import <include/gpu/ganesh/GrBackendSurface.h>
|
16
20
|
#import <include/gpu/ganesh/GrDirectContext.h>
|
21
|
+
#import <include/gpu/ganesh/SkImageGanesh.h>
|
22
|
+
#import <include/gpu/ganesh/SkSurfaceGanesh.h>
|
23
|
+
#import <include/gpu/ganesh/mtl/GrMtlBackendContext.h>
|
24
|
+
#import <include/gpu/ganesh/mtl/GrMtlBackendSurface.h>
|
25
|
+
#import <include/gpu/ganesh/mtl/GrMtlDirectContext.h>
|
26
|
+
#import <include/gpu/ganesh/mtl/SkSurfaceMetal.h>
|
17
27
|
|
18
28
|
#pragma clang diagnostic pop
|
19
29
|
|
@@ -26,9 +36,6 @@ class SkiaMetalSurfaceFactory {
|
|
26
36
|
friend class IOSSkiaContext;
|
27
37
|
|
28
38
|
public:
|
29
|
-
static sk_sp<SkSurface> makeWindowedSurface(SkiaMetalContext *context,
|
30
|
-
id<MTLTexture> texture, int width,
|
31
|
-
int height);
|
32
39
|
static sk_sp<SkSurface> makeOffscreenSurface(id<MTLDevice> device,
|
33
40
|
SkiaMetalContext *context,
|
34
41
|
int width, int height);
|
@@ -76,9 +83,16 @@ public:
|
|
76
83
|
}
|
77
84
|
|
78
85
|
// Get the texture from the drawable
|
79
|
-
|
80
|
-
|
81
|
-
|
86
|
+
GrMtlTextureInfo fbInfo;
|
87
|
+
fbInfo.fTexture.retain((__bridge void *)_currentDrawable.texture);
|
88
|
+
|
89
|
+
GrBackendRenderTarget backendRT = GrBackendRenderTargets::MakeMtl(
|
90
|
+
_layer.drawableSize.width, _layer.drawableSize.height, fbInfo);
|
91
|
+
|
92
|
+
_skSurface = SkSurfaces::WrapBackendRenderTarget(
|
93
|
+
_context->skContext.get(), backendRT, kTopLeft_GrSurfaceOrigin,
|
94
|
+
kBGRA_8888_SkColorType, nullptr, nullptr);
|
95
|
+
|
82
96
|
return _skSurface;
|
83
97
|
}
|
84
98
|
|
@@ -95,9 +109,13 @@ public:
|
|
95
109
|
|
96
110
|
void resize(int width, int height) override { _skSurface = nullptr; }
|
97
111
|
|
98
|
-
int getWidth() override {
|
112
|
+
int getWidth() override {
|
113
|
+
return _layer.frame.size.width * _layer.contentsScale;
|
114
|
+
};
|
99
115
|
|
100
|
-
int getHeight() override {
|
116
|
+
int getHeight() override {
|
117
|
+
return _layer.frame.size.height * _layer.contentsScale;
|
118
|
+
};
|
101
119
|
|
102
120
|
private:
|
103
121
|
SkiaMetalContext *_context;
|
@@ -46,26 +46,6 @@ SkiaMetalSurfaceFactory::makeContext(SkiaMetalContext *context,
|
|
46
46
|
return std::make_unique<IOSSkiaContext>(context, texture, width, height);
|
47
47
|
}
|
48
48
|
|
49
|
-
sk_sp<SkSurface> SkiaMetalSurfaceFactory::makeWindowedSurface(
|
50
|
-
SkiaMetalContext *context, id<MTLTexture> texture, int width, int height) {
|
51
|
-
GrMtlTextureInfo fbInfo;
|
52
|
-
fbInfo.fTexture.retain((__bridge void *)texture);
|
53
|
-
|
54
|
-
GrBackendRenderTarget backendRT =
|
55
|
-
GrBackendRenderTargets::MakeMtl(width, height, fbInfo);
|
56
|
-
|
57
|
-
auto skSurface = SkSurfaces::WrapBackendRenderTarget(
|
58
|
-
context->skContext.get(), backendRT, kTopLeft_GrSurfaceOrigin,
|
59
|
-
kBGRA_8888_SkColorType, nullptr, nullptr);
|
60
|
-
|
61
|
-
if (skSurface == nullptr || skSurface->getCanvas() == nullptr) {
|
62
|
-
RNSkia::RNSkLogger::logToConsole(
|
63
|
-
"Skia surface could not be created from parameters.");
|
64
|
-
return nullptr;
|
65
|
-
}
|
66
|
-
return skSurface;
|
67
|
-
}
|
68
|
-
|
69
49
|
sk_sp<SkSurface> SkiaMetalSurfaceFactory::makeOffscreenSurface(
|
70
50
|
id<MTLDevice> device, SkiaMetalContext *context, int width, int height) {
|
71
51
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskshaper.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
11
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libskshaper.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
15
15
|
<array>
|
16
16
|
<string>arm64</string>
|
17
17
|
<string>arm64e</string>
|
18
|
+
<string>x86_64</string>
|
18
19
|
</array>
|
19
20
|
<key>SupportedPlatform</key>
|
20
21
|
<string>ios</string>
|
22
|
+
<key>SupportedPlatformVariant</key>
|
23
|
+
<string>simulator</string>
|
21
24
|
</dict>
|
22
25
|
<dict>
|
23
26
|
<key>BinaryPath</key>
|
24
27
|
<string>libskshaper.a</string>
|
25
28
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>ios-
|
29
|
+
<string>ios-arm64_arm64e</string>
|
27
30
|
<key>LibraryPath</key>
|
28
31
|
<string>libskshaper.a</string>
|
29
32
|
<key>SupportedArchitectures</key>
|
30
33
|
<array>
|
31
34
|
<string>arm64</string>
|
32
35
|
<string>arm64e</string>
|
33
|
-
<string>x86_64</string>
|
34
36
|
</array>
|
35
37
|
<key>SupportedPlatform</key>
|
36
38
|
<string>ios</string>
|
37
|
-
<key>SupportedPlatformVariant</key>
|
38
|
-
<string>simulator</string>
|
39
39
|
</dict>
|
40
40
|
</array>
|
41
41
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskunicode_core.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
11
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libskunicode_core.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
15
15
|
<array>
|
16
16
|
<string>arm64</string>
|
17
17
|
<string>arm64e</string>
|
18
|
+
<string>x86_64</string>
|
18
19
|
</array>
|
19
20
|
<key>SupportedPlatform</key>
|
20
21
|
<string>ios</string>
|
22
|
+
<key>SupportedPlatformVariant</key>
|
23
|
+
<string>simulator</string>
|
21
24
|
</dict>
|
22
25
|
<dict>
|
23
26
|
<key>BinaryPath</key>
|
24
27
|
<string>libskunicode_core.a</string>
|
25
28
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>ios-
|
29
|
+
<string>ios-arm64_arm64e</string>
|
27
30
|
<key>LibraryPath</key>
|
28
31
|
<string>libskunicode_core.a</string>
|
29
32
|
<key>SupportedArchitectures</key>
|
30
33
|
<array>
|
31
34
|
<string>arm64</string>
|
32
35
|
<string>arm64e</string>
|
33
|
-
<string>x86_64</string>
|
34
36
|
</array>
|
35
37
|
<key>SupportedPlatform</key>
|
36
38
|
<string>ios</string>
|
37
|
-
<key>SupportedPlatformVariant</key>
|
38
|
-
<string>simulator</string>
|
39
39
|
</dict>
|
40
40
|
</array>
|
41
41
|
<key>CFBundlePackageType</key>
|
Binary file
|
package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a
CHANGED
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskunicode_libgrapheme.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
11
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libskunicode_libgrapheme.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
15
15
|
<array>
|
16
16
|
<string>arm64</string>
|
17
17
|
<string>arm64e</string>
|
18
|
+
<string>x86_64</string>
|
18
19
|
</array>
|
19
20
|
<key>SupportedPlatform</key>
|
20
21
|
<string>ios</string>
|
22
|
+
<key>SupportedPlatformVariant</key>
|
23
|
+
<string>simulator</string>
|
21
24
|
</dict>
|
22
25
|
<dict>
|
23
26
|
<key>BinaryPath</key>
|
24
27
|
<string>libskunicode_libgrapheme.a</string>
|
25
28
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>ios-
|
29
|
+
<string>ios-arm64_arm64e</string>
|
27
30
|
<key>LibraryPath</key>
|
28
31
|
<string>libskunicode_libgrapheme.a</string>
|
29
32
|
<key>SupportedArchitectures</key>
|
30
33
|
<array>
|
31
34
|
<string>arm64</string>
|
32
35
|
<string>arm64e</string>
|
33
|
-
<string>x86_64</string>
|
34
36
|
</array>
|
35
37
|
<key>SupportedPlatform</key>
|
36
38
|
<string>ios</string>
|
37
|
-
<key>SupportedPlatformVariant</key>
|
38
|
-
<string>simulator</string>
|
39
39
|
</dict>
|
40
40
|
</array>
|
41
41
|
<key>CFBundlePackageType</key>
|
package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
8
8
|
},
|
9
9
|
"title": "React Native Skia",
|
10
|
-
"version": "1.5.
|
10
|
+
"version": "1.5.5",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"react-native": "src/index.ts",
|
@@ -4,6 +4,29 @@ require "json"
|
|
4
4
|
|
5
5
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
6
6
|
|
7
|
+
# Check for GRAPHITE env var
|
8
|
+
use_graphite = ENV['SK_GRAPHITE'] == '1'
|
9
|
+
|
10
|
+
# Set preprocessor definitions based on GRAPHITE flag
|
11
|
+
preprocessor_defs = use_graphite ?
|
12
|
+
'$(inherited) SK_GRAPHITE=1' :
|
13
|
+
'$(inherited) SK_METAL=1 SK_GANESH=1'
|
14
|
+
|
15
|
+
# Define base frameworks
|
16
|
+
base_frameworks = ['libs/ios/libskia.xcframework',
|
17
|
+
'libs/ios/libsvg.xcframework',
|
18
|
+
'libs/ios/libskshaper.xcframework',
|
19
|
+
'libs/ios/libskparagraph.xcframework',
|
20
|
+
'libs/ios/libskunicode_core.xcframework',
|
21
|
+
'libs/ios/libskunicode_libgrapheme.xcframework',]
|
22
|
+
|
23
|
+
# Add Graphite frameworks if enabled
|
24
|
+
graphite_frameworks = [
|
25
|
+
'libs/ios/libdawn_native_static.xcframework',
|
26
|
+
'libs/ios/libdawn_platform_static.xcframework',
|
27
|
+
'libs/ios/libdawn_proc_static.xcframework'
|
28
|
+
]
|
29
|
+
|
7
30
|
Pod::Spec.new do |s|
|
8
31
|
s.name = "react-native-skia"
|
9
32
|
s.version = package["version"]
|
@@ -23,7 +46,7 @@ Pod::Spec.new do |s|
|
|
23
46
|
|
24
47
|
s.requires_arc = true
|
25
48
|
s.pod_target_xcconfig = {
|
26
|
-
'GCC_PREPROCESSOR_DEFINITIONS' =>
|
49
|
+
'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_defs,
|
27
50
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
28
51
|
'DEFINES_MODULE' => 'YES',
|
29
52
|
"HEADER_SEARCH_PATHS" => '"$(PODS_TARGET_SRCROOT)/cpp/"/**'
|
@@ -31,14 +54,9 @@ Pod::Spec.new do |s|
|
|
31
54
|
|
32
55
|
s.frameworks = 'MetalKit'
|
33
56
|
|
34
|
-
s.ios.vendored_frameworks =
|
35
|
-
|
36
|
-
|
37
|
-
'libs/ios/libskshaper.xcframework',
|
38
|
-
'libs/ios/libskparagraph.xcframework',
|
39
|
-
'libs/ios/libskunicode_core.xcframework',
|
40
|
-
'libs/ios/libskunicode_libgrapheme.xcframework',
|
41
|
-
]
|
57
|
+
s.ios.vendored_frameworks = use_graphite ?
|
58
|
+
base_frameworks + graphite_frameworks :
|
59
|
+
base_frameworks
|
42
60
|
|
43
61
|
# All iOS cpp/h files
|
44
62
|
s.source_files = [
|
@@ -46,6 +64,14 @@ Pod::Spec.new do |s|
|
|
46
64
|
"cpp/**/*.{h,cpp}"
|
47
65
|
]
|
48
66
|
|
67
|
+
graphite_exclusions = [
|
68
|
+
'cpp/rnskia/DawnContext.h',
|
69
|
+
'cpp/rnskia/DawnUtils.h',
|
70
|
+
'cpp/rnskia/DawnWindowContext.h',
|
71
|
+
'cpp/rnskia/DawnWindowContext.cpp',
|
72
|
+
'cpp/rnskia/ImageProvider.h'
|
73
|
+
]
|
74
|
+
s.exclude_files = graphite_exclusions unless use_graphite
|
49
75
|
|
50
76
|
if defined?(install_modules_dependencies()) != nil
|
51
77
|
install_modules_dependencies(s)
|
@@ -170,7 +170,8 @@ describe("Displays SVGs", () => {
|
|
170
170
|
</Group>
|
171
171
|
</>
|
172
172
|
);
|
173
|
-
|
173
|
+
// TODO: Currently there are artifacts on Graphite/iOS
|
174
|
+
checkImage(image, docPath("opacity-tiger.png"), { maxPixelDiff: 500 });
|
174
175
|
});
|
175
176
|
|
176
177
|
itRunsE2eOnly("text shouldn't crash on iOS", async () => {
|